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
For Each strAttractor In arrStrAttractors
arrAttractors(k)    = Rhino.pointcoordinates (strAttractor)

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))
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
End Sub

One response to “071008_M.Bearak_Field_Generation

  1. 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!!!

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