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:

Mick George

CNC Software
  • Posts

    629
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Mick George

  1. This might help but it is old. '//////////////////////////////////////////////////////////////////////////////// '// '// Author: Mick George [email protected] '// Date: 11/11/2003 06:34 PM '// File Name: NC for each OP.vbs '// '// Description: '// '// Comments: I should be home playing threewave... '// '//////////////////////////////////////////////////////////////////////////////// ' -- Start Script Call Main() ' //////////////////// ' Sub Declaration ' //////////////////// Sub Main() Dim intOpsCount, intThisOp ' -- Pass a null string to tell MC we want this files ops intOpsCount = GetOperationCount(vbNullString) If intOpsCount > 0 Then For intThisOp = 1 To intOpsCount If Not RunPost(intThisOp, GetOperationNameFromID(vbNullString, intThisOp)) Then ShowString "Failed to create NC for operation " & intThisOp End If Next Else ShowString "Nothing to post" End If End Sub Another for groups, again might be helpful '//////////////////////////////////////////////////////////////////////////////// '// '// Author: Mick George [email protected] '// Date: 16/03/2004 01:35 PM '// File Name: OperationGroups.vbs '// '// Description: Demo script that highlights various group functions '// '// Comments: SP2 req + March Main 2004 mcamvb CHook '// '//////////////////////////////////////////////////////////////////////////////// '///////////////// My Constants ///////////////// Const GROUP_ALL = -1 Const GROUP_GEOMETRY = 0 Const GROUP_OPERATIONS = 1 Const SYSTEM_GROUP = 2 Const SYSTEM_RESULT = 3 Const GROUP_TOOLPATH = 4 ' -- Start Script Call Main() ' //////////////////// ' Sub Declaration ' //////////////////// Sub Main() Dim idx, intGroup ' -- Get all groups intGroup = GetGroupCount ' -- Do we have at least one? If intGroup = 0 Then ShowString "No operation groups" Exit Sub Else ShowString intGroup & " operation groups found" End If If askYesNo("List all group types?") = mcMSG_YES Then ' -- Iterate all groups For idx = 1 To intGroup Select Case GetGroupTypeFromNumber(idx) Case GROUP_ALL: ShowString "Group #" & idx & " is of type group all" Case GROUP_GEOMETRY: ShowString "Group #" & idx & " is of type geometry group" Case GROUP_OPERATIONS: ShowString "Group #" & idx & " is of type operation group" Case SYSTEM_GROUP: ShowString "Group #" & idx & " is of type system group" Case SYSTEM_RESULT: ShowString "Group #" & idx & " is of type system result" Case GROUP_TOOLPATH: ShowString "Group #" & idx & " is of type group toolpath" End Select Next End If ' -- Iterate all groups For idx = 1 To intGroup ' -- Echo their name ShowString GetGroupNameFromNumber(idx) ' -- Rename groups If Not SetGroupNameFromNumber(idx, "My New Operation Group #" & idx) Then ShowString "Could not set operation group name for " & GetGroupNameFromNumber(idx) End If Next ' -- Create a temp group If CreateGroupFromName("Test Group") Then ' -- Delete it? If askYesNo("Delete new test group?") = mcMSG_YES Then If DeleteGroupFromName("Test Group") Then ShowString "Group Deleted" End If End If Else ShowString "Could not create Test Group but it was created??" End If intGroup = GetGroupCount If intGroup = 0 Then ShowString "No operation groups" Exit Sub Else If intGroup = 1 Then ' -- We can't remove the only group ShowString "One group remains" Exit Sub End If ShowString intGroup & " operation groups found" End If If askYesNo("Delete last operation group by number?") = mcMSG_YES Then ' -- Delete the last operation group DeleteGroupFromNumber intGroup End If intGroup = GetGroupCount If intGroup = 0 Then ShowString "No operation groups" Exit Sub Else ShowString intGroup & " operation groups found" End If End Sub And one more '//////////////////////////////////////////////////////////////////////////////// '// '// Author: Mick George [email protected] '// Date: 15/03/2004 09:30 AM '// File Name: SetEveryOtherOpForPostingOff.vbs '// '// Description: Iterate all operations in current drawing, set every other '// operation off for posting. '// '// Comments: Requires March Maintenance release '// '//////////////////////////////////////////////////////////////////////////////// ' -- Start Script Call Main() ' //////////////////// ' Sub Declaration ' //////////////////// Sub Main() Dim intOpCount, idx, intCount ' -- How many operations do we have? intOpCount = GetOperationCount(vbNullString) ' -- Test If intOpCount = 0 Then ShowString "No operations in current drawing": Exit Sub ' -- Initialize intCount = 0 ' -- Let's see how many operations are off before we do anything For idx = 1 To intOpCount If GetOperationPostingFromID(vbNullString, idx) Then intCount = intCount + 1 End If Next ' -- Test If intCount = 0 Then ShowString "All operations are set to post off" Else ShowString intCount & " operations are currently set to posted on, we will now set all of them post off" End If ' -- Turn off all ops first regardless if they are on or not For idx = 1 To intOpCount If SetOperationSelectedFromID(vbNullString, idx, False) Then If Not SetOperationPostingFromID(vbNullString, idx, False) Then ShowString "Could not turn off operation # " & idx End If End If Next ' -- Initialize intCount = 0 ' -- All operations should now be off, lets do a quick check For idx = 1 To intOpCount If GetOperationPostingFromID(vbNullString, idx) Then intCount = intCount + 1 End If Next If intCount = 0 Then ShowString "All operations are set to post off after call to SetOperationPostingFromID(FALSE)" Else ShowString intCount & " operations are posted on!!??" End If intCount = 0 ' -- Select every other operation For idx = 1 To intOpCount Step 2 If SetOperationSelectedFromID(vbNullString, idx, True) Then If SetOperationPostingFromID(vbNullString, idx, True) Then ' -- Success intCount = intCount + 1 Else ShowString "Could not set operation # " & idx & " off" End If End If Next If intCount > 0 Then ShowString intCount & " operations are set to post off from " & intOpCount & " total operations" End If ' -- Post only what is not ghosted 'Call RunPostAll(GetPathOfThisScript, True) End Sub
  2. Check your \Users\Public\Documents\shared mastercam_version\VB folder as I know we shipped several script examples and I know there was a couple post examples.
  3. The C# WinForms project template has been updated to v2.4 to address an issue with a broken namespace.
  4. Here is a snippet of code that will create a new holder, assign a stp file to the geometry and add it to the the tool db /// <summary> Adds new holder to database. </summary> /// /// <returns> A TlHolder. </returns> private TlHolder AddNewHolderToDatabase() { // build path to tools var folder = Path.Combine(SettingsManager.SharedDirectory, "mill\\Tools"); // tool db const string library = "micks.tooldb"; // build path to db var toolDb = Path.Combine(folder, library); // part file for holder geometry const string file = "83-PORTA.stp"; // build path to stp file var geometryFile = Path.Combine(folder, file); if (!File.Exists(geometryFile)) { DialogManager.Exception(new MastercamException($"File not found {geometryFile}")); return null; } // If the library does not exist, it will be created. var tls = new ToolLibrarySystem(); try { // verify it opened successfullly var success = tls.OpenLibrary(toolDb, true); if (!success) { DialogManager.Exception(new MastercamException($"Failed to open {toolDb}")); return null; } var holder = new TlHolder { Name = "micks holder with geometry", Description = "created via toolnetapi", // assign the path GeometryFile = geometryFile }; // import the actual file success = TlGeometryImportExport.ImportProfileFromFile(holder, geometryFile); if (!success) { DialogManager.Exception(new MastercamException($"Failed to Import Profile From File {geometryFile}")); return null; } // add to tool library success = tls.Add(holder); if (success) { return holder; } DialogManager.Exception(new MastercamException($"Failed to add holder {holder.Name}")); return null; } catch (Exception e) { DialogManager.Exception(new MastercamException(e.Message, e.InnerException)); } finally { // clean up if (tls.IsOpen()) { tls.CloseLibrary(); } } return null; }
  5. Please email our sdk support mailbox with the above information including your version of Mastercam so we can get it into our system and rule out a potential issue with the API
  6. ATP assumes all geometry on a given level to be at the same Z so it selects all the geometry and uses the first item in the list to set the depth. There is a feature request to change this behavior and allow multiple depths of the "same" geometry on a level but unfortunately, for now, you will need to put specific geometry/depth combinations on unique levels.
  7. When using ATP and the use geometry depths feature the file needs to be a 3D file, that means that each geometry at depth needs to have the same geometry at Z0. The part file has some geometry at -Z only. Try copying and translating the geometry and it should work as expected.
  8. This error message can indicated that you are telling ATP to select geometry that is at -Z but there are no geometries at -Z. Can you attach a Zip2Go file to this thread with the relevant files and I'll take a look.
  9. Thanks for sharing. I would like to note that icon sizes should be 16 and 32, 24 was deprecated a couple of versions back. Thanks again
  10. Just to follow up this has been logged as a defect. Thank you for the help in identifying the issue.
  11. If you suspect that you have encountered a defect with the .NET API please submit an email to [email protected] with all the relevant information.
  12. That’s correct. Points and Lines is no longer available as an option. It didn’t make much sense even in its original implementation. Instead, the user can simply select lines. Or, better still, if the user is working with a solid, they can select the solid features.
  13. FYI, all tag definitions are located in Mastercam's Help and are updated for each release as new tags are added.
  14. Those are the names of the textboxes on the report, make sure you are using the same name and not the default, something like textbox1, etc.
  15. Today we published 3 additional .NET project examples on our website under the 3rd Party Developers NET-Hook downloads Reading and passing arguments with a post processor Creating mill tools using the ToolNetApi Batch converting mastercam files
  16. Today we have published WPF NET-Hook project templates C# NET-Hook WPF Visual Studio 2017 and 2019 project templates VB.NET WPF NET-Hook Visual Studio 2017 and 2019 project templates
  17. We have published new CNC Software official Visual Studio project templates for Mastercam. You can download and install via the links below or from withing Visual Studio search online extensions for "Mastercam". VB.NET NET-Hook Visual Studio 2017 and 2019 project templates C# NET-Hook Visual Studio 2017 and 2019 project templates C++ C-Hook Visual Studio 2017 and 2019 project templates Each .NET project template contains a Wizard interface to allow you to target any installed version of Mastercam and optionally add additional Mastercam API's (ToolNetApi, SimAccessManaged, etc) The C-Hook project templates allow you to select from 3 different C-Hook project types and target any installed C-Hook SDK kit. If you have any questions or suggestions please let us know.
  18. Here is a link to a short but very good talk and demo of globalization of a .NET application Internationalisation and Localisation in .NET
  19. You can use the start up setting in configuration to set a NET-Hook or C-Hook to load at start up. You could then implement the Notify event and monitor the file open event, that might work.
  20. Perhaps, now that these will be signed by CNC Software and are official, that might allow your company to install the templates.
  21. Please submit requests or enhancements to our existing examples to our sdk@mastercam mailbox. We are always looking to add new examples.
  22. The new .NET templates should just build without errors as long as you are running as Admin, otherwise remove the post build step and it'll build with no additional changes.
  23. I should have made that clearer. I'm referring to the .NET project templates not the C-Hook project templates.

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