I'm studying Deleuze's Rhizome trying to replicate some principles:1)connection and eterogenity2)multiplicity3)asignificant break4)cartography and decalcomania
i'm still work on it and all the implication it has in architectureI'll give more explanations.. :)
i'm still work on it and all the implication it has in architectureI'll give more explanations.. :)
Option Explicit
'Script written by simone cremona
'Script copyrighted by sim_c
'Script version lunedì 8 marzo 2009 15.16.15
Call Main()
Sub Main()
Dim arrCrv: arrCrv=Rhino.GetObjects("select data curves", 4)
Dim strSrf, strSrf0: strSrf0 = Rhino.AddLoftSrf(ArrCrv)
Dim intUInt: intUInt = Rhino.GetInteger("number of U intervals?", 10, 5)
Dim intVInt: intVInt = Rhino.GetInteger("number of V intervals?", 10, 5)
Dim IntNPts: intNPts = Rhino.GetInteger("how many samples for the curves?", 100, 50, 200)
If isNull (intNpts) Then Exit Sub
strSrf=strSrf0(0)
Dim arrUdom, arrVdom, arrpanel
ArrUdom = Rhino.SurfaceDomain(strSrf, 0)
ArrVdom = Rhino.SurfaceDomain(strSrf, 1)
Call Rhino.Print("surface U domain: from " & arrUdom(0) & " to " & arrUdom(1))
Call Rhino.Print("surface V domain: from " & arrVdom(0) & " to " & arrVdom(1))
Dim i, j, arrPt, Upar, Vpar, strFrame, dblUdist, dblVdist
ReDim arrPt(intUint-1, intVint-1)
Call Rhino.EnableRedraw(False)
For i=0 To IntUInt-1
For j=0 To intVInt-1
Upar= arrUdom(0)+i*(arrUdom(1)-arrUdom(0))/(intUInt-1)
Vpar= arrVdom(0)+j*(arrVdom(1)-arrVdom(0))/(intVInt-1)
'evaluating surface at (upar, vpar), it gives a 3d point
arrPt(i,j)=Rhino.EvaluateSurface(strSrf, array(upar, vpar))
'place a point there; describing a surface with loads of points
Call Rhino.addpoint(arrPt(i, j))
Next
Next
Dim ArrPtCurves(), arrPtCurvesC(), ArrCurves1()
ReDim ArrCurves1(intUInt-1)
Dim p, n
For p=0 To IntUInt-1
n=0
ReDim ArrPtCurves(p,n)
For i=0 To IntUInt-1
For j=0 To intVInt-1
If i= (j+p) Then
ReDim Preserve ArrPtCurves (p,n)
ReDim Preserve ArrPtCurvesC (n)
ArrPtCurves (p,n) = ArrPt(i,j)
ArrPtCurvesC(n)= arrPtCurves(p,n)
n=n+1
End If
Next
Next
ArrCurves1(p) = Rhino.AddCurve(arrPtCurvesC)
If n>2 Then
Dim dblRadius, q, ArrCirc, ArrPts
Dim arrDom: arrDom = Rhino.CurveDomain(arrCurves1(p))
Dim dblparam, arrCrvData, dblStep, arrPlane
ReDim arrCirc(intNpts)
dblStep = (arrDom(1)-arrDom(0))/(intNPts+1)
For q=0 To intNPts
dblParam = arrDom(0) + q*dblStep
arrCrvData = Rhino.CurveCurvature (arrCurves1(p), dblParam)
arrPlane = Rhino.CurvePerpFrame(arrCurves1(p), dblParam)
If Not isNull (arrCrvData) Then
dblRadius= 8/arrCrvData(3)
Else
dblRadius = 1
End If
arrCirc(q) = Rhino.AddCircle(arrPlane, dblRadius)
Next
Call Rhino.AddLoftSrf(arrCirc)
End If
Next
Dim ArrCurves2()
ReDim ArrCurves2(intUInt-1)
For p=0 To IntUInt-1
n=0
ReDim ArrPtCurves(p,n)
For i=1 To IntUInt-1
For j=0 To intVInt-1
If (i+p)=j Then
ReDim Preserve ArrPtCurves(p,n)
ReDim Preserve ArrPtCurvesC (n)
ArrPtCurves (p,n) = ArrPt(i,j)
ArrPtCurvesC(n)= arrPtCurves(p,n)
n=n+1
End If
Next
Next
ArrCurves2(p) = Rhino.AddCurve(arrPtCurvesC)
If n>2 Then
arrDom = Rhino.CurveDomain(arrCurves2(p))
ReDim arrCirc(intNpts)
dblStep = (arrDom(1)-arrDom(0))/(intNPts+1)
For q=0 To intNPts
dblParam = arrDom(0) + q*dblStep
arrCrvData = Rhino.CurveCurvature (arrCurves2(p), dblParam)
arrPlane = Rhino.CurvePerpFrame(arrCurves2(p), dblParam)
If Not isNull (arrCrvData) Then
dblRadius= 8/arrCrvData(3)
Else
dblRadius = 1
End If
arrCirc(q) = Rhino.AddCircle(arrPlane, dblRadius)
Next
Call Rhino.AddLoftSrf(arrCirc)
End If
Next
Dim ArrCurves3()
ReDim ArrCurves3(2*(intUInt-1))
For p=0 To 2*(IntUInt-1)
n=0
ReDim ArrPtCurves(p,n)
For i=0 To IntUInt-1
For j=0 To intVInt-1
If i+j=p Then
ReDim Preserve ArrPtCurves (p,n)
ReDim Preserve ArrPtCurvesC (n)
ArrPtCurves (p,n) = ArrPt(i,j)
ArrPtCurvesC(n)= arrPtCurves(p,n)
n=n+1
End If
Next
Next
ArrCurves3(p) = Rhino.AddCurve(arrPtCurvesC)
If n>2 Then
arrDom = Rhino.CurveDomain(arrCurves3(p))
ReDim arrCirc(intNpts)
dblStep = (arrDom(1)-arrDom(0))/(intNPts+1)
For q=0 To intNPts
dblParam = arrDom(0) + q*dblStep
arrCrvData = Rhino.CurveCurvature (arrCurves3(p), dblParam)
arrPlane = Rhino.CurvePerpFrame(arrCurves3(p), dblParam)
If Not isNull (arrCrvData) Then
dblRadius= 8/arrCrvData(3)
Else
dblRadius = 1
End If
arrCirc(q) = Rhino.AddCircle(arrPlane, dblRadius)
Next
Call Rhino.AddLoftSrf(arrCirc)
End If
Next
Call Rhino.HideObject(strsrf)
Dim strCrvTax
Dim Stratt: strAtt = Rhino.GetObject("select attractor point",1)
Dim arrPtAtt: arrPtAtt = Rhino.PointCoordinates(strAtt)
'imput theresold distance
Dim dblTdist: dblTdist=Rhino.Getreal("threshold distance?",30,10)
'scale objects if inside theresold:
Dim arrBB,arrCP,dbldist,dblscale'center point
Dim k
Dim ArrPlanSrf
ReDim ArrPlanSrf(k)
For i=0 To IntUInt-2
For j=0 To intVInt-2
ReDim Preserve ArrPlanSrf(k+1)
arrpanel= array(arrPt(i,j), arrPt(i+1, j), arrPt(i, j+1), arrPt(i, j))
strCrvTax= Rhino.addcurve(arrpanel, 2)
ArrPlanSrf= Rhino.Addplanarsrf(array(strCrvTax))
For k=0 To ubound (ArrPlanSrf)
'1.find buonding box of object
arrBB = Rhino.BoundingBox(ArrPlanSrf(k))
'world contruction plane, non specifichiamo nulla come secondo fattore
arrCP = array((arrBB(2)(0)+ arrBB(4)(0))/2,(arrBB(2)(1)+ arrBB(4)(1))/2,(arrBB(2)(2)+arrBB(4)(2))/2)
'media
'2.find distance centerpoint-attractor
dbldist = Rhino.Distance(arrPtAtt,arrCP)
'3.scale according to distance inside thresold
If dbldist > dblTdist Then
dblscale = (1-(dbldist-dblTdist)/dbldist)
Call Rhino.ScaleObject(ArrPlanSrf(k),arrCP,array(dblscale,dblscale,dblscale))
End If
Next
arrpanel= array(arrPt(i+1,j), arrPt(i+1, j+1), arrPt(i, j+1), arrPt(i+1, j))
strCrvTax= Rhino.addcurve(arrpanel, 2)
ArrPlanSrf= Rhino.Addplanarsrf(array(strCrvTax))
For k=0 To ubound (ArrPlanSrf)
'1.find buonding box of object
arrBB = Rhino.BoundingBox(ArrPlanSrf(k))
'world contruction plane, non specifichiamo nulla come secondo fattore
arrCP = array((arrBB(2)(0)+ arrBB(4)(0))/2,(arrBB(2)(1)+ arrBB(4)(1))/2,(arrBB(2)(2)+arrBB(4)(2))/2)
'media
'2.find distance centerpoint-attractor
dbldist = Rhino.Distance(arrPtAtt,arrCP)
'3.scale according to distance inside thresold
If dbldist > dblTdist Then
dblscale = (1-(dbldist-dblTdist)/dbldist)
Call Rhino.ScaleObject(ArrPlanSrf(k),arrCP,array(dblscale,dblscale,dblscale))
End If
Next
Next
Next
'Call Rhino.EnableRedraw(False)
Call Rhino.EnableRedraw(True)
No comments:
Post a Comment