Option Explicit
“Script written by ben howell (w/Marc Fornes)
‘Script copyrighted by md+x (w/Marc Fornes)
‘Script version Saturday, October 06, 2007 11:19:09 PM

Call Main()
Sub Main()

Dim arrMeshes : arrMeshes = rhino.getObjects(“pick boat parts”,32)
Dim arrVerticesNewOrigin()

Dim i

‘ ===========================
For i = 0 To UBound(arrMeshes)

‘Dim arrCentPt : arrCentPt = Rhino.MeshAreaCentroid(arrMesh)
Dim arrVertices : arrVertices = Rhino.MeshVertices(arrMeshes(i))

If IsArray(arrVertices) Then

If i > 0 Then

‘Dim count : count = count = i-1
Dim count : count = fix(random(0,(i-1)))

Dim arrMovedObject : arrMovedObject = Rhino.MoveObjects (array(arrMeshes(i)), arrVertices(0), arrVerticesNewOrigin(count) )
‘Rhino.RotateObject arrMesh, newArrVertices(t), (dblDistance* (rnd()*10))

Dim arrVerticesMoved : arrVerticesMoved = Rhino.MeshVertices(arrMovedObject(0))
If isArray(arrVerticesMoved) Then
ReDim Preserve arrVerticesNewOrigin(i)
arrVerticesNewOrigin(i) = arrVerticesMoved(2)
End If

ElseIf i = 0 Then
‘ if ever not been moved keep vertex
ReDim Preserve arrVerticesNewOrigin(0)
arrVerticesNewOrigin(0) = arrVertices(0)

End If

End If

‘ ===========================
‘ Rhino.EnableRedraw(True)
End Sub

Function random(low,up) ‘generate a random # between two limits
Randomize ‘increases randomness
random = (up – low) * Rnd() + low ‘Rnd is a vb command for random # between 0 and 1
End Function

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s