I would like to get the normal of a face as a line or two point3d coordinates.
The purpose of this is to calculate the angle between two normals. I need help just getting the line or point3d coordinates, the rest I know how to do.
I suppose I would need to use MeshFaceNormalList.Item (but I have no idea how)
You don’t need anything other than the two normals to calculate the angle. If you call the static method
var angle_in_radians = Rhino.Geometry.VectorAngle(normal1, normal2);
… then you have it. See https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Vector3d_VectorAngle.htm
If you need to calculate the angle as projected to a certain plane, then that’s a bit different, but you didn’t say that, so…
Hello and thanks for the replies.
When I use this with Python I get the Normals Count and it works.
normalsCount = mesh.FaceNormals.Count
But when I use:
normalForFaceID1 = mesh.FaceNormals.Item(1)
I get error:
Message: indexer# is not callable
Any idea what I am doing wrong here?
Yes, using Item takes square brackets. The reason I just went and assigned the normals to a list in line five, is that this will be quite a bit more performant. Using the Item call seems to be expensive for some reason. Anyhow, probably not a major concern.
Thanks. All works now.
Good to know that I should assign all the normals to a variable and then directly take them from it.
Thanks a lot Anders and Rolf for helping me out on this.