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:

Issue selecting and unselecting ops


Recommended Posts

Hello,

 

I'm wondering if there is an API call that I'm missing when trying to unselect certain ops. I'm adding to a custom VB.Net Nethook.

I'm looping through the list of operations and trying to unselect certain ones with this code:

Dim ops As Array = Mastercam.Support.SearchManager.GetOperations().ToArray

If ops.Length = 0 Then Exit Sub

For i As Integer = 0 To UBound(ops)
    Dim op As Mastercam.Database.Operation = CType(ops(i), Mastercam.Database.Operation)
    If Not op Is Nothing Then
       If op.Type = 4 Then
          op.Selected = True
       Else
          op.Selected = False
       End If
       op.Commit()
    End If
Next i

Problem I'm running into is if I call op.Commit() then it marks the ops I want to unselect dirty. If I leave the op.Commit() code out then the code doesn't do anything.

Am I missing something?

 

 

Link to comment
Share on other sites

Thanks Mick. I had thought about that but I figured that might cause extra processing time especially if there were a lot of 3D toolpaths. Here is what I ended up with:

For i As Integer = 0 To UBound(ops)
   Dim op As Mastercam.Database.Operation = CType(ops(i), Mastercam.Database.Operation)
   If Not op Is Nothing Then
      If op.Type = 4 Then
         If op.Selected = False Then
            op.Selected = True
            op.Commit()
            op.Regenerate()
         End If
      Else
         If op.Selected = True Then
            op.Selected = False
            op.Commit()
            op.Regenerate()
         End If
      End If
   End If
Next i

I tried to only call the operation's change in selection if it was needed to keep the regenerate time to a minimum.

Thanks again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

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