Option Explicit
‘Script written by ben howell
‘Script copyrighted by md+x
‘Script version Monday, October 08, 2007 7:46:45 PM

Call Main()
Sub Main()

Dim mesh
mesh = Rhino.GetObject(“Select mesh to explode”, 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
Dim arrVertices, arrNewVertices
Dim arrPts, arrPts1, arrPts2, arrPts3
Dim arrnewPts, arrnewPts1, arrnewPts2, arrnewPts3
Dim strMesh
While i <= UBound(faces)
a = faces(i)
b = faces(i+1)
c = faces(i+2)
d = faces(i+3)

arrVertices = Array(a,b,c,d)
arrPts = Rhino.PointCoordinates(Rhino.AddPoint(arrVertices(0)))
arrPts1 = Rhino.PointCoordinates(Rhino.AddPoint(arrVertices(1)))
arrPts2 = Rhino.PointCoordinates(Rhino.AddPoint(arrVertices(2)))
arrPts3 = Rhino.PointCoordinates(Rhino.AddPoint(arrVertices(3)))

Dim dblDistance : dblDistance = Rhino.Distance (arrPts, arrPts1)
Rhino.Print dblDistance

arrnewPts = arrPts
arrnewPts1 = Array(arrPts1(0) + dbldistance, arrPts1(1), arrPts1(2))
arrnewPts2 = Array(arrPts2(0) + dbldistance, arrPts2(1), arrPts2(2))
arrnewPts3 = arrPts3
arrNewVertices = Array(arrnewPts, arrnewPts1, arrnewPts2, arrnewPts3)

strMesh = Rhino.AddMesh (arrVertices, Array(Array(0,1,2,3)))
Rhino.AddMesh arrNewVertices, Array(Array(0,1,2,3))

i = i + 4
Rhino.DeleteObject mesh
Rhino.EnableRedraw True

End Sub


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s