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: 

Get Parent Assembly Name

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
amitnkukanur
2419 Views, 2 Replies

Get Parent Assembly Name

Hello,

 

I am doing a Customization in Inventor 2012 using VB.net as development language.

 

My project is heavily dependent on Inventor Assembly Tree. Off late i am facing problems in Finding the Global Parent of Assembly.

 

For Example

 

A

  B

  C

  D

  E

    A1

    A2

    A3

    A4

 

Lets assume this is the tree structure, lets say i want the parent name of node "A4", is there any option in Inventor 2012 API to find the parent node of Assembly

 

The below is the part of my code

 

Public Sub AssmTravel(ByVal InCollection As ComponentOccurrences, ByVal objparentNode As System.Windows.Forms.TreeNode)

Dim ADoc As Document
Dim objoccsEnumerator As IEnumerator = InCollection.GetEnumerator()
Dim objcomOccurrence As Inventor.ComponentOccurrence

While (objoccsEnumerator.MoveNext() = True)

objcomOccurrence = objoccsEnumerator.Current


If objcomOccurrence.DefinitionDocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then

 

 

Try
ADoc = oApp.Documents.Open(objcomOccurrence.DefinitionReference.ReferencedFileDescriptor.FullFileName, False)

Catch ex As Exception
GoTo VirtualWeldPart
End Try

End IF
End Sub

Senior Software Engineer
2 REPLIES 2
Message 2 of 3
santoshr0114
in reply to: amitnkukanur

Dear AmitK_189 You will not need Inventor API to find the parent or child nodes of a treeview. You can use e.Node.Parent.ToString() to get the parent node of the selected node.
Regards
Santosh
Message 3 of 3
amitnkukanur
in reply to: amitnkukanur

Hi Santosh,

 

I found the answer by doing some R'n'D.

 

ADoc.ReferencingDocuments(1).FullDocumentName.

 

This above line will provide the parent assembly name.

 

e.node.parent.tostring(); will work in onclick event, but in current scenario things happen before onclick.

 

 

 

 

rgds

Amit

Senior Software Engineer

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

Post to forums  

Autodesk Design & Make Report