Extract Occurrence Orientation Angle to Assembly Origin Plane

Extract Occurrence Orientation Angle to Assembly Origin Plane

petestrycharske
Advisor Advisor
739 Views
2 Replies
Message 1 of 3

Extract Occurrence Orientation Angle to Assembly Origin Plane

petestrycharske
Advisor
Advisor

All,

 

Good afternoon!  I'm working with Inventor, specifically factory assets within Inventor and want to extract the angle between one of my model's YZ - Plane and the Assembly's YZ - Plane.  I can see it in the component iProperties >> Occurrence tab, but am not finding a way to extract that value via iLogic.  I found this post, but it seems really complicated, and I just want to capture that angle value.  If there's no other way, so be it, but am hoping for something not as involved.  I'm not a programmer, so feel free to chuckle if I'm being naive, but thought I would just see what could be done.  If you have any questions, please do not hesitate to contact me.  Hope all is well and have a most blessed day!

 

Peace,

Pete

Just a guy on a couch...

Please give a kudos if helpful and mark as a solution if somehow I got it right.
0 Likes
Accepted solutions (1)
740 Views
2 Replies
Replies (2)
Message 2 of 3

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@petestrycharske,

 

Try below iLogic code to get angle between YZ plane of model and YZ plane of assembly.

 

Dim oDoc = ThisAssembly.Document 

Dim oDef = oDoc.ComponentDefinition 

Dim oAssyPlane = oDef.WorkPlanes.Item("YZ Plane")

'Assuming that first occurrence is used for angle measurement
Dim occ = oDef.Occurrences.Item(1) 

Dim occDef = occ.Definition 

Dim occPlane = occDef.WorkPLanes.Item("YZ Plane")

Dim oPlaneProxy As WorkPlaneProxy 
occ.CreateGeometryProxy(occPlane, oPlaneProxy)

Dim oTool As MeasureTools
oTool = ThisApplication.MeasureTools 

Dim angle As Double
'Angle in radians
angle = oTool.GetAngle(oAssyPlane, oPlaneProxy)

'Angle in deg 
angle = (angle * 180) / 3.14

MessageBox.Show("Angle : " & Format(angle, 0#) & " in deg")

 

Note: Code is developed in Inventor 2019.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 3

petestrycharske
Advisor
Advisor

Thanks @chandra.shekar.g!  That worked exactly as I needed it to!  Have an awesome and most blessed day!

Just a guy on a couch...

Please give a kudos if helpful and mark as a solution if somehow I got it right.
0 Likes