How to select the open file in Model Browser?

How to select the open file in Model Browser?

Anonymous
Not applicable
615 Views
2 Replies
Message 1 of 3

How to select the open file in Model Browser?

Anonymous
Not applicable

With this piece of code I am able to select an occurance in the Model Browser.

But not the main assy, like in this picture... how can I do?

 

01.png

 

Public Sub teer()
Dim oapp As Inventor.Application
Set oapp = GetObject(, "Inventor.Application")
Dim odoc As AssemblyDocument
Set odoc = oapp.ActiveEditObject

Dim oPane As BrowserPane
Set oPane = odoc.BrowserPanes.Item("Model")
oPane.TopNode.BrowserNodes.Item(7).DoSelect
End Sub

0 Likes
616 Views
2 Replies
Replies (2)
Message 2 of 3

YuhanZhang
Autodesk
Autodesk

You can use below code:

oPane.TopNode.DoSelect

 or :

 

Sub SelectActiveDocTopNode()
     Dim odoc As Document
     Set odoc = ThisApplication.ActiveDocument
     
     If odoc.DocumentType = kAssemblyDocumentObject Or odoc.DocumentType = kPartDocumentObject Then
         odoc.SelectSet.Select odoc.ComponentDefinition
     End If
End Sub

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks Rocky, both work just fine! Smiley Wink

0 Likes