Get the Origin Axis an edge is parallel to

Get the Origin Axis an edge is parallel to

dialunau
Advocate Advocate
510 Views
3 Replies
Message 1 of 4

Get the Origin Axis an edge is parallel to

dialunau
Advocate
Advocate

I need to know the axis that a selected edge is parallel to. How can I do this?

 

Thank you in adnvance.

0 Likes
Accepted solutions (2)
511 Views
3 Replies
Replies (3)
Message 2 of 4

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @dialunau 

 

Something like this example should work.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Dim oEdge As Edge = ThisApplication.CommandManager.Pick _
	(SelectionFilterEnum.kPartEdgeLinearFilter, "Select an edge")
If oEdge Is Nothing Then Exit Sub

Dim oLine As LineSegment = oEdge.Geometry
Dim oAxis As WorkAxis
For i = 1 To 3
	oAxis = ThisDoc.Document.ComponentDefinition.WorkAxes.Item(i)
	If oLine.Direction.IsParallelTo(oAxis.Line.Direction) Then MsgBox(oAxis.Name, , "iLogic")
Next

 

EESignature

0 Likes
Message 3 of 4

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Or this if you want to look at any axis ( not just the orgin axes)

 

Dim oEdge As Edge = ThisApplication.CommandManager.Pick _
	(SelectionFilterEnum.kPartEdgeLinearFilter, "Select an edge")
If oEdge Is Nothing Then Exit Sub

Dim oLine As LineSegment = oEdge.Geometry
Dim oAxis As WorkAxis
For i = 1 To ThisDoc.Document.ComponentDefinition.WorkAxes.count
	oAxis = ThisDoc.Document.ComponentDefinition.WorkAxes.Item(i)
	If oLine.Direction.IsParallelTo(oAxis.Line.Direction) Then msg = msg & vblf & oAxis.name 
Next

MsgBox(msg, , "iLogic")

 

EESignature

0 Likes
Message 4 of 4

CGBenner
Community Manager
Community Manager

@dialunau  Did the information provided by @Curtis_Waguespack answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!



Chris Benner

Community Manager - NAMER / D&M


0 Likes