I am trying to write a little macro that will toggle off the Higher Level Occurence on a Select Set from within an Assembly file and I having trouble getting it to see the first item in the SelectSet.
I know I am doing something wrong and it is not coming to me. Any help would be appreciated.
Here's my VB code:
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeAssembly.AssemblyDocument
Dim oSelectSet As SolidEdgeFramework.SelectSet
Dim objPart As SolidEdgeAssembly.Occurrence
Dim NumberOfSelectedOccurrences As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
objApp = System.Runtime.InteropServices.
objDoc = objApp.ActiveDocument
oSelectSet = objApp.ActiveDocument.selectset
NumberOfSelectedOccurrences = oSelectSet.Count
For i As Integer = 1 To NumberOfSelectedOccurrences
objPart = oSelectSet(i)
objPart.DisplayInSubAssembly = False
Solved! Go to Solution.
I installed Spy and it was seeing the 3 occurences I had selected.
I wasn't using the SelectSet object correctly.
I changed the line objPart = oSelectSet(i) to
objPart = oSelectSet.Item(i) and it worked that way I wanted it to.
Thanks for your help.
I have a follow-up question.
How can I Release or clear out the Select set once the App ends to show the user the command is done running?
oSelectSet.RemoveAll() to remove all entities from the set.
oSelectSet = Nothing to release.
Anything else in secific that you are looking for.