03-10-2015 01:01 PM
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.
Marshal.GetActiveObject("SolidEdge.Application")
objDoc = objApp.ActiveDocument
oSelectSet = objApp.ActiveDocument.selectset
NumberOfSelectedOccurrences = oSelectSet.Count
MsgBox(NumberOfSelectedOccurrences)
For i As Integer = 1 To NumberOfSelectedOccurrences
objPart = oSelectSet(i)
MsgBox(objPart.Name)
objPart.DisplayInSubAssembly = False
Next
End Sub
Solved! Go to Solution.
03-11-2015 03:36 AM
Can you attach an image showing what is currently picked in the assembly.
Have you also used the Spy for Solid Edge application which will show you what's in the select set.
03-11-2015 07:56 AM
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.
Dale Smith
04-24-2015 11:09 AM
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?
Thanks,
Dale Smith
04-24-2015 02:44 PM
oSelectSet.RemoveAll() to remove all entities from the set.
oSelectSet = Nothing to release.
Anything else in secific that you are looking for.
~Tushar
04-24-2015 02:55 PM