This is just another attempt to improve the script and recreate the phenomenon of thigmotropism. In this case the organism grows in a surface even if there are some parameters that I still not control at all. I'm thinking of what this system can evolve and create forms and spaces even though in nature it's a parasite.
Option Explicit
'Giacomo Damiani
'Script version lunedì 16 marzo 2009 23.50.56
Call Main()
Sub Main()
Dim n,i,j,p, dblparam,dblparam2, dblradius,arrplane,strcurve,arrCirc2, strcurvecrv,arrcrvdata,arrCPlane,arrPlane3,ArrRPlane,Arrmoveplane,dblparam3,arrcurve
Dim strcrv: strcrv = Rhino.GetObject("select curve",4)
Dim strsrf: strsrf = Rhino.GetObject("select surface",8)
If isNull(strcrv) Then Exit Sub
If isNull(strsrf) Then Exit Sub
Dim IntNPt: intNPt = Rhino.GetInteger("how many frame?", 60, 10, 80)
Call Rhino.EnableRedraw(False)
Dim arrDom3: arrDom3 = Rhino.CurveDomain(strCrv)
Dim dblstep3: dblStep3 = (arrDom3(1)-arrDom3(0))/(intNPt+1)
ReDim arrplane3(intNpt-1)
ReDim dblparam3(intNpt-1)
For p=0 To intNpt-1
dblParam3(p) = arrDom3(0) + p*dblStep3
arrPlane3(p) = Rhino.CurvePerpFrame(strcrv, dblParam3(p))
'i take a curve and the section is make in planes create by this curve
arrcurve = Rhino.AddSrfSectionCrvs(strsrf,arrPlane3(p))
'section to the surface
If isNull (arrCurve) Then Exit Sub
Dim IntNPts: intNPts = Rhino.GetInteger("how many samples?", 100, 10, 200) 'chiedo il dimensionamento
If isNull (intNpts) Then Exit Sub
ReDim arrCirc(intNpts-1)
ReDim arrCirc2(intNpts-1)
Dim arrpt,strpt,arrpt2,arrpte,strpt2, strcurve1,arrplane2,dblradius2
ReDim arrcurve1(intNpts-1)
ReDim arrpt2(intNpts-1)
ReDim arrpte(intNpts-1)
ReDim arrpt(intNpts-1)
ReDim arrplane(intNpts-1)
For n=0 To ubound (arrcurve)
Dim arrDom: arrDom = Rhino.CurveDomain(arrCurve(n))
Dim dblstep: dblStep = (arrDom(1)-arrDom(0))/intNPts
For i=0 To intNpts-1
dblParam = arrDom(0) + i*dblStep
arrPlane(i) = Rhino.CurvePerpFrame(arrCurve(n), dblParam)
dblRadius = 0.09
arrCrvData = Rhino.CurveCurvature (arrCurve(n), dblParam)
arrCirc(i) = Rhino.AddCircle(arrPlane(i),dblRadius)
arrpt(i) = Rhino.EvaluateCurve(arrCurve(n),dblParam)
strpt = Rhino.AddPoint(arrpt(i))
arrpte(i) = Rhino.EvaluateCurve(arrcirc(i),dblparam*i)
arrpt2(i) = Rhino.MoveObject(strpt,arrpt(i),arrpte(i))
'arrCrvData = Rhino.CurveCurvature (strCurve, dblParam)
Next
strcurve = Rhino.AddInterpCurve(arrpte)
'strcurve(i)=arrcurve
Dim arrDom2: arrDom2 = Rhino.CurveDomain(strcurve)
Dim dblstep2: dblStep2 = (arrDom2(1)-arrDom2(0))/intNPts
For j=0 To ubound (arrpte)
dblParam2 = arrDom2(0) + j*dblStep2
arrPlane2 = Rhino.CurvePerpFrame(strcurve,dblparam2)
dblradius2 = 3/(j+6)
arrcirc2(j) = Rhino.AddCircle(arrplane2,dblradius2)
Next
'Call Rhino.AddLoftSrf(arrCirc)
Call Rhino.AddLoftSrf(arrCirc2)
Next
'Call Rhino.ObjectColor(arrCirc(i),RGB(0,0,255))
Next
Call Rhino.EnableRedraw(True)
Call Rhino.HideObject(strsrf)
End Sub
Option Explicit
'Giacomo Damiani
'Script version lunedì 16 marzo 2009 23.50.56
Call Main()
Sub Main()
Dim n,i,j,p, dblparam,dblparam2, dblradius,arrplane,strcurve,arrCirc2, strcurvecrv,arrcrvdata,arrCPlane,arrPlane3,ArrRPlane,Arrmoveplane,dblparam3,arrcurve
Dim strcrv: strcrv = Rhino.GetObject("select curve",4)
Dim strsrf: strsrf = Rhino.GetObject("select surface",8)
If isNull(strcrv) Then Exit Sub
If isNull(strsrf) Then Exit Sub
Dim IntNPt: intNPt = Rhino.GetInteger("how many frame?", 60, 10, 80)
Call Rhino.EnableRedraw(False)
Dim arrDom3: arrDom3 = Rhino.CurveDomain(strCrv)
Dim dblstep3: dblStep3 = (arrDom3(1)-arrDom3(0))/(intNPt+1)
ReDim arrplane3(intNpt-1)
ReDim dblparam3(intNpt-1)
For p=0 To intNpt-1
dblParam3(p) = arrDom3(0) + p*dblStep3
arrPlane3(p) = Rhino.CurvePerpFrame(strcrv, dblParam3(p))
'i take a curve and the section is make in planes create by this curve
arrcurve = Rhino.AddSrfSectionCrvs(strsrf,arrPlane3(p))
'section to the surface
If isNull (arrCurve) Then Exit Sub
Dim IntNPts: intNPts = Rhino.GetInteger("how many samples?", 100, 10, 200) 'chiedo il dimensionamento
If isNull (intNpts) Then Exit Sub
ReDim arrCirc(intNpts-1)
ReDim arrCirc2(intNpts-1)
Dim arrpt,strpt,arrpt2,arrpte,strpt2, strcurve1,arrplane2,dblradius2
ReDim arrcurve1(intNpts-1)
ReDim arrpt2(intNpts-1)
ReDim arrpte(intNpts-1)
ReDim arrpt(intNpts-1)
ReDim arrplane(intNpts-1)
For n=0 To ubound (arrcurve)
Dim arrDom: arrDom = Rhino.CurveDomain(arrCurve(n))
Dim dblstep: dblStep = (arrDom(1)-arrDom(0))/intNPts
For i=0 To intNpts-1
dblParam = arrDom(0) + i*dblStep
arrPlane(i) = Rhino.CurvePerpFrame(arrCurve(n), dblParam)
dblRadius = 0.09
arrCrvData = Rhino.CurveCurvature (arrCurve(n), dblParam)
arrCirc(i) = Rhino.AddCircle(arrPlane(i),dblRadius)
arrpt(i) = Rhino.EvaluateCurve(arrCurve(n),dblParam)
strpt = Rhino.AddPoint(arrpt(i))
arrpte(i) = Rhino.EvaluateCurve(arrcirc(i),dblparam*i)
arrpt2(i) = Rhino.MoveObject(strpt,arrpt(i),arrpte(i))
'arrCrvData = Rhino.CurveCurvature (strCurve, dblParam)
Next
strcurve = Rhino.AddInterpCurve(arrpte)
'strcurve(i)=arrcurve
Dim arrDom2: arrDom2 = Rhino.CurveDomain(strcurve)
Dim dblstep2: dblStep2 = (arrDom2(1)-arrDom2(0))/intNPts
For j=0 To ubound (arrpte)
dblParam2 = arrDom2(0) + j*dblStep2
arrPlane2 = Rhino.CurvePerpFrame(strcurve,dblparam2)
dblradius2 = 3/(j+6)
arrcirc2(j) = Rhino.AddCircle(arrplane2,dblradius2)
Next
'Call Rhino.AddLoftSrf(arrCirc)
Call Rhino.AddLoftSrf(arrCirc2)
Next
'Call Rhino.ObjectColor(arrCirc(i),RGB(0,0,255))
Next
Call Rhino.EnableRedraw(True)
Call Rhino.HideObject(strsrf)
End Sub
No comments:
Post a Comment