Get Parent Assembly Name

Get Parent Assembly Name

amitnkukanur
Collaborator Collaborator
2,689 Views
2 Replies
Message 1 of 3

Get Parent Assembly Name

amitnkukanur
Collaborator
Collaborator

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
0 Likes
Accepted solutions (1)
2,690 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
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.
0 Likes
Message 3 of 3

amitnkukanur
Collaborator
Collaborator
Accepted solution

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
0 Likes