💻 Rhino 5
🔼 Rhino Script
🛠️ Visual Basic
This simple rhinoscript, developed to randomize sets of objects for material application in rendering, allows the user to select a set of objects and place them into a user-specified number of groups.
Option Explicit
'Script written by <David Mans>
'Script copyrighted by <NeoArchaic.net>
'Script version Sunday, August 22, 2010 12:09:23 AM
Call Main()
Sub Main()
Dim arrObjects, counts
arrObjects = Rhino.GetObjects("Select Objects",,, True)
If isNull(arrObjects) Then Exit Sub
counts = Rhino.GetInteger("Number of Sets")
If isNull(counts) Then Exit Sub
Dim i, j
Call Rhino.EnableRedraw(False)
For i = 0 To counts - 1 Step 1
Call Rhino.AddGroup("Group_" & i)
Next
For i = 0 To uBound(arrObjects) Step 1
j = CInt(rnd() * (counts - 1))
Call Rhino.AddObjectToGroup(arrObjects(i), CStr("Group_" & j))
Next
Call Rhino.EnableRedraw(True)
End Sub
Comentarios