martedì 3 febbraio 2009
Lo sgabuzzino del pc
Esercitazione sugli array: il DNA
Option Explicit
'Script written by VitrartiV
'Date lunedì 2 febbraio 2009 15.37.50
Sub Main()
Dim intNpoints
Dim arrPt1, arrPt2, i, j
Dim arrPtc1, arrPtc2
Dim strPt1, strPt2
Dim strline0, strline1, strline2
Dim text1, text2
Dim curve1, curve2
'input npoints
'Call Rhino.EnableRedraw(False)
intNpoints=Rhino.GetInteger("n. of points?")
ReDim arrPt1(intNpoints-1)
ReDim arrPt2(intNpoints-1)
ReDim arrPtc1(intNpoints-1)
ReDim arrPtc2(intNpoints-1)
For i=0 To intNpoints-1
arrptc1(i)=array(sin(i),cos(i),i)
arrptc2(i)=array(-sin(i),-cos(i),i)
arrPt1(i)=Rhino.AddPoint(arrptc1(i))
arrPt2(i)=Rhino.AddPoint(arrptc2(i))
strline0= Rhino.AddLine(arrPtc1(i),arrPtc2(i))
Call Rhino.AddLayer("Spiral1")
Call Rhino.ObjectLayer(arrpt1(i),"Spiral1")
Call Rhino.ObjectLayer(arrpt2(i),"Spiral1")
Call Rhino.ObjectColor(arrpt1(i),RGB(0,0,(i*255/(intNpoints-1))))
Call Rhino.ObjectColor(arrpt2(i),RGB((i*255/(intNpoints-1)),0,0))
'ERR'Call Rhino.Addpolyline (arrPt1(i))
'ERR'Call Rhino.AddPolyline (arrPt2(i))
text1 =Rhino.AddText("1."&i,Rhino.PointCoordinates(arrpt1(i)),0.3)
Call Rhino.ObjectColor(text1,RGB(0,0,255))
text2 =Rhino.AddText("1."&i,Rhino.PointCoordinates(arrpt2(i)),0.3)
Call Rhino.ObjectColor(text2,RGB(255,0,0))
Next
Curve1= Rhino.AddInterpCurve(arrptc1)
Curve2= Rhino.AddInterpCurve(arrptc2)
Call Rhino.ObjectColor(Curve1,RGB(0,0,(i*255/(intNpoints-1))))
Call Rhino.ObjectColor(Curve2,RGB((i*255/(intNpoints-1)),0,0))
For i=1 To intNpoints-1
strline1= Rhino.AddLine(Rhino.PointCoordinates(arrpt1(i-1)),Rhino.PointCoordinates(arrpt1(i)))
strline2= Rhino.AddLine(Rhino.PointCoordinates(arrpt2(i-1)),Rhino.PointCoordinates(arrpt2(i)))
Call Rhino.ObjectColor(strline1,RGB((i*255/(intNpoints-1)),(i*255/(intNpoints-1)),(i*255/(intNpoints-1))))
Call Rhino.ObjectColor(strline2,RGB((i*255/(intNpoints-1)),(i*255/(intNpoints-1)),(i*255/(intNpoints-1))))
Next
'Call Rhino.SelectObjects(array(arrPt(5),arrPt(6)))
'Call Rhino.SelectObjects(arrPoints(10))
'Call Rhino.SelectObjects(arrPoints(15))
'Call Rhino.SelectObjects(arrPoints(20))
End Sub
Call Main()
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento