Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Roger Martin from CNC Software

CNC Software
  • Posts

    2,870
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Roger Martin from CNC Software

  1. In the NET-Hook API Reference… I drilled down to Mastercam.Operations Selected the Operation type I’m interested in (e.g. ContourOperation) and in its Methods section I see GetChainArray – “This method retrieves the Chains in this operation.” What are you trying to do with the Chains? What type(s) of Operations are you "processing"?
  2. Do mean the tools contained within a DrillBlock tool? If so, the answer is no.
  3. Chad, Check this thread over at the forum on mastercam.com http://forum.mastercam.com/Topic8177.aspx It sounds as if this may be what you're referring to ?
  4. In X9 Settings - Customize and under the Category "Router C-Hooks" you should find Rast2Vec. Add it to a toolbar / right-click menu / keystroke as you desire.
  5. Only bug1$ and putting the bug1$ setting in the PSB doesn't sound like a good idea to me.
  6. In the Post Processor (PST) that is being used... Is bug1$ defined? And if so, is it set to a value other then '0'?
  7. Rui, You do not want your C-Hook to be a CWinApp. A C-Hook for “modern” Mastercam is a MFC extension style DLL. You’ll not need these old pretranslate callbacks. Having never heard of these pretranslate callbacks, I searched back and found that they were removed after Mastercam X2 (8 years and 2 weeks ago!). Using Visual Studio 2013 (required for X9 and the upcoming 2017) create a new C-Hook project using the CHookWizard (Project Template) that the C-Hook SDK installs into VS-2013. It may be easier just to move your code over to this new project instead of retro-fitting you old project
  8. You are looking to remove just the "names" (and level set names?) of all of the levels in a file?
  9. In X9, in a NET-Hook you cannot really know when all of the operations have completed (or not) . In Mastercam 2017 there will be a new Notify method jut for this purpose -> public override MCamReturn MultiThreadOpStateNotify(int opId, MCamMultiThreadOpState state) { string status = "Unknown"; switch (state) { case Mastercam.App.Types.MCamMultiThreadOpState.Success: status = "Success"; break; case Mastercam.App.Types.MCamMultiThreadOpState.Stopped: status = "Stopped"; break; case Mastercam.App.Types.MCamMultiThreadOpState.Failed: status = "Failed"; break; } MessageBox.Show( string.Format("opID: {0}\nState: {1}", opId, status), "MultiThread Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); return Mastercam.App.Types.MCamReturn.NoErrors; } You'd make note of the opIDs that you submitted to be regenerated and then using the MultiThreadOpStateNotify method you can determine their status.
  10. I just downloaded it 'mastercamx9-md-cd-pst-rename.zip' from the web site (http://www.mastercam.com/en-us/Support/Downloads/Mastercam) and it contains the MD_CD_PST_Rename.msi (installer) as expected.
  11. Doesn’t appear to be. I was a bit surprised myself. It must have never come up before. (The behavior was the same in X8.) I’ll log a request that this be investigated further to see what can be done in the future. You can create geometry on an invisible level, but you cannot chain entities that are not visible. Roger Martin CNC Software, Inc. API/SDK support survey
  12. FILE - Options - Choose command from: (Commands Not in the RIbbon) Scroll down to "Run a VB Script" Add it to a new tab in Ribbon or the Quick Access Toolbar
  13. I'd have to say that I do not recall anyone asking about this before! You cannot rearrange the order of the operations in the tree programmatically with a NET-Hook add-in. It may be possible with a C-Hook, but I'd have to confirm that.
  14. SetEntityLevel sets the level of an entity. ​You have not told it which entity to alter. You need to run through the entities that you've 'selected' and change them. '//////////////////////////////////////////////////////////////////////////////// '// File Name: MoveToLevel.vbs '// Date: 02/19/2016 '// '// Description: '// This script demonstrates changing the Level of entities. '// So we are "moving" all entities (that are NOT on Level #1) to Level #6 '// '//////////////////////////////////////////////////////////////////////////////// Const DEF_GIVE_ME_EVERYTHING = -1 ' -- Start Script Call Main() ' //////////////////// ' Sub Declaration ' //////////////////// Sub Main() Dim bRet ' Turn off Level #1 so we do NOT select anything on this level Call SetLevelVisibleByNumber(1, False) ' This selects all "visible" entities SelectAll ' Run through the database looking for selected entities bRet = StartDBSearch(mc_selected, DEF_GIVE_ME_EVERYTHING) If bRet Then Do ' Change the level on each "selected" entity that we find. Call SetEntityLevel(6) bRet = NextDBSearch Loop While bRet End If ' Like is says... UnselectAll ' Here we assume that the data we "moved" was on Level #7 ' So we want to remove that level from the levels list. ' Usually we do not need to do anything as the level has no entities, but... ' If a level has a name, Mastercam will not auto-purge it as an empty level Call SetLevelName (7, "") ' Refresh (and FIT) the graphics display Call RepaintScreen(True) End Sub
  15. Forget about *UpdateToolSettings, as it’s not going to do anything useful for here. Even if it actually completely successfully… It updates the tool info in the operation, except for these Operation values -> LengthOffset DiameterOffset SpindleSpeed FeedRate PlungeRate RetractRate op.OperationTool = tool; op.Commit(); bool result = op.UpdateToolSettings(); // Check the return of this method. It is true?
  16. Do what you're doing. No => ...if there's a more elegant solution that I missed. I'll investigate the possibility of have some way to do "re-initialize feeds and speeds", in a future version.
  17. No, it's not quite exactly like -> choosing "Re-initialize feeds and speeds" in the operation parameters window Unless I'm missing something, I would not expect this to really do anything. op.OperationTool = tool; op.Commit(); op.UpdateToolSettings(); You set the Tool into the Operation and Commit the Operation (all good). The op.UpdateToolSettings() after is only going to push data from the Tool that is already in the Operation.
  18. Indeed it does fail when attempting to process a Makino TECH file. There are some thickness values in those Makino TECH files that fail this 'convert text to double' - let t = Convert.ToDouble(record.Element("thickness").Value) So... if wish wish to process those files, we'll need some additional logic it determine the thickness value(s). Try it on one the Mitsubishi named TECH files and it works. [e.g. Mitsubishi (FA-S).tech] *You may not see any difference the _OUT file, as most (if not all) of the TECH files are already ordered by increasing material 'thickness'.
  19. You can launch a NET-Hook from within a PST. For manipulating XML data, .NET is the easy way to go. This (C#) method reorders the <record> items within each <record_block> by the Material Thickness. You can find examples of the data this works with in -> C:\Users\Public\Documents\shared mcamx9\wire\Power Those .TECH files you see there are XML data. You can use the free Visual Studio Community Edition to build NET-Hooks -> https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx bool ReorderByMaterialThickness(string inFile, string outFile) { bool result = false; try { XDocument document = XDocument.Load(inFile); foreach (var rb in document.Descendants("record_block")) { // A LINQ statement to select and sort the record items in the TECH (XML) data file. var records = from record in rb.Elements("record") let t = Convert.ToDouble(record.Element("thickness").Value) orderby (t) select record; int cnt = 1; foreach (XElement rec in records) { // reset the num attribute on the record rec.Attribute("num").Value = (cnt++).ToString(); // We've done something, so assume that it's good. result = true; } // We need the reordered data to be an Array format. var reordered = records.ToArray(); // Reove the old records. rb.Elements("record").Remove(); // And repalce them with the new reordered ones. rb.Add(reordered); } document.Save(outFile); } catch (Exception ex) { MessageBox.Show(ex.Message, "ReorderByMaterialThickness"); } return result; }
  20. You wish to manipulate XML data from within a PST ? The MP Post language does not have XML specific functions, as it never deals with XML. Manipulation XML is fairly simple using .NET (C#) Maybe a NET-Hook Add-In solution would get you what you need.
  21. Creating NET-Hooks does not require a specific "Platform Toolset" as is the case for C-Hooks. You can use the free Community Edition of Visual Studio for building NET-Hooks (not C-Hooks). Visual Studio Community Edition 2015
  22. ... create threadmill operation with the net-hook - I have mastercam X6 No, as the NET-Hook API did not yet support the Thread Mill toolpath in X6.
  23. I am unable to duplicate what you are describing. I dropped this code into a NET-Hook and running it in X9 I get=> If no Machine Group, exists, a “default” Mill group will be created for the new Pocket Operation. If a Machine Group, already exists, another is not created and the new Pocket Operation is added to this existing Machine Group.
  24. StartTransaction / CommitTransaction is not enough handle this situation were you modify an existing entity. I see that the ability to flag this special type of UnDo transaction is not supported in the NET-Hook API I've entered an enhancement request into our system to see if that can be added.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...