How can I make selected the part or sub from API?

How can I make selected the part or sub from API?

mucip
Collaborator Collaborator
678 Views
4 Replies
Message 1 of 5

How can I make selected the part or sub from API?

mucip
Collaborator
Collaborator

Hi,

I'm using Inventor 2013 and VB 2010 Express... I can find a part or sub from browser and open it seperately by below code:

 

 Dim invDocs As AssemblyDocument
        invDocs = Form1.inv_App.ActiveDocument

        Dim invDocument As Document

        Dim Sayac As Integer

        Dim oRefDocs As DocumentsEnumerator
        oRefDocs = invDocs.AllReferencedDocuments

        Dim invDocument2 As Documents

        invDocument2 = Form1.inv_App.Documents

 

For Each invDocument In oRefDocs
            If Form1.BaseFilename(invDocument.FullDocumentName).ToUpper = TextAranan.Text Then  invDocument2.Open(invDocument.FullDocumentName, True)
            Sayac += 1

Next

 

But I need to make the part selected on the browser? I want to focus (highlight) on the part and reposition the browser tree?

 

Is this possible from API?...

 

Regards,

Mucip:)

 

0 Likes
679 Views
4 Replies
Replies (4)
Message 2 of 5

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

get the active BrowserPane, next BrowserPane.GetBrowserNodeFromObject to get the browser node that corresponds to the input object. Finally, call BrowserNode.DoSelect 

0 Likes
Message 3 of 5

mucip
Collaborator
Collaborator

Hi,

First of all thanks a lot for your kind interest...

 

I couldn't understand very well. Please could you explain little bit more detailed?...


Regards,

Mucip:)

 

 

0 Likes
Message 4 of 5

mucip
Collaborator
Collaborator

Hi,

I found something after than your guidence e-mail.

Below code is working good but only for the first level of the tree. I need to iterate/search all levels of the assembly tree.

 

How can I do that?...

 

 Dim invDocs As AssemblyDocument
        invDocs = Form1.inv_App.ActiveDocument

        Dim bp As BrowserPane
        Dim nodes1 As BrowserNodesEnumerator

        bp = invDocs.BrowserPanes("Model")

        nodes1 = bp.TopNode.BrowserNodes

        Dim node As BrowserNode

        For Each node In nodes1
            If node.BrowserNodeDefinition.Label.Split(":")(0) = TextSearchFileName.Text Then
                node.DoSelect()
                Exit For
            End If
        Next

 

 

Regards,

Mucip:)

 

0 Likes
Message 5 of 5

mucip
Collaborator
Collaborator

Hi,

Any feedback incase of search all levels of the model tree?...

 

Regards,

Mucip:)

0 Likes