Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (32 sloc) 961 Bytes
' ExplodeMesh.rvb -- September 2005
' If this code works, it was written by Dale Fugier.
' If not, I don't know who wrote it.
' Works with Rhino 4.0.
Option Explicit
Sub ExplodeMesh
Dim mesh
mesh = Rhino.GetObject("Select mesh", 32)
If IsNull(mesh) Then Exit Sub
Dim faces
faces = Rhino.MeshFaces(mesh, True)
If Not IsArray(faces) Then Exit Sub
Rhino.EnableRedraw False
Dim i, a, b, c, d, bQuad
i = 0
While i <= UBound(faces)
a = faces(i)
b = faces(i+1)
c = faces(i+2)
d = faces(i+3)
If c(0)=d(0) And c(1)=d(1) And c(2)=d(2) Then
Rhino.AddMesh Array(a,b,c,d), Array(Array(0,1,2,2))
Rhino.AddMesh Array(a,b,c,d), Array(Array(0,1,2,3))
End If
i = i + 4
Rhino.DeleteObject mesh
Rhino.EnableRedraw True
End Sub