Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Well this has been a very interesting and fun topic.

 

@Curtis_Waguespack Thanks for the sample part.  I never considered that a part could have a single Edge connecting what would normally have been 2 different bodies, and could have 4 different Faces associated with it.  Due to how odd that one central edge is, it is neither concave, nor convex.  You were right about my process (using convex vs concave to determine if I should simply subtract the measured angle from 360 degrees) not being error proof yet.

 

@MjDeck Thanks.  I don't know why I didn't just go the CrossProduct route right away, since I am already pretty familiar with that process, due to the ' view / camera' related topics I was recently involved with.  That was definitely the shortest code path, and seems to require the least processing, to get to the result we were looking for.  Each 'cross product' leaves us with a 'direction' that is perpendicular to both of the 'input' directions, which is super handy sometimes.  Figuring out the correct order to process them in, to control the resulting direction's polarity is the tricky part to picture in my mind.

 

Since this appears to be a 'busier' overall process than many of us had in mind, I decided that a 'helper' Class may be in order, to 'bundle' all that helper code into one overall block of code that can be referenced and called in to help,  which should keep the 'Main' code routine simpler & easier to look at.  I created two different versions of the helper Class.  One version uses the simpler CrossProduct first step shown in Mike's example to get the 'edge direction', and has fewer public properties in the Class.  The second version uses more 'traditional' routes to get the 'edge direction', and offers a few more public properties in the Class.  Both versions use the same final two CrossProduct steps, to get the 2 virtual directions pointing away from the virtual edge, for measuring the angle between.  This longer example also includes a couple new relatively simple, custom Functions (not part of the helper Class) that can be used to determine if an edge is concave or convex.

I will show those 2 here directly, for quicker reference:

 

Private Function EdgeIsConcave(oEdgeToCheck As Inventor.Edge) As Boolean
	For Each oEdge As Inventor.Edge In oEdgeToCheck.Parent.ConcaveEdges
		If oEdge Is oEdgeToCheck Then Return True
	Next
	Return False
End Function

 

and

 

Private Function EdgeIsConvex(oEdgeToCheck As Inventor.Edge) As Boolean
	For Each oEdge As Inventor.Edge In oEdgeToCheck.Parent.ConvexEdges
		If oEdge Is oEdgeToCheck Then Return True
	Next
	Return False
End Function

 

Those 2 complete examples using the 2 different versions of the helper Class are attached as text files, since they are rather long.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)