Get bolt assembly path from selected edge

Get bolt assembly path from selected edge

MTheDesigner
Advocate Advocate
251 Views
1 Reply
Message 1 of 2

Get bolt assembly path from selected edge

MTheDesigner
Advocate
Advocate

I am trying to make a tool that will help me place bolt assemblies quickly in batches instead of one at a time. My bolt assemblies contain 2 washers, a bolt, and a nut. 

 

I want to be able to select an edge on the bolt assembly to constrain, as well as a group of edges on other objects I would like to constrain that assembly to. Once I find the assembly I want to place a new one for each edge in the group and then constrain them all together.

 

Right now I am using the Edge.Parent to find the surface body and SurfaceBody.Parent to find the washer part, but I need to find the assembly that the washer is a part of. I can make this a 2 selection solution by telling the user to select the assembly then the edge, but i always want to make things as simple as possible.

0 Likes
Accepted solutions (1)
252 Views
1 Reply
Reply (1)
Message 2 of 2

MTheDesigner
Advocate
Advocate
Accepted solution

Alright so I figured out how to get the name of the assembly and the path to the name. 

My problem was that ComponentOccurrence(part).Parent shows that it returns an object on the API help. But it doesn't tell you what kind of object it returns. After some trial and error it turns out that sub assemblies are also considered ComponentOccurrence.

Good luck to any future iLogic learners, stick with it. 

Dim oBoltSelection As Edge = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeCircularFilter, "Please select your bolt edge")
Dim oBoltBody As SurfaceBody = oBoltSelection.Parent
Dim oBoltPart As ComponentOccurrence = oBoltBody.Parent
Dim oBoltAssembly As ComponentOccurrence = oBoltPart.ParentOccurrence
Dim oBoltDoc As Document = oBoltAssembly.Definition.Document

'My Prize
MessageBox.Show(oBoltDoc.FullFileName)

 

0 Likes