This is a simple script we are writing in class, it generates random points (the number is user defined) in a cubic space of 200 units and then generates lines between them if they are closer than a distance (user defined). In the end it generates lofts between these lines.
Option Explicit
' . Script written by Vincenzo Reale edited by Mario Da Deppo
' . univin@libero.it
'Script version mercoledì 4 febbraio 2009 11.46.11
Call Main()
Sub Main()
Dim intNpt: intNpt = Rhino.GetInteger("how many points?",100,50,500):
Dim dblDist: dblDist = Rhino.GetReal("minimum distance?",50,5,100)
Call rhino.EnableRedraw(False)
Dim i,j, dblPointDist
Dim arrPts: ReDim arrPts(intNpt-1)
Dim arrPtsc: ReDim arrPtsc(intNpt-1)
Dim arrLines(),intCount
intCount = 0
For i = 0 To intnpt-1
arrPts(i) = Rhino.AddPoint(array(Rnd*200,rnd*200,rnd*200))
arrPtsc(i) = Rhino.PointCoordinates(arrpts(i))
Next
For i = 0 To Ubound(arrPts)
For j = 0 To i
If i <> j Then
dblPointDist = rhino.Distance(arrPtsc(i),arrPtsc(j))
If dblPointDist <>
ReDim Preserve arrLines(intCount)
arrLines(intCount) = rhino.AddLine (arrPtsc(i),arrPtsc(j))
intCount = intCount+1
End If
End If
Next
Next
Call rhino.AddLoftSrf (arrLines)
Call rhino.EnableRedraw(True)
End Sub
No comments:
Post a Comment