Is there any way in rhino python to select a mesh, create a dictionary of the mesh face indices as the key, and then create values corresponding to the normals of that mesh face index? If the mesh faces have indices, can you reference the data, like the normals, of those triangles?
I have been using the explode mesh command, but then that makes each triangle an individual mesh, and that eats into data and processing time.
Yes, but I don’t get why you’d want to do that, because the information is already there in the mesh object, that is if the normals have been calculated beforehand.
Can you expand a little on what it is that you want to do? The big picture?
I would like to go through triangle by triangle and change the color of the triangle based on the angle with respect to the XY plane. I need the normals in order to calculate the angle.
me = GetYourMesh() # method to implemented by yourself
# ensure normals exist
me.RebuildNormals()
# loop over normals
for fn in me.FaceNormals:
print(fn) # fn is now a Vector3f
in C# it would be something like
Rhino.Geometry.Mesh mesh = GetYourMesh(); // implement method yourself
// ensure normals exist
mesh.RebuildNormals();
// loop over normals
foreach(Rhino.Geometry.Vector3f fn in mesh.FaceNormals)
{
// do something with the fn
}