Message 1 of 8
Measure angle between faces if angle is more than 180 deg (PI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to measure angle by iLogic in Inventor, when it's more than 180 deg? There is sample file in attachment to test it.
Please look at screen below. Alpha is angle between red face and blue face. It should be 90 deg (it's ok). Beta is angle between red face and green face. It should be 270 deg (I don't know how to measure it). Of course I'm looking for solution to work with more complex model but this example should be simple to understand.
Sub Main
Dim myPartDoc As PartDocument = ThisDoc.Document
Dim myPartCompDef As PartComponentDefinition = myPartDoc.ComponentDefinition
Dim oTg As TransientGeometry = ThisApplication.TransientGeometry
Dim namedEntities = iLogicVb.Automation.GetNamedEntities(myPartDoc)
Dim redFace As Face = namedEntities.FindEntity("redFace")
Dim greenFace As Face = namedEntities.FindEntity("greenFace")
Dim blueFace As Face = namedEntities.FindEntity("blueFace")
Dim myRedFaceParams(1) As Double
Dim myRedFaceNormal(2) As Double
redFace.Evaluator.GetNormal(myRedFaceParams, myRedFaceNormal)
Dim myRedFaceNormalVector As Vector = oTg.CreateVector(myRedFaceNormal(0), myRedFaceNormal(1), myRedFaceNormal(2))
Dim myGreenFaceParams(1) As Double
Dim myGreenFaceNormal(2) As Double
greenFace.Evaluator.GetNormal(myGreenFaceParams, myGreenFaceNormal)
Dim myGreenFaceNormalVector As Vector = oTg.CreateVector(myGreenFaceNormal(0), myGreenFaceNormal(1), myGreenFaceNormal(2))
Dim myBlueFaceParams(1) As Double
Dim myBlueFaceNormal(2) As Double
blueFace.Evaluator.GetNormal(myBlueFaceParams, myBlueFaceNormal)
Dim myBlueFaceNormalVector As Vector = oTg.CreateVector(myBlueFaceNormal(0), myBlueFaceNormal(1), myBlueFaceNormal(2))
Dim angleFaceGreenToRed As Double = myGreenFaceNormalVector.AngleTo(myRedFaceNormalVector) * 180 / Math.PI
Dim angleFaceBlueToRed As Double = myBlueFaceNormalVector.AngleTo(myRedFaceNormalVector) * 180 / Math.PI
Logger.Info("angleFaceBlueToRed:" & angleFaceBlueToRed)
Logger.Info("angleFaceGreenToRed:" & angleFaceGreenToRed & " How to measure this to get 270 deg?")
End Sub
I have read this articles but can't find solution.
https://adndevblog.typepad.com/manufacturing/2012/08/normal-vectors-and-points-on-brep-surfaces.html
https://modthemachine.typepad.com/files/mathgeometry.pdf