- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am encountering a strange situation where retrieving a face through the command manager's picker and directly through the Inventor API (by iterating the object's faces) returns different normals for the same face.
I know the two faces are identical as their InternalName property is identical between the two along with every other property. However, when parsing their data to find their normal, depending on how the face was retrieved (through the Pick command or through pure API calls), the normal produced seems to vary.
I have narrowed this down to the fact that the face being selected is within a part from a sub-assembly, whose XYZ orientation is different to that of its parent's (the sub-assembly's). The sub-assembly's XYZ orientation does match that of the main assembly.
It seems the picker transforms the picked face's normal to that of the main assembly's XYZ axis, but accessing the face directly uses its part's XYZ axis.
How is it that if the face being picked is identical to that of the face accessed by the API produces two different normals when they are both passed through the same "GetFaceNormal" function? Please see below for my implementation of this function.
/// <summary>
/// Returns a Unit Vector representing the normal of the given face.
/// </summary>
/// <param name="face">The face to retrieve the normal from.</param>
/// <returns>The Unit Vector representing the face's normal.</returns>
public static UnitVector GetFaceNormal(Face face)
{
UnitVector normal = null;
if (face != null)
{
Face f = (Face)face;
double[] normalPoints = [0, 0, 0];
double[] point = [f.PointOnFace.X, f.PointOnFace.Y, f.PointOnFace.Z];
f.Evaluator.GetNormalAtPoint(ref point, ref normalPoints);
normal = Globals.InventorApp.TransientGeometry.CreateUnitVector(normalPoints[0], normalPoints[1], normalPoints[2]);
}
return normal;
}
Is there something I am not understanding correctly or perhaps am overlooking?
Solved! Go to Solution.
Download the prerelease of Hole Projector for Inventor 2027