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. An easy way to backup your Machine/Control/Post files. With a file opened with (at least one) operation using the Machine and its related files. File -> Zip2Go (on the backstage menu). Make sure the proper "Machine Group types" is checked. (Optional) You can also uncheck the "Config file" under File Options. Now "Create file" to generate the ZIP package. You will get more files in the output than you really need, but who cares? You have these important ones you need backed up.
  2. To access data in a Wire operation would require a (C++) C-Hook style Add-in.
  3. When you create a zipped package using Zip2Go you can specify (in the Save as type drop-down) if you want ZIP or Z2G for the output file. Either way what you end up with is a Zip archive. If you have Windows 10 you can just select a the .ZIP file. Windows will open this compressed file and show you the contents. Or from within Zip2Go itself, do File-Open, open the ZIP or Z2G file, then (on the Zip2Go top menu) do Command- Extract.
  4. I've sent Colin a copy of this newly created utility. We'll let him try it out to see if it's good, and if others want it, I can make it available after next week. *This is not an official CNC Software item, and thus receives no official support from CNC. What this utility does appears to be something similar to what user Elvincnc showed. [This utility works on code "lines", not a mass of run-on code as Elvincnc showed.] You can specify the Program Number character* to find/split on. You can specify the file extension for the output files. *If you use something like ":" it will work. But, that is not a valid character for a file name. It will fallback to using "O" instead of an invalid character in the output file names. This is a stand-alone program that does not require Mastercam. It remembers and recalls the last setting used each time it is run.
  5. Colin, I put together a utility that works as described. Then you threw me a curve with your file, as it has code lines before the initial 'O' program number. I need to rework the breakup logic. I'll hopefully have something for you tomorrow. % &F=//CNC_MEM/ &F=/MTB1/ &F=/MTB2/ &F=/SYSTEM/ &F=/USER/ &F=/USER/LIBRARY/ O9630(S.DATUM--FWB-4S4)
  6. You are just reading through a large file and finding a ‘O’ program numbers. Then wanting to save just the NC code between each ‘O’ and ‘M30’ (or ‘M99’) that denotes the end of the NC program, and write just those sections of NC code out to separate files using the 'O' program numbers for the output filenames? I may be missing something here? As that sounds like a simple utility to create. Can I see a example of the file you wish to breakup? sdk[at]Mastercam[dot]com
  7. Another way to manipulate the operations "defaults". Open your MyOpDefaults.mcam-operations file by drag ‘n dropping it onto Mastercam’s drawing area. Make your changes and save the file. *When you save it’s going to save it out as a .mcam file. That’s OK, just change the file extension to “.mcam-operations” once you’ve saved your changes.
  8. Pleas email us -> SDK[at]mastercam[dot]com with your company contact information.
  9. Björn, What version of Mastercam? Are you wanting to do this with a C-Hook or NET-Hook type add-in? *You cannot do it directly using the the NET-Hook API, but with a C++/CLI interop DLL, a NET-Hook "client" add-in can obtain this information.
  10. Email me SDK[at]mastercam[dot]com with your company contact details.
  11. What version of Mastercam is this for? This has certainly been done more than once in the past. It can be done with a C-Hook or NET-Hook type add-in. It's fairly simple to code. The only 'trick' is determining the output file names. Where (the path) should the files with the individual levels be saved to? Do you want to add-in to ask for the output folder each time, or use some "known" output folder? What to calculate for the "name" of each of these files? Using the Level "name" it OK, except that level names are not required to be unique. So, if a name appears in the Levels list more than once you need some logic to "adjust" the 2nd file name. One way to handle that would be to include the Level "number" in those output file names. i.e. "L101-My Wireframe", "L202-The Surfaces", etc. That would easily force them to be unique output file names. You also want to deal with the possibility that a Level "name" contains characters that are not valid for a file name. Not difficult, but just one of those things you don't think about until the add-in crashes because your are attempting to create a file with a name not allowed by Windows.
  12. While turning off the Event Log may help the "hang" time. You may be just masking a real issue. Why is the Log getting filled with this message? Is the issue part file specific? I would suggest getting a file the can demonstrate this issue to Mastercam QC so it can be investigated.
  13. What version of Mastercam? I do not know of a way via the Mastercam Tool Manager to do that. You're not dealing with a tooling expert here. But with a NET-Hook (C#) add-in it is fairly easy. I was able to reset all of the Tool Numbers to '0' in the mill_inch.tooldb in approx. 5 seconds. Are you just updating the (mill) Cutting Tools in the library, or also Tool Assemblies?
  14. Check this. In the Ribbon (on the Home tab) click on the little arrow in the lower-right of the Attributes group. Is the Entity Attributes Manager active?
  15. FYI - A survey was posted yesterday here -> How do you use Mastercam Levels Manager? https://forum.mastercam.com/Topic42394.aspx
  16. *This is a user-to-user forum. If someone wishes to they can respond. What you describe should be possible. If you want CNC corporate support you'll need to post over in the Mastercam forum. Mastercam Forum in the "3rd Party Application Development" section.
  17. NET-Hook API Reference Guide (Std. customer log-in required.) SearchManager is in the Mastercam.Support namespace. And it has methods to find/retrieve geometry entities. SearchManager.GetGeometry There are 6 versions of the GetGeometry method. using Mastercam.BasicGeometry; using Mastercam.Database; using Mastercam.Database.Types; using Mastercam.Support; public void DemoGetAllPoints() { GeometryMask PointMask = new GeometryMask(false); PointMask.Points = true; // Just getting Point Entities Geometry[] FoundPoints = SearchManager.GetGeometry(PointMask); // GetGeometry can retrieve multiple types of geometry objects. // Thus the data we get is a list (array) of generic “Geometry” objects. // If we need to access the details of a specific type of geometry, // we need to cast it to that specific type. foreach (var point in FoundPoints) { // We know it is a point, so the cast to PointGeometry will work. var pt = (PointGeometry)point; // Do something with this PointGeometry object. var x = pt.Data.x; var y = pt.Data.y; var z = pt.Data.z; } }
  18. With SearchManger you can retrieve point "entities". What you show in the video is not finding/selecting point entities. Using Dynamic you are snapping to a location (is this case the end of an edge) and then telling Mastercam to make (move) the location to the origin. You cannot do this with a NET-Hook type add-in unless you have a From point position and here there is no point entities to find. With a C-Hook add-in you could create the edges of the Solid and then go through the endpoints of each edge. You would need to have some criteria to know which edge endpoint you want to use. (i.e. Always using the upper-left in XY endpoint location?) What happens if the Solid is not a rectangular shaped, but some arbitrary shaped solid? (i.e. You have a free-form chained output that was using to created an extruded solid.)
  19. If the geometry in question is a "non-primitive" Solid (i.e. created doing an extrude of some chain), what would be the points on this? It does not have any defined "base" point. It is a Solid Body with Faces and Edges.
  20. If it is a Simple (primitive) type Solid: Cylinder, Block, Sphere, Cone, or Torus, it will have a BasePoint. If it was not created using one of the above methods, it does not have a real BasePoint and you'll always get 0,0,0 if you ask for the BasePoint. Create some Solids that are of the "simple" type and some that are not. (e.g. Extruded from a Chain) This code will report some info about the geometries you select. namespace GetGeometryAddIn { using Mastercam.App.Types; using Mastercam.Database; using Mastercam.IO; using Mastercam.Database.Types; using Mastercam.Solids; using System.Windows.Forms; public class GetGeometry : Mastercam.App.NetHook3App { /// <summary> Displays some type data about the Geometry object. </summary> /// /// <remarks> If we want "type specific details" about it, we need to cast it to its specific type. If you just need /// the Level #, Color#, etc., those are available and the "base" Geometry level. </remarks> /// /// <param name="geometry"> The geometry object to be processed. </param> /// <param name="moveToOrigin"> (Optional) True to move to the origin, only if a "simple" Solid. </param> private void ShowEntityData(Geometry geometry, bool moveToOrigin = false) { if (geometry != null) { var msg = string.Empty; // Cast it to its specific type... if (geometry is Mastercam.BasicGeometry.PointGeometry) { msg = "It is a Point!"; } else if (geometry is Mastercam.Curves.LineGeometry) { msg = "It is a Line!"; } else if (geometry is Mastercam.Curves.ArcGeometry) { msg = "It is an Arc!"; } else if (geometry is SurfaceGeometry) { // Cast it to a SurfaceGeometry type object var surf = (SurfaceGeometry)geometry; var isReversed = surf.IsNormalReversed; // type specific property msg = surf is Mastercam.Surfaces.TrimmedSurface ? "It is a Trimmed Surface!" : "It is a Surface!"; } else if (geometry is SolidGeometry solid) // Cast it to a SolidGeometry type object { if (solid is BlockSolid) { msg = $"It is a primitive 'Block' solid! - Base: {solid.BasePoint}"; } else if (solid is SphereSolid) { msg = $"It is a primitive 'Sphere' solid! - Base: {solid.BasePoint}"; } else if (solid is ConeSolid) { msg = $"It is a primitive 'Cone' solid! - Base: {solid.BasePoint}"; } else if (solid is TorusSolid) { msg = $"It is a primitive 'Torus' solid! - Base: {solid.BasePoint}"; } else if (solid is CylinderSolid) { msg = $"It is a primitive 'Cylinder' solid! - Base: {solid.BasePoint}"; } else { msg = $"It is a Solid! - Base: {solid.BasePoint}"; } if (moveToOrigin) { solid.BasePoint = new Mastercam.Math.Point3D(); solid.Commit(); } } // For non-specific type properties, we don't need to cast the Geometry object. var level = geometry.Level; var color = geometry.Color; msg += "\n" + string.Format($"It is on Level#:{level} and is Color#:{color}"); MessageBox.Show(msg, "Entity Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } public override MCamReturn Run(int param) { GeometryMask geomMask = new GeometryMask(true); geomMask.xlines = false; geomMask.PMeshes = false; geomMask.PSplines = false; var geom = SelectionManager.AskForGeometry("Select a Geometry item", geomMask); ShowEntityData(geom); return MCamReturn.NoErrors; } } }
  21. What point would this be? Is this a "primitive" Solid? (e.g. Bock, Cylinder, etc.)
  22. To register/unregister a service you use the Windows "regsvr32' command from within a Command window. Press the Windows key and input -> CMD [enter] Execute the regsvr32 command to register the service in the DLL. regsvr32 C:\Program Files\Mastercam 2021\Mastercam\common\SWORKSDATA\SwDocumentMgr.dll [enter]
  23. To do the Operation name, there is functionality in the NET-Hook API. namespace - Mastercam.Operations class - OperationsManager method -> /// <summary> Sets the program name in the operations. </summary> /// /// <param name="name"> The name to assign to the operations. </param> /// <param name="all"> True to process all operations. False to process just the selected operations. </param> /// /// <returns> The number of operation that were altered. </returns> int SetProgramName (String name, bool all);

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