AN_Pseudo_class_machine

Option Explicit
‘Script written by Adolfo Nadal
‘Script copyrighted by Archi-o-logics
‘Script version Monday, October 20, 2008 4:50:16 PM

Call Main()
Sub Main()
Dim strDest, arrDest, strLoc, strLocs, arrPt, arrLoc, i,j, dblDist, dblNewDist, arrClosePt, strTempLine, strTempLine2,strTempLine3,strTempLine4, arrMidPt, arrMidPt2, arrMidPt3, arrNewPts, arrNewPts2, arrNewPts3, arrNewPt
arrDest = Rhino.GetObjects (“select your destinations”,1)
strLocs = Rhino.GetObjects (“select your acticator”,1)

Dim factor : factor = 6

For Each strLoc In strLocs
arrLoc = rhino.PointCoordinates (strLoc)
dblDist = 100000

For i = 0 To Ubound(arrDest)
arrPt = rhino.PointCoordinates (arrDest(i))
dblNewDist = Rhino.distance (arrLoc, arrPt)
If dblNewDist < dblDist Then
dblDist = dblNewDist
arrClosePt = arrPt
End If
Next

strTempLine = Rhino.AddLine (arrLoc,arrClosePt)
arrMidPt = Rhino.CurveMidPoint (strTempLine)
strTempLine2 = Rhino.CopyObject (strTempLine)

strTempLine3 = Rhino.AddLine(arrLoc,arrMidPt)
arrMidPt2 = Rhino.CurveMidPoint (strTempLine3)

strTempLine4 = Rhino.AddLine(arrClosePt,arrMidPt)
arrMidPt3 = Rhino.CurveMidPoint (strTempLine4)

Call Rhino.ScaleObject (Rhino.RotateObject (strTempLine2, arrMidPt,90),arrMidPt,array(rnd(0.5),rnd(0.5),rnd(0.5)))
arrNewPts = Rhino.DivideCurve (strTempLine2,10)

Call Rhino.ScaleObject (Rhino.RotateObject (strTempLine3, arrMidPt2,90),arrMidPt2,array(rnd(0.5),rnd(0.5),rnd(0.5)))
arrNewPts2 = Rhino.DivideCurve (strTempLine3,10)

Call Rhino.ScaleObject (Rhino.RotateObject (strTempLine4, arrMidPt3,90),arrMidPt3,array(rnd(0.5),rnd(0.5),rnd(0.5)))
arrNewPts3 = Rhino.DivideCurve (strTempLine4,10)

For j = 0 To ubound(arrNewPts)
Dim z : z = factor * Abs(sin (180*j/ubound(arrnewPts)))
If j< ubound(arrNewPts) Then
Call Rhino.AddInterpCurve (array(rhino.CurveStartPoint (strTempLine),arrNewPts2(j),array(arrNewPts(j)(0),arrNewPts(j)(1),arrNewPts(j)(2)+z),arrNewPts3(j),rhino.CurveEndPoint(strTempLine)))
‘Call Rhino.AddInterpCurve (array(rhino.CurveStartPoint (strTempLine),array(arrNewPts(j)(0),arrNewPts(j)(1),z),rhino.CurveEndPoint (strTempLine)))
End If
Next

Call Rhino.deleteobject (strTempLine)
Call Rhino.deleteobject (strTempLine2)
Next
End Sub

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