Question about SelectSet occurences

Genius
Genius

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

Dale Smith
Mitsubishi Electric Power Products, Inc.
ST10 MP2 - Insight
5 REPLIES

Re: Question about SelectSet occurences

Phenom
Phenom

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.

 

Re: Question about SelectSet occurences

Genius
Genius

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

Dale Smith
Mitsubishi Electric Power Products, Inc.
ST10 MP2 - Insight

Re: Question about SelectSet occurences

Genius
Genius

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

Dale Smith
Mitsubishi Electric Power Products, Inc.
ST10 MP2 - Insight

Re: Question about SelectSet occurences

Phenom
Phenom

oSelectSet.RemoveAll() to remove all entities from the set.

oSelectSet = Nothing to release.

 

Anything else in secific that you are looking for.

 

~Tushar

Re: Question about SelectSet occurences

Genius
Genius
That did it. Thanks!
Dale Smith
Mitsubishi Electric Power Products, Inc.
ST10 MP2 - Insight