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:

samuelhanson

Verified Members
  • Posts

    30
  • Joined

  • Last visited

samuelhanson's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Sorry for delay, I was focused on other projects. This could still be useful. Can we pass a Mastercam.Database.Operation entity for sourceOperation? And an integer for tagetIndex. Perhaps: InsertAt(operation, targetIndex) InsertBefore(operation, targetOperation) InsertAfter(operation, targetOperation) If that isn't possible, then perhaps move all ops with selected flag set: insertSelectedAt(targetIndex) If SearchManager.GetOperations always returns in same order as the toolpath manager list, that would be good in itself. Otherwise a way to get a list of operations in that order would be useful.
  2. The ability to directly set position of any individual operation in the list would be most helpful to me. Something like moveOperation(operation, targetIndex) Mastercam X9, mill and router
  3. When importing tools from an external file is there a way to distinguish tools in a drilling block from "library" tools? var toolData = new Mastercam.Database.Tool[0]; bool res = Mastercam.Support.SearchManager.GetToolsInExternalFile(file, ref toolData); if (res) { foreach (var ft in toolData) { System.Windows.Forms.MessageBox.Show(@"Importing tool " + ft.Number.ToString() + " named " + ft.Name + " type " + ft.ToolTypeID); } } The tools in the drill block defined in the Machine Def are imported along with the tool library tools. First tool imported is of BlockDrill type, then the next (9 in my case) tools are of Drill type and are from the drilling block. How can I know that these (9) are part of the block drilling unit? In this specific case I want to read only tools in the tool library and ignore those in the drilling block.
  4. Quite similar to Mick's, this is the function I wrote and use in my current project. Also, I have multi-threading disabled in Mastercam for toolpath generation. This is to ensure all regeneration is complete before posting. (See here for more info) public static bool regenAndPost(string fileName, bool onlySelected){ string pathNCI = System.IO.Path.ChangeExtension(fileName,".nci"); Mastercam.Database.Operation[] allOps = Mastercam.Support.SearchManager.GetOperations(onlySelected); foreach (var op in allOps) { op.NCIName = pathNCI; op.Commit(false); if (op.Dirty) { op.Regenerate(); } } foreach (var op in allOps) { op.Retrieve(); if (op.Dirty) { System.Windows.Forms.MessageBox.Show("Error - dirty operation. Try again."); return false; } } Mastercam.Operations.OperationsManager.PostAllOperations(System.IO.Path.GetDirectoryName(pathNCI), true); Mastercam.Operations.OperationsManager.RefreshOperationsManager(); return true; }
  5. bug1$ was the answer. Had our post developer switch it to 0 in the PSB and everything is good.
  6. bug1$ is not defined in the PST. However, I did try it with a different post and the editor was not launched. Is there anything else in the post language that could cause the editor to launch? Edit: Looks like bug1$ might be in the PSB... I'll verify and report back.
  7. Related, The NC file is opening for editing even when I specify not to. Any ideas what might cause this? public static bool regenAndPost(string fileName, bool onlySelected){ //Regenerate toolpaths //... //Post Mastercam.Operations.OperationsManager.PostAllOperations(System.IO.Path.GetDirectoryName(fileName),false); return true; }
  8. I am trying to regenerate and post a number of operations from a C# NET-Hook. I iterate through each operation, regenerate if necessary, then start the post processor. If multi-threading is enabled sometimes the regeneration is not completed before the post processor is initiated. When that happens it doesn't post properly. Turn multi-threading off and everything works perfect but slower. How can I make the post processor wait until operations are finished regenerating? string pathNC = Mastercam.IO.SettingsManager.UserDirectory+@"Router\NC\new"; Mastercam.Database.Operation[] selectedOps = Mastercam.Support.SearchManager.GetOperations(false); foreach (var op in selectedOps) { op.NCIName = Mastercam.IO.SettingsManager.UserDirectory + @"Router\NCI\cake.nci"; op.Commit(false); if (op.Dirty) { op.Regenerate(); } } // System.Threading.Thread.Sleep(10000); //Wait... but apparently that locks up the regeneration too. foreach (var op in selectedOps) { op.Retrieve(); if (op.Dirty) { System.Windows.Forms.MessageBox.Show("Error - dirty operation"); return; } } Mastercam.Operations.OperationsManager.PostOperations(selectedOps, pathNC, true, false); Mastercam X9 Router, C# NET-Hook
  9. I ran into a few problems related to level visibility. All have been worked around, but I'd like to bring them up for the sake of understanding. Mastercam X9, Router, C# NET-Hook 1. If a level visibility is toggled to hidden using LevelsManager.SetLevelVisible(Level, false); then the level entities will not show when it is first toggled back to visible through the level manager unless I use Screen>Regenerate Display List. Toggling twice (on-off-on) in the level manager will also cause it to show. Is there a way to turn a level visibility off in the nethook such that the mastercam user will be able to toggle it back on with one click in the level manager? Calling LevelsManager.SetLevelVisible(Level, false); GraphicsManager.Repaint(true);//repaint with full regenerate still seemed to have the same symptoms. 2. If entities are created on an invisible level like so lineTopC = new LineGeometry(new Point3D(bx2, by2, bz), new Point3D(bx2, by1, bz)); lineTopC.Color = baseColor; lineTopC.Level = doorLevel; lineTopC.Commit(); Then chaining using that geometry reference will fail Geometry[] geo = {lineTopC}; var op = (Mastercam.Operations.ContourOperation)Services.UtilityService.CreateContourOp(); Chain[] geoChain = ChainManager.ChainGeometry(geo); //^^^ this fails when lineTopC.Level is set and Commit()ed to an invisible level. op.SetChainArray(geoChain); op.Name = @"Bottom"; op.Commit(); Is there a way to create geometry on an invisible level then chain it using the references?I worked around by checking and setting visibility to true before creating and chaining geometry, but still run into #1 if I try to restore the prior (hidden) level visibility after function is complete. Edit on #2: May have found a case where it works... I'll look into that more and update

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...