SG&RM_particles_random_angle_scale

Option Explicit
‘Script written by <reihaneh_sara>
‘Script copyrighted by <insert company name>
‘Script version Monday, December 7, 2009 7:16:30 PM

Call Main()
Sub Main()

Dim strpts : strpts = rhino.GetObjects (“selpts”,1)
Dim i,j,pt
Dim component : component = rhino.GetObjects (“sel Component”)
Dim compentCntr : compentCntr = rhino.GetPointCoordinates (“sel Comp Cntr”)
Dim vect,angle,strobj
Dim scale

For i=0 To ubound (strpts)
For j=0 To ubound (component)
If rhino.ObjectColor (strpts(i)) = rgb(0,0,0) Then
angle = random (0,360)
vect = array (random(-10,10),random(-10,10),random(-10,10))
scale = random (0.5,1)
pt = rhino.PointCoordinates (strpts(i))
strobj = rhino.CopyObject (component(j),compentCntr(0),pt)
rhino.RotateObject strobj,pt,angle,vect,False
rhino.ScaleObject strobj,pt,array(scale,scale,scale)

End If
Next
Next

End Sub

Function random(min,max)
random=Rnd*(max-min)+min
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 )

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