Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: Maxim-CADman77

Hi @Maxim-CADman77.  I can't explain the behavior of the manual measure tool, but when doing it by code, I can understand it better.  It goes by the 'Normal' (direction) of the face, and by the order they are selected.  Picture an arrow pointing perpendicularly outward from the center of each face, then when you select a face to measure its angle, it is really selecting that arrow, then when you select the second face, it measures between the angle from the direction of the first face's arrow, to the direction of the second face's arrow.  So the following properties were likely used behind the scenes to figure it out.

Face.Evaluator (as SurfaceEvaluator)

SurfaceEvaluator.GetNormal 

UnitVector 

UnitVector.AngleTo()

 

Edit:  Here is alternate code example, just for additional reference.

Dim body As SurfaceBody = ThisDoc.Document.ComponentDefinition.SurfaceBodies(1)
Dim edge As Edge = body.Edges(1)
Dim face1 As Face = edge.Faces(1)
Dim face2 As Face = edge.Faces(2)
Dim oF1points() As Double = {}
Dim oF1normals() As Double = {}
face1.PointOnFace.GetPointData(oF1points)
face1.Evaluator.GetNormalAtPoint(oF1points, oF1normals)
Dim oF2points() As Double = {}
Dim oF2normals() As Double = {}
face2.PointOnFace.GetPointData(oF2points)
face2.Evaluator.GetNormalAtPoint(oF2points, oF2normals)
Dim oF1Normal, oF2Normal As UnitVector
oF1Normal = ThisApplication.TransientGeometry.CreateUnitVector(oF1normals(0), oF1normals(1), oF1normals(2))
oF2Normal = ThisApplication.TransientGeometry.CreateUnitVector(oF2normals(0), oF2normals(1), oF2normals(2))
Dim dAngle As Double = (oF1Normal.AngleTo(oF2Normal) * (180 / Math.PI))
MsgBox(dAngle.ToString & " deg", vbInformation, "Angle")

Wesley Crihfield

EESignature

(Not an Autodesk Employee)