A playground for University of Bologna Students and a 6-days seminar about digital tools.

Digital generative tools are a very important part of architectural education. Andrew Kudless during his conference at SimAE was telling about chinese traditional woodcraftsmen: they spend their first two years of apprentice in making their own tools. Today, we have a large pool of digital ready made tools, built to respond to more or less specific problems or tasks, while keeping a level of flexibility and personalization. The majority of these tools have hidden capabilities, which can only be accessed bypassing the conventional interface and getting close to the machine logic of programming or building parametric components which generate shapes. Thus, seriality, differentiation, complexity can be implemented in architectural projects through code, in order to exploit the power of algorithmic based complex systems which are the basis of biological systems.


But, before going through such complexity, we must start with simple tasks and simple rules. Before playing seriously we need practice. This is the playground where a bunch of students will start to practice, a pool where they will share their results and questions. Maybe the stuff here that will be posted will seem obvious or naive to the navigated code-monkey, but, as I mentioned before, we all start from the basics and this is intended as a place to start. However, any comment and contribution is appreciated.

Playground is open, let's play! _ Alessio

27.3.09

phyllotaxis pavilion 02


this is another evolution in my pavilion project.
i used two Fibonacci's number (13 and 21) different from previous experiment, in this way i could obtain smaller panels that make more evident the
modulation of holes.
i modified the tubolar shape, so in the middle of the generator curve the pavilion section is more similar to an ellipse than a circle.
to obtain a more standardized shape of the triangular panel (in previous experiments they are more stretched in pavilion extremes), generator curve is not
divided in equal part but division lenght change with the distance from an attractor point (which influences pavilion radius also).
for this pavilion i created a double membrane, it's thicker near the ground (to be more resistant) and became thinner going to the top.
the modulation of holes is achieved by an attractor point placed near the middle of the curve generator.



Option Explicit
'Script written by andrea bugli
' "SHIFT" http://andbug.blogspot.com
'Script version venerdì 6 marzo 2009 19.54.31

Call pavilion02triangular
Sub pavilion02triangular

Call rhino.enableredraw(False)

Dim strBpts,arrcircle
Dim strcurve: strcurve = rhino.GetObject("select a curve", 4, True, True)
Dim domain: domain = rhino.CurveDomain(strCurve)
Dim domPt(), distPt, intcount
intcount = 0

Dim ptparam1: ptparam1 = rhino.GetObject("select curve attractor point", 1)
Dim ptcoord1: ptcoord1 = rhino.PointCoordinates(ptparam1)
Dim strAttrHoles: strAttrHoles = rhino.GetObject("select holes attractor point", 1)
Dim arrAttrHoles: arrAttrHoles = rhino.PointCoordinates(strAttrHoles)
Dim strMeshGr: strMeshGr = rhino.GetObject("select ground mesh", 32)
Call rhino.AddLayer("glass")

ReDim Preserve domPt(0)
domPt(intcount) = domain(0)
''''''''' division of generator curve based on distance from ptcoord1
Do
intcount = intcount+1
distPt = rhino.Distance(ptcoord1, rhino.EvaluateCurve(strcurve, domPt(intcount-1)))
If domPt(intcount-1)+(0.035/distPt) > domain(1) Then Exit Do
ReDim Preserve domPt(intcount)
domPt(intcount) = domPt(intcount-1)+(0.018/distPt)
Loop

ReDim arrcircle(ubound(domPt))
Dim i, dblRad
Dim ptrot, pt, ptcurve
ReDim ptrot(ubound(domPt))

rhino.EnableRedraw(False)

For i = 0 To ubound(domPt)
Dim strPoncurve: strPoncurve = rhino.EvaluateCurve(strcurve, dompt(i))
Dim strframe: strframe = rhino.Curveperpframe(strcurve, dompt(i))
Dim tang: tang = rhino.curvetangent(strcurve, dompt(i))
Dim dist: dist = rhino.Distance(strPoncurve, ptcoord1)

arrcircle(i) = rhino.addcircle(strframe, 60/dist)
ptcurve = rhino.CurveStartPoint(arrcircle(i))
pt = rhino.addpoint(ptcurve)
dblRad = rhino.distance(strPoncurve, ptcurve)
''''''''' tubolar shape is scaled to obtain a pavilion section more similar to an ellipse than a circle
ptrot(i) = rhino.RotateObject(pt, strPoncurve, 137.52*i, tang, True)
ptrot(i) = rhino.ScaleObject(ptrot(i), strPoncurve, array((1+dblRad*0.015),(1+dblRad*0.015),(1-dblRad*0.035)))

