algorithmic modeling for Rhino
I am trying to acquire a list of all edges in a mesh,using python, but since Rhino does not have this "embedded", I came around this code, which works that out in a bit funny way.
Does anyone has better ideas?
def MeshEdges(mesh):
faces = rs.MeshFaces(mesh, True)
edges = []
i = 0
while( i<len(faces) ):
edges.append([faces[i], faces[i+1]])
edges.append([faces[i+1], faces[i+2]])
if (faces[i+2] != faces[i+3]):
edges.append([faces[i+2], faces[i+3]])
edges.append([faces[i+3], faces[i]])
i += 4
# we should remove duplicate (from shared) edges in the future!
return edges
Tags:
Attached an example of two ways of doing it (both use RhinoCommon mesh methods directly). Neither yields duplicates. Hope that helps.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by