The following is a script that I prepared for my Material Potency students:
Option Explicit
‘Script written by mark bearak
‘Script copyrighted by dtls.architecture
‘Script version Monday, October 08, 2007 10:11:58 PM
Call Main()
Sub Main()
Dim i,j,n, pt, intX, intY, intStep, dblDist, dblNewDist, arrPts()
Dim arrStrAttractors : arrStrAttractors = rhino.GetObjects(“pick locators”)
Dim dblDistance: dblDistance = rhino.GetReal(“feild radius”)
intX = 20
intY = 20
n = 0
intStep = .5
ReDim arrAttractors(UBound(arrStrAttractors))
Dim strAttractor, k
k=0
For Each strAttractor In arrStrAttractors
arrAttractors(k) = Rhino.pointcoordinates (strAttractor)
k=k+1
Next
For i = 0 To intX
For j = 0 To IntY
ReDim Preserve arrPts(n)
If (j Mod 2 = 0) Then
arrPts(n) = Rhino.AddPoint (array(i,j,0))
Else
arrPts(n) = Rhino.AddPoint (array(i+.5,j,0))
End If
Dim arrCenter : arrCenter = rhino.PointCoordinates (arrPts(n))
Dim arrAttractor
For Each arrAttractor In arrAttractors
Dim testDistance : testDistance = Rhino.distance (arrCenter, arrAttractor)
If testDistance < dblDistance Then
dblDist = testDistance
DblNewDist = (dblDistance – dblDist)/2
Call Rhino.moveObject (arrPts(n), array(1,1,1), array(1,1,1+DblNewDist))
End If
Next
n=n+1
Next
Next
End Sub
1 response so far ↓
escripto // October 12, 2007 at 4:15 am |
nice work. it is very important thaat you share your knowledge, becasuse peaplo of far countries like me , can learn and make research from the third world, please visit my blog, you can find some projects that i made in rhinoscript for mi Master degree in Pontificia University catolica of chile.
nice work!!!