Hi,
starting from three curves, the script creates a number of ellipses defined by the user.
The first curve is the place of the ellipses' center, and the other two defines the radiuses.
Finally there's a simple colour's modulation
Option Explicit
'Script written by Simone Righi
'trying to script something intresting
Call Main()
Sub Main()
Dim arrDom1,arrDom2,arrDom3
Dim strCrv1: strCrv1 = Rhino.GetObject("Select first curve please",4)
Dim strCrv2: strCrv2 = Rhino.GetObject("Select socond curve please",4)
Dim strCrv3: strCrv3 = Rhino.GetObject("Select third curve please",4)
Dim intNpt: intNpt = Rhino.GetInteger ("n. of points?",100,50,500)
Dim dblx,dbly,dblz
If IsNull (strCrv1) Then Exit Sub
If IsNull (strCrv2) Then Exit Sub
If IsNull (strCrv3) Then Exit Sub
arrDom1 = Rhino.CurveDomain(strCrv1)
arrDom2 = Rhino.CurveDomain (strCrv2)
arrDom3 = Rhino.CurveDomain (strCrv3)
Dim i,dblPar1,arrPt1,strPt1,arrLines
ReDim arrLines (intNpt)
For i=0 To intNpt
dblPar1 = arrDom1 (0)+ i*(arrDom1(1)-arrDom1(0))/intNpt
arrPt1 = Rhino.EvaluateCurve(strCrv1,dblPar1)
strPt1 = Rhino.AddPoint (arrPt1)
Call Rhino.ObjectColor(strPt1,RGB(i*255/intNpt, i*255/intNpt,0))
Dim dblPar2,arrPt2,strPt2
dblPar2 = arrDom2 (0)+ i*(arrDom2(1)-arrDom2(0))/intNpt
arrPt2 = Rhino.EvaluateCurve(strCrv2,dblPar2)
strPt2 = Rhino.AddPoint (arrPt2)
Call Rhino.ObjectColor(strPt2,RGB(i*255/intNpt, i*255/intNpt,0))
Dim dblPar3,arrPt3,strPt3
dblPar3 = arrDom3 (0)+ i*(arrDom3(1)-arrDom3(0))/intNpt
arrPt3 = Rhino.EvaluateCurve(strCrv3,dblPar3)
strPt3 = Rhino.AddPoint (arrPt3)
Call Rhino.ObjectColor(strPt3,RGB(i*255/intNpt, i*255/intNpt,0))
Dim strEll
'drawing ellipse from 3pts
strEll = Rhino.AddEllipse3Pt (arrPt1,arrPt2,arrPt3)
Call Rhino.ObjectColor(strEll,RGB(0,i*(255/intNpt),i*(255/intNpt)))
Next
End Sub
No comments:
Post a Comment