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
‘Rhino.EnableRedraw(False)
‘ ===========================
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
Next
‘ ===========================
‘ 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
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.