Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

4 REPLIES 4
Reply
Message 1 of 5
mucip
516 Views, 4 Replies

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

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:)

 

4 REPLIES 4
Message 2 of 5
xiaodong_liang
in reply to: mucip

Hi,

 

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

Message 3 of 5
mucip
in reply to: xiaodong_liang

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:)

 

 

Message 4 of 5
mucip
in reply to: xiaodong_liang

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:)

 

Message 5 of 5
mucip
in reply to: mucip

Hi,

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

 

Regards,

Mucip:)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report