Call rhino.Deleteobject(pt)
Next

Dim arrVectPos, arrVectNeg, arrPtPos
ReDim arrPtPos(ubound(ptrot))
Dim arrPtOnMesh, dblDistPtM, dblDistCrv
''''''''' here i create the double membrane
For i = 0 To ubound(ptrot)

arrPtOnMesh = rhino.MeshClosestPoint(strMeshGr, rhino.PointCoordinates(ptrot(i)))
dblDistPtM = rhino.Distance(arrPtonMesh(0), rhino.PointCoordinates(ptrot(i)))
dblDistCrv = rhino.Distance(rhino.PointCoordinates(ptrot(i)), rhino.EvaluateCurve(strcurve, dompt(i)))
strPoncurve = rhino.EvaluateCurve(strcurve, dompt(i))
arrVectPos = rhino.VectorCreate(rhino.PointCoordinates(ptrot(i)), strPoncurve)
arrVectPos = rhino.VectorUnitize(arrVectPos)
arrVectPos = rhino.VectorScale(arrVectPos, 0.75*((dblDistCrv-1.4)/(dblDistPtM+3.5)))
arrPtPos(i) = rhino.PointAdd(rhino.PointCoordinates(ptrot(i)), arrVectPos)
''''''''' double membrane is thicker near the ground
If (dblDistPtM < 6) Then
arrVectPos = rhino.VectorScale(arrVectPos, (6 /(dblDistPtM + 3))^2)
End If

arrPtPos(i) = rhino.PointAdd(rhino.PointCoordinates(ptrot(i)), arrVectPos)

Next

Dim strCrv1(), strCrv2()
ReDim arrCrv1(ubound(ptrot))
ReDim arrCrv2(ubound(ptrot))
''''''''' here i start to create triangles on the inner membrane
For i = 0 To ubound(ptrot)-34
arrCrv1(i) = rhino.AddInterpCurve(array(rhino.PointCoordinates(ptrot(i)), rhino.PointCoordinates(ptrot(i+21)), rhino.PointCoordinates(ptrot(i+13)),rhino.PointCoordinates(ptrot(i))),1)
arrCrv2(i) = rhino.AddInterpCurve(array(rhino.PointCoordinates(ptrot(i+13)), rhino.PointCoordinates(ptrot(i+21)), rhino.PointCoordinates(ptrot(i+34)), rhino.PointCoordinates(ptrot(i+13))),1)
Next

Dim strCrvPos1(), strCrvPos2()
ReDim arrCrvPos1(ubound(ptrot))
ReDim arrCrvPos2(ubound(ptrot))
''''''''' here i start to create triangles on the outer membrane
For i = 0 To ubound(arrPtPos)-34
arrCrvPos1(i) = rhino.AddInterpCurve(array(arrPtPos(i), arrPtPos(i+21), arrPtPos(i+13),arrPtPos(i)),1)
arrCrvPos2(i) = rhino.AddInterpCurve(array(arrPtPos(i+13), arrPtPos(i+21), arrPtPos(i+34),arrPtPos(i+13)),1)
Next

For i = 0 To ubound(arrPtPos)-34
Call rhino.AddLoftSrf(array(arrCrv1(i), arrCrvPos1(i)))
Call rhino.AddLoftSrf(array(arrCrv2(i), arrCrvPos2(i)))
Next

