Exploding Meshes (Decompose a Mesh into its Faces)

Hi,

I’m trying to explode a mesh into its faces. I’m using “rs.ExplodeMeshes(mesh)” but I just get back one mesh.I would like to get the same output as you would get from the Grasshopper component “Mesh Explode”.
I’m sure I might have a misconception of what actually Explode Mesh means, because when I try and explode the mesh in Rhino the same thing happens. Any guides on how to approach this or the explanation of mesh explode is welcomed.

Thanks,

-Miguel

Hi Miguel,

rs.ExplodeMeshes() “explodes” the input mesh into sub-meshes, where a sub-mesh is a collection of faces that are contained within a closed loop of “unwelded” edges. Unwelded edges are edges where the faces that share the edge have unique mesh vertices (not mesh topology vertices) at both ends of the edge.

If you want the Grasshopper type of explode, then just get all of the faces and create planar surfaces from them.

Hi Dale,

thanks for your quick reply. I think I understand a bit better meshes now. I’ll post my solution, just in case it is useful to other people.

 meshFaces  = rs.MeshFaces(mesh)
    faces = []
    
    for i in range(0,len(meshFaces),4):
        vertice = [meshFaces[i],meshFaces[i+1],meshFaces[i+2],meshFaces[i+3]]
        addedMesh = rs.AddMesh(vertice,[[0,1,2,3]])
        faces.append(addedMesh)

thanks again,

  • Miguel