Cancel
Showing results for 
Search instead for 
Did you mean: 

AssemblyHow to select the top-level assembly in the document tree

Pioneer
Pioneer

Hi Developer & Users..

It seems simple, but I feel difficult.
How do I select the top item from the Path finder list among assembly codes?

11.png22.png

Why are you trying to do this?
I want to use the list "reduction" function directly.

 

The code I found is as follows, but...
This is not selected directly from the list.

-------

       Dim application As SolidEdgeFramework.Application = Nothing
            Dim documents As SolidEdgeFramework.Documents = Nothing

            Try
                ' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.                OleMessageFilter.Register()

                ' Attempt to connect to a running instance of Solid Edge.                application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

                ' Get the documents collection.                documents = application.Documents

                ' Get the first document.                Dim document = documents.Item(1)
-----------



Please help me.

 

2 REPLIES 2

Re: AssemblyHow to select the top-level assembly in the document tree

Legend
Legend

Hclee1,

 

document.SelectSet.Add (document.Occurrences)

document.UpdatePathfinder (seCollapse)

 

HTH

Gerald Haberl

 

Re: AssemblyHow to select the top-level assembly in the document tree

Pioneer
Pioneer

Thank you very much. Gerard
I solved the code with the following code with the hint and the code.

 

-------

Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
'OleMessageFilter.Register()

' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
assemblyDocument = TryCast(application.ActiveDocument, SolidEdgeAssembly.AssemblyDocument)

If assemblyDocument IsNot Nothing Then

assemblyDocument.SelectSet.Add(assemblyDocument.Occurrences)
assemblyDocument.UpdatePathfinder(SolidEdgeAssembly.AssemblyPathfinderUpdateConstants.seCollapse)

End If
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
'OleMessageFilter.Unregister()
End Try

--------