Dim arrCenter1(), arrCenter2()
Dim dblDistAttr1, dblDistAttr2
Dim arrVectAC1, arrVectBC1, arrVectCC1, arrPtAC1, arrPtBC1, arrPtCC1
Dim arrVectAC2, arrVectBC2, arrVectCC2, arrPtAC2, arrPtBC2, arrPtCC2
Dim dblScale1, dblScale2, dblDistHole
ReDim arrCenter1(ubound(arrPtPos)-34)
ReDim arrCenter2(ubound(arrPtPos)-34)
Dim strGlass
''''''''' here i create triangular holes, their size is influenced by the distance from arrAttrHoles
For i = 0 To ubound(arrPtPos)-34

arrCenter1(i) = rhino.CurveAreaCentroid(arrCrvPos1(i))

arrVectAC1 = rhino.VectorCreate(arrCenter1(i)(0), rhino.PointCoordinates(ptrot(i)))
arrVectBC1 = rhino.VectorCreate(arrCenter1(i)(0), rhino.PointCoordinates(ptrot(i+13)))
arrVectCC1 = rhino.VectorCreate(arrCenter1(i)(0), rhino.PointCoordinates(ptrot(i+21)))

dblDistHole = rhino.Distance(arrCenter1(i)(0), arrAttrHoles)
dblScale1 = 0.8/(dblDistHole * 0.1)

If (dblScale1 < 0.95) Then

arrVectAC1 = rhino.VectorScale(arrVectAC1, dblScale1)
arrVectBC1 = rhino.VectorScale(arrVectBC1, dblScale1)
arrVectCC1 = rhino.VectorScale(arrVectCC1, dblScale1)
arrPtAC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i)), arrVectAC1)
arrPtBC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+13)), arrVectBC1)
arrPtCC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+21)), arrVectCC1)

Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i)), rhino.PointCoordinates(ptrot(i+13)), arrPtBC1, arrPtAC1))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+13)), rhino.PointCoordinates(ptrot(i+21)), arrPtCC1, arrPtBC1))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+21)), rhino.PointCoordinates(ptrot(i)), arrPtAC1, arrPtCC1))
Call rhino.AddSrfPt(array(arrPtPos(i), arrPtAC1, arrPtBC1, arrPtPos(i+13)))
Call rhino.AddSrfPt(array(arrPtPos(i+13), arrPtBC1, arrPtCC1, arrPtPos(i+21)))
Call rhino.AddSrfPt(array(arrPtPos(i+21), arrPtCC1, arrPtAC1, arrPtPos(i)))
''''''''' i put the surface in the glass layer
strGlass = rhino.AddSrfPt(array(arrPtAC1, arrPtCC1, arrPtBC1))
Call rhino.ObjectLayer(strGlass, "glass")

Else

arrPtAC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i)), arrVectAC1)
arrPtBC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+13)), arrVectBC1)
arrPtCC1 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+21)), arrVectCC1)

Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i)), rhino.PointCoordinates(ptrot(i+13)), arrPtBC1))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+13)), rhino.PointCoordinates(ptrot(i+21)), arrPtCC1))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+21)), rhino.PointCoordinates(ptrot(i)), arrPtAC1))
Call rhino.AddSrfPt(array(arrPtPos(i), arrPtAC1, arrPtPos(i+13)))
Call rhino.AddSrfPt(array(arrPtPos(i+13), arrPtBC1, arrPtPos(i+21)))
Call rhino.AddSrfPt(array(arrPtPos(i+21), arrPtCC1, arrPtPos(i)))

End If

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

arrCenter2(i) = rhino.CurveAreaCentroid(arrCrvPos2(i))

arrVectAC2 = rhino.VectorCreate(arrCenter2(i)(0), rhino.PointCoordinates(ptrot(i+13)))
arrVectBC2 = rhino.VectorCreate(arrCenter2(i)(0), rhino.PointCoordinates(ptrot(i+21)))
arrVectCC2 = rhino.VectorCreate(arrCenter2(i)(0), rhino.PointCoordinates(ptrot(i+34)))

dblDistHole = rhino.Distance(arrCenter2(i)(0), arrAttrHoles)
dblScale2 = 0.8/(dblDistHole * 0.1)

If (dblScale2 < 0.95) Then

