07 January 2010

Rh array 01 //////////////////////////////////////////////////////////////////////////////////



Here some codes about array in rhinoscript. The code works with a simple array of points and creates spheres with growing radius. The position of the points in the 3d space is determinated by a formula. These are some exercises starting from scratch in rhinoscript code done some time ago.

MIC Sphere array1a
///////////////////////////////////////////////////////////////////////////////////////////////

Option Explicit
'Script written by davide del giudice
'Script copyrighted by www.madeincalifornia.blogspot.com
'Script version Thursday, 16 September 2009 17:43:39
'----------------------------------------------------------------------------------------------
Dim i,arrpoint1,strSphere


For i=0 To 100

arrPoint1 = Array(i/5,cos(i),sin(i))


Rhino.AddPoint arrPoint1
Rhino.AddSphere arrPoint1, i*0.01

Next
///////////////////////////////////////////////////////////////////////////////////////////////



MIC Sphere array_circle vector n-1_02
///////////////////////////////////////////////////////////////////////////////////////////////
Option Explicit
'Script written by davide del giudice
'Script copyrighted by www.madeincalifornia.blogspot.com
'Script version Thursday, 16 September 2009 17:43:39

'----------------------------------------------------------------------------------------------




Dim i,j,arrpoint1,arrPoint2,arrPoint3,strSphere,arrPlane,arrLine1,arrLine2
Dim arrCircle1,arrCircle2,arrDynamic(0),arrVector1,arrVector2,arrPlane1,arrPlane2

For i=0 To 200

arrPoint1 = Array(cos(i)*i*0.01,sin(i)*i*0.01,i*0.05)
arrPoint2=Array(cos(i+1)*i*0.01,sin(i+1)*i*0.01,(i+1)*0.05)
arrPoint3=Array((i-1)*0.05,cos(i-1)*i*0.01,sin(i-1)*i*0.01)
Rhino.AddPoint arrPoint1
'Rhino.AddSphere arrPoint1, i*0.001

arrVector1=Rhino.VectorCreate (arrPoint1, arrPoint2)
arrVector2=Rhino.VectorCreate (arrPoint1, arrPoint3)

arrPlane1 = Rhino.PlaneFromNormal (arrPoint1, arrVector1)
arrPlane2= Rhino.PlaneFromNormal (arrPoint1, arrVector2)

arrCircle1=Rhino.AddCircle (arrPlane1, 0.05)
arrCircle2=Rhino.AddCircle (arrPlane2, 0.05)

arrLine1= Rhino.AddLine (arrPoint1, arrPoint2)

' rhino.AddLoftSrf arrCircle1,arrCircle2

Next

For j=0 To ubound (arrDynamic)

'rhino.AddLoftSrf arrCircle1,arrCircle2

Next
End Sub
///////////////////////////////////////////////////////////////////////////////////////////////





MIC Sphere array_phyllotaxis2
///////////////////////////////////////////////////////////////////////////////////////////////

Option Explicit
'Script written by davide del giudice
'Script copyrighted by www.madeincalifornia.blogspot.com
'Script version Thursday, 16 September 2009 17:43:39
'----------------------------------------------------------------------------------------------

Dim i,arrpoint1,arrPoint2,strSphere

For i=0 To 500

arrPoint1 = Array(cos(i)*i,sin(i)*i,i/1000)
arrPoint2 = Array((cos(i+1)*i),(sin(i+1)*i)+1,(i+1/1000))

Rhino.AddPoint arrPoint1
Rhino.AddPoint arrPoint2
'Rhino.AddSphere arrPoint1, i*0.1

rhino.AddLine arrPoint1,arrPoint2
Next
///////////////////////////////////////////////////////////////////////////////////////////////

0 commenti: