SG&RM_particles_machine

Particles Script

Option Explicit
‘Script written by <reihaneh_sara>
‘Script copyrighted by <reihaneh_sara>
‘Script version Monday, 26 October 2009 17:19:47

Call Main()
Sub Main()
Dim aCrvs  : aCrvs =  rhino.getobjects(“pick path”, 4)
Dim i,j,k
Dim aps,ap,strPt
Dim range, rangeLocal, seedPlacement, n
seedPlacement = 10
n = 20
Call rhino.EnableRedraw(False)

For i =0 To UBound(aCrvs)
range=15
aps =DivideCurveLength(aCrvs(i),seedPlacement)
For j = 0 To Ubound(aps)
For k = 0 To int(n-(Ubound(aps)/n*j))
rangeLocal = range – (range/Ubound(aps)*j)
ap = array(aps(j)(0)+ rnd*range,_
aps(j)(1)+rnd*range,_
aps(j)(2))
strPt = rhino.addpoint(ap)

If k Mod 2 =0 Then
Call rhino.ObjectColor (strPt,rgb(255,0,0))
Else
Call rhino.ObjectColor (strPt,rgb(0,255,0))
End If
Call rhino.addpoint(ap)
Next
Next
Next
Call rhino.EnableRedraw(True)
Call component
End Sub
Function component
Dim strpts : strpts = rhino.GetObjects (“selpts”,1)
Dim i,j,k,l,m,pt
Dim component1 : component1 = rhino.GetObjects (“sel Component1”)
Dim compent1Cntr : compent1Cntr = rhino.GetPointCoordinates (“sel Comp1 Cntr”)
Dim component2 : component2 = rhino.GetObjects (“sel Component2”)
Dim compent2Cntr : compent2Cntr = rhino.GetPointCoordinates (“sel Comp2 Cntr”)
For k=0 To ubound (strpts)
For l=0 To ubound (component1)
If rhino.ObjectColor (strpts(k)) = rgb(255,0,0) Then
pt = rhino.PointCoordinates (strpts(k))
rhino.CopyObject component1(l),compent1Cntr(0),pt
End If
Next
For m=0 To ubound (component2)
If rhino.ObjectColor (strpts(k)) = rgb(0,255,0) Then
pt = rhino.PointCoordinates (strpts(k))
rhino.CopyObject component2(m),compent2Cntr(0),pt
End If
Next
Next
End Function

Machine Trajectory Definition

Machine1Machine1.1Machine1.2Machine1.3

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