arrVectAC2 = rhino.VectorScale(arrVectAC2, dblScale2)
arrVectBC2 = rhino.VectorScale(arrVectBC2, dblScale2)
arrVectCC2 = rhino.VectorScale(arrVectCC2, dblScale2)
arrPtAC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+13)), arrVectAC2)
arrPtBC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+21)), arrVectBC2)
arrPtCC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+34)), arrVectCC2)

Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+13)), arrPtAC2, arrPtBC2, rhino.PointCoordinates(ptrot(i+21))))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+21)), arrPtBC2, arrPtCC2, rhino.PointCoordinates(ptrot(i+34))))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+34)), arrPtCC2, arrPtAC2, rhino.PointCoordinates(ptrot(i+13))))
Call rhino.AddSrfPt(array(arrPtPos(i+13), arrPtPos(i+21), arrPtBC2, arrPtAC2))
Call rhino.AddSrfPt(array(arrPtPos(i+21), arrPtPos(i+34), arrPtCC2, arrPtBC2))
Call rhino.AddSrfPt(array(arrPtPos(i+34), arrPtPos(i+13), arrPtAC2, arrPtCC2))
''''''''' i put the surface in the glass layer
strGlass = rhino.AddSrfPt(array(arrPtAC2, arrPtBC2, arrPtCC2))
Call rhino.ObjectLayer(strGlass, "glass")

Else

arrPtAC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+13)), arrVectAC2)
arrPtBC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+21)), arrVectBC2)
arrPtCC2 = rhino.PointAdd(rhino.PointCoordinates(ptrot(i+34)), arrVectCC2)

Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+13)), arrPtAC2, rhino.PointCoordinates(ptrot(i+21))))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+21)), arrPtBC2, rhino.PointCoordinates(ptrot(i+34))))
Call rhino.AddSrfPt(array(rhino.PointCoordinates(ptrot(i+34)), arrPtCC2, rhino.PointCoordinates(ptrot(i+13))))
Call rhino.AddSrfPt(array(arrPtPos(i+13), arrPtPos(i+21), arrPtBC2))
Call rhino.AddSrfPt(array(arrPtPos(i+21), arrPtPos(i+34), arrPtCC2))
Call rhino.AddSrfPt(array(arrPtPos(i+34), arrPtPos(i+13), arrPtAC2))

End If

Next

Call rhino.DeleteObjects(ptrot)
call rhino.DeleteObjects(arrCircle)
Call rhino.enableredraw(True)

End Sub

17.3.09

ivy_thigmotropism II

























































































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


15.3.09

Rhizome - part II





Here's my second attempt to create a rhizomatic system. I changed the previus planes for a surface, a sort of skin that separate interior from exterior -apart from specific holes, depending to attractor points.


Option Explicit
'Script written by
'Script copyrighted by
'Script version domenica 15 marzo 2009 19.40.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= 5/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= 5/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= 5/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)
'Call Rhino.MoveObject(StrSrf, array(0,0,0), array(0,0,2))
Dim strCrvTax
'Call Rhino.EnableRedraw(true)
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)
Dim ArrPanelSrf1, ArrSrfPts1, ArrPanelSrf2, ArrSrfPts2
Dim e: e=0
Dim StrCrv, ArrCrvTax
ReDim ArrCrvTax(0)
Dim ArrTrimSrf
For i=0 To IntUInt-2
For j=0 To intVInt-2
'ReDim Preserve ArrCrvTax(e)
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)
arrBB = Rhino.BoundingBox(StrCrvTax)
'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 < dblscale =" ((dblTdist-dbldist)/(1.02*dblTdist))" strcrvtax=" Rhino.ScaleObject(StrCrvTax,arrCP,array(dblscale,dblscale,dblscale))" strcrvtax =" Rhino.Command(" arrcrvtax =" Rhino.SelectedObjects" arrtrimsrf =" Rhino.SplitBrep(strSrf," strsrf =" Rhino.IntersectBreps(arrTrimSrf(0)" strsrf="ArrTrimSrf(0)" arrpanel=" array(arrPt(i+1,j)," strcrvtax=" Rhino.addcurve(arrpanel," arrbb =" Rhino.BoundingBox(StrCrvTax)" arrcp =" array((arrBB(2)(0)+" dbldist =" Rhino.Distance(arrPtAtt,arrCP)" dblscale =" ((dblTdist-dbldist)/(1*dblTdist))" strcrvtax=" Rhino.ScaleObject(StrCrvTax,arrCP,array(dblscale,dblscale,dblscale))" strcrvtax =" Rhino.Command(" arrcrvtax =" Rhino.SelectedObjects" strcrvtax =" Rhino.ExtrudeCurveStraight(ArrCrvTax(0)," arrtrimsrf =" Rhino.SplitBrep(strSrf," strsrf="ArrTrimSrf(0)">












9.3.09

Thigmotropism














































This is the first attempt to recreate the phenomenon of Thigmotropism. This system of growth is genereted by the physical conctact between a plant organ and a solid object. A directional response caused by a differential growht. I want to improve this model with a larger adherence to the real growth process, for example recreate the influence of the vegetal hormone auxine that causes this behaviour operating locally. 
I link also a video releted to this process.                             
http://www.youtube.com/watch?v=dTljaIVseTc
 

Option Explicit
'Giacomo Damiani
'Script version domenica 8 marzo 2009 18.52.06

Call Main()
Sub Main()

Dim i, arrcirc, dblparam, dblradius,arrplane
'scelgo una curva intorno alla quale crescere
Dim strCurve: strCurve = Rhino.GetObject("select curve", 4)
If isNull (strCurve) Then Exit Sub
Dim IntNPts: intNPts = Rhino.GetInteger("how many samples?", 100, 50, 500) 'chiedo il dimensionamento
If isNull (intNpts) Then Exit Sub
Call Rhino.EnableRedraw(False)
Dim arrDom: arrDom = Rhino.CurveDomain(strCurve)
ReDim arrCirc(intNpts-1),arrpoints(intNpts-1)
Dim dblstep: dblStep = (arrDom(1)-arrDom(0))/intNPts
Dim arrpt,strpt,arrpt2,arrpte,strpt2, dblradius2, strcurve1,strsrf
ReDim arrpt2(intNpts-1)
ReDim arrpte(intNpts-1)
ReDim arrpt(intNpts-1)
For i=0 To intNPts-1
dblParam = arrDom(0) + i*dblStep
arrPlane = Rhino.CurvePerpFrame(strCurve, dblParam)
arrPlane = Rhino.CurvePerpFrame(strCurve, dblParam)

dblRadius = 0.5
arrCirc(i) = Rhino.AddCircle(arrPlane, dblRadius)
arrpt(i) = Rhino.EvaluateCurve(strcurve,dblparam)
strpt = Rhino.AddPoint(arrpt(i))
arrpte(i) = Rhino.EvaluateCurve(arrcirc(i),dblparam*50)
arrpt2(i) = Rhino.MoveObject(strpt,arrpt(i),arrpte(i))
'sposto i punti sul cerchio
Next
Call Rhino.Addloftsrf(arrcirc)
Call Rhino.ObjectColor(arrCirc,RGB(255,0,0))
strcurve1 = Rhino.AddInterpCurve(arrpte)
Dim  dblparam2, arrplane2
ReDim arrcirc2(intNpts-1)
Dim arrDom2: arrDom2 = Rhino.CurveDomain(strCurve1)
ReDim arrCirc2(intNpts-1)
Dim dblstep2: dblStep2 = (arrDom2(1)-arrDom2(0))/intNPts
'un secondo ciclo per la seconda serie di cerchi nei punti spostati
For i=0 To intNpts-1
dblParam2 = arrDom2(0) + i*dblStep2
arrPlane2 = Rhino.CurvePerpFrame(strCurve1, dblParam2)

dblRadius2 = 2/(i+3)
arrCirc2(i) = Rhino.AddCircle(arrPlane2, dblRadius2)
Next
Call Rhino.AddLoftSrf(arrCirc2)
Call Rhino.ObjectColor(arrCirc2,RGB(0,0,255))

Call Rhino.EnableRedraw(True)
End Sub




8.3.09

Rhizome






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.. :)



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)