Reply

Getting visible status of occurances in Assy

[ Edited ]

Hello everyone,

 

I am new to this forum, I work with Paul Martz. I have a question regarding the following posted code.

I wrote this to see the Visible status of the files in an ASM, but I have come across a problem. If I have an ASM1 at the top level and the same ASM1 at an sub-asm lets say 3 level down, and I hide some parts in ASM1 and hide different ones in level 3 the program see them all as true. IS this a bug or am I missing some piece of code.

 

I have attach an image that show this

 

Thanks Teus

 

Require a command button and a listbox1 on a form

 

--------------------------------------

Private Sub CommandButton1_Click()

 

Dim objApp As Object

 

ListBox1.Clear

 

'Connect to a running instance of Solid Edge.

Set objApp = GetObject(, "SolidEdge.Application")

'Call the function with the current document as input.

Call DisplayOn(objApp.ActiveDocument, 1)

 

End Sub

Public Sub DisplayOn(Document As Object, intlevel As Integer)

'Declare variables.

Dim objOccurrences As Occurrences

Dim objOccurrence As Occurrence

 

 

'Reference the Parts collection object.

Set objOccurrences = Document.Occurrences

'Iterate through each part in the current document.

For Each objOccurrence In objOccurrences

'Check to see if the current attachment is a subassembly.

vis = objOccurrence.Visible

 

If objOccurrence.Subassembly Then

 

'Call this function with the subassembly as input.

ListBox1.AddItem Space(intlevel * 3) & intlevel & " " & objOccurrence.Name & ", Visible= " & vis

Call DisplayOn(objOccurrence.OccurrenceDocument, intlevel + 1)

 

Else

 

ListBox1.AddItem Space(intlevel * 3) & intlevel & " " & objOccurrence.Name & ", Visible= " & vis

 

End If

 

Next

End Sub

---------------------------------

 

 

Posted by: Teus Streef
Post date: 3/24/2006 8:54:07 AM