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

12.6.09

tens.tesselation


Here some other surface tesselation experiments, I have already posted the first one but now it is fixed (no more Rhino.command!). Anyway there is not a relevant physics accuracy in both scripts, take them just as tries.





















' CASE 10 SURFSTARS

Sub surfstars(strsurf,upar,vpar)
upar = upar*5
vpar = vpar*5
Dim dblheight : dblheight = rhino.getreal("extrusion height?" ,.05)
If isnull (dblheight) Then Exit Sub
Dim attrpoint : attrpoint = rhino.getobject("point attractor",1)
Dim arrpoint : arrpoint = rhino.PointCoordinates(attrpoint)
Call rhino.enableredraw(False)
Dim i, j
Dim uvalone(1), uvaltwo
Dim arrUone, arrVone
Dim arrpttemp, pointtwo
Dim pt1, pt2, pt3, pt4, pt5, pt6, PT7, Pt8, pt5b, pt6b, pt7b, pt8b, ptc1, ptc2, pt1c, pt2c, pt3c, pt4c
ReDim matrix (upar, vpar)
Dim tempt
arruone = array (0,0)
arrVone = array (0,0)
Dim strcell, arrct, arrptsurf, arrnorm, arrnormend,arrnormenddown, arrline, strcell2
Dim pt1b,pt2b,pt3b,pt4b
If rhino.IsSurface(strsurf) Then
arruone = rhino.surfacedomain(strsurf,0)
arrVone = rhino.surfacedomain(strsurf,1)
End If
For i=0 To upar
For j=0 To vpar
uvalone(0)= ((arruone(1)-arruone(0))/upar)*i
uvalone(1) = ((arrVone(1)-arrVone(0))/vpar)*j
arrpttemp = rhino.EvaluateSurface(strsurf,uvalone)
matrix(i,j) = arrpttemp
Next
Next
Dim oct1, oct2, oct3, oct4, arrlinehuge, arrel1, arrel2, arrdom, midplane, midcircle1, midcircle2
Dim rn, crvtemp, dbldist

For i = 1 To upar-1
For J=0 To vpar-1
pt1 = matrix(i,j)
pt2 = matrix(i+1,j)
pt3 = matrix(i,j+1)
pt4 = matrix(i+1,j+1)
pt5 = array( (pt1(0)+pt2(0))/2,(pt1(1)+pt2(1))/2,(pt1(2)+pt2(2))/2)
pt6 = array( (pt2(0)+pt4(0))/2,(pt2(1)+pt4(1))/2,(pt2(2)+pt4(2))/2)
pt7 = array( (pt3(0)+pt4(0))/2,(pt3(1)+pt4(1))/2,(pt3(2)+pt4(2))/2)
pt8 = array( (pt1(0)+pt3(0))/2,(pt1(1)+pt3(1))/2,(pt1(2)+pt3(2))/2)
ptc1 = array( (pt5(0)+pt7(0))/2,(pt5(1)+pt7(1))/2,(pt5(2)+pt7(2))/2)
ptc2 = array( (pt6(0)+pt8(0))/2,(pt6(1)+pt8(1))/2,(pt6(2)+pt8(2))/2)
dbldist = rhino.Distance(ptc1,arrpoint)
dbldist = Rhino.Log10 (dbldist*3)
If dbldist<1 dbldist ="">
pt5b = array( pt5(0)+(ptc1(0)-pt5(0))/(dbldist),pt5(1)+(ptc1(1)-pt5(1))/(dbldist),pt5(2)+(ptc1(2)-pt5(2))/(dbldist))
pt6b = array( pt6(0)+(ptc2(0)-pt6(0))/(dbldist),pt6(1)+(ptc2(1)-pt6(1))/(dbldist),pt6(2)+(ptc2(2)-pt6(2))/(dbldist))
pt7b = array( pt7(0)+(ptc1(0)-pt7(0))/(dbldist),pt7(1)+(ptc1(1)-pt7(1))/(dbldist),pt7(2)+(ptc1(2)-pt7(2))/(dbldist))
pt8b = array( pt8(0)+(ptc2(0)-pt8(0))/(dbldist),pt8(1)+(ptc2(1)-pt8(1))/(dbldist),pt8(2)+(ptc2(2)-pt8(2))/(dbldist))

Call rhino.AddCurve(array(pt1,pt2,pt4,pt3,pt1),1)
strcell = rhino.addcurve(array(pt1,,pt5b, pt2,pt6b, pt4, pt7b,pt3,pt8b,pt1),1)

arrct = array( (pt4(0)+pt1(0))/2,(pt4(1)+pt1(1))/2,(pt4(2)+pt1(2))/2)
arrptsurf = rhino.SurfaceClosestPoint(strsurf,arrct)
arrnorm = rhino.SurfaceNormal(strsurf,arrptsurf)
arrnorm = rhino.VectorScale(arrnorm, dblheight)
arrnormend = rhino.PointAdd(arrct,arrnorm)
arrnormenddown = rhino.Pointsubtract(arrct,arrnorm)
crvtemp = rhino.AddSrfPt(array(pt1,arrnormend,pt5b))
crvtemp = rhino.AddSrfPt(array(pt5b,arrnormend,pt2))
crvtemp = rhino.AddSrfPt(array(pt2,arrnormend,pt6b))
crvtemp = rhino.AddSrfPt(array(pt6b,arrnormend,pt4))
crvtemp = rhino.AddSrfPt(array(pt4,arrnormend,pt7b))
crvtemp = rhino.AddSrfPt(array(pt7b,arrnormend,pt3))
crvtemp = rhino.AddSrfPt(array(pt3,arrnormend,pt8b))
crvtemp = rhino.AddSrfPt(array(pt8b,arrnormend,pt1))

crvtemp = rhino.AddSrfPt(array(pt1,arrnormenddown,pt5b))
crvtemp = rhino.AddSrfPt(array(pt5b,arrnormenddown,pt2))
crvtemp = rhino.AddSrfPt(array(pt2,arrnormenddown,pt6b))
crvtemp = rhino.AddSrfPt(array(pt6b,arrnormenddown,pt4))
crvtemp = rhino.AddSrfPt(array(pt4,arrnormenddown,pt7b))
crvtemp = rhino.AddSrfPt(array(pt7b,arrnormenddown,pt3))
crvtemp = rhino.AddSrfPt(array(pt3,arrnormenddown,pt8b))
crvtemp = rhino.AddSrfPt(array(pt8b,arrnormenddown,pt1))
arrline = rhino.AddLine(pt1,pt2)
arrdom=rhino.CurveDomain(arrline)
midplane=rhino.CurvePerpFrame(arrline,arrdom(0))
midcircle1=rhino.AddCircle(midplane,0.09)
midplane=rhino.CurvePerpFrame(arrline,arrdom(1))
midcircle2=rhino.AddCircle(midplane,0.09)
Call rhino.AddLoftSrf (Array(midcircle1,midcircle2))
arrline = rhino.AddLine(pt3,pt4)
arrdom=rhino.CurveDomain(arrline)
midplane=rhino.CurvePerpFrame(arrline,arrdom(0))
midcircle1=rhino.AddCircle(midplane,0.09)
midplane=rhino.CurvePerpFrame(arrline,arrdom(1))
midcircle2=rhino.AddCircle(midplane,0.09)
Call rhino.AddLoftSrf (Array(midcircle1,midcircle2))

Next
Next

Call rhino.deleteobject(strsurf)
Call rhino.EnableRedraw(True)
End Sub



'----- CASE 11 SURFholetens -----


Sub SURFholetens (strsurf,upar,vpar)
Dim dblheight : dblheight = rhino.getreal("elements height?" ,.6)
Dim attrpoint : attrpoint = rhino.Getobject("attractor",1)
Dim attrpointcoord : attrpointcoord= rhino.pointcoordinates(attrpoint)
If isnull (dblheight) Then Exit Sub
Call rhino.enableredraw(False)
Dim i, j
Dim uvalone(1), uvaltwo
Dim arrUone, arrVone
Dim arrpttemp, pointtwo
Dim pt1, pt2, pt3, pt4, pt5, pt6, pta, ptb, ptc,ptd
ReDim matrix (upar, vpar)
Dim tempt
arruone = array (0,0)
arrVone = array (0,0)
Dim arrct, arrptsurf, arrnorm, arrnormend, arrline
If rhino.IsSurface(strsurf) Then
arruone = rhino.surfacedomain(strsurf,0)
arrVone = rhino.surfacedomain(strsurf,1)
End If
For i=0 To upar
For j=0 To vpar
uvalone(0)= ((arruone(1)-arruone(0))/upar)*i
uvalone(1) = ((arrVone(1)-arrVone(0))/vpar)*j
arrpttemp = rhino.EvaluateSurface(strsurf,uvalone)
matrix(i,j) = arrpttemp
Next
Next
Dim dbldist
Dim strquad1,strcentr,strquad2,strcell, midline,midcircle1,midcircle2, midplane,arrdom,ptmid
Dim midp1,midpoint1
Dim midp2,midpoint2
For i = 1 To upar-2 Step 3
For J=0 To vpar-2 Step 4
pt1 = matrix(i,j)
pt2 = matrix(i+1,j)
pt3 = matrix(i+2,j+1)
pt4 = matrix(i+1,j+2)
pt5 = matrix(i,j+2)
pt6 = matrix(i-1,j+1)
pta = matrix(i-1,j)
ptb = matrix(i+2,j)
ptc = matrix(i+2,j+2)
ptd = matrix(i-1,j+2)
strcell = rhino.AddCurve(array(pt6,pt1,pt2,pt3,pt4,pt5,pt6),2)
strquad1 = rhino.AddCurve(array(pta,ptb,ptc,ptd,pta),1)
Call rhino.objectcolor(strquad1,rgb(255,255,255))'bianco
arrct = array( (pt6(0)+pt3(0))/2,(pt6(1)+pt3(1))/2,(pt6(2)+pt3(2))/2)
arrptsurf = rhino.SurfaceClosestPoint(strsurf,arrct)
dbldist=rhino.Distance(arrct,attrpointcoord)
dbldist = Rhino.Log10 (dbldist*7)
If dbldist < dbldist ="">
strcell = rhino.scaleobject(strcell,arrct,array(0.95/dbldist,0.95/dbldist,0.95/dbldist))
arrnorm = rhino.SurfaceNormal(strsurf,arrptsurf)
arrnorm = rhino.VectorScale(arrnorm, dblheight)
arrnormend = rhino.PointAdd(arrct,arrnorm)
arrline = rhino.AddLine(arrct,arrnormend)
Call rhino.AddLoftSrf(array(strcell,strquad1))
strquad2=rhino.copyObject(strquad1,arrct,arrnormend)
strcentr=rhino.copyobject(strcell,arrct,arrnormend)
Call rhino.addloftsrf(array(strquad2,strcentr))
Call rhino.addloftsrf(array(strquad2,strquad1))
Call rhino.addloftsrf(array(strcentr,strcell))

midp1 = array((ptd(0)+ptc(0))/2,(ptd(1)+ptc(1))/2,(ptd(2)+ptc(2))/2)
midp2 = array((pta(0)+ptb(0))/2,(pta(1)+ptb(1))/2,(pta(2)+ptb(2))/2)
ptmid= array((arrct(0)+arrnormend(0))/2,(arrct(1)+arrnormend(1))/2,(arrct(2)+arrnormend(2))/2)
midpoint1=rhino.addpoint(midp1)
midpoint2=rhino.AddPoint(midp2)
Call rhino.MoveObjects(array(midpoint1,midpoint2),arrct,ptmid)
midp1=rhino.PointCoordinates(midpoint1)
midp2=rhino.PointCoordinates(midpoint2)
midline = rhino.AddLine(midp1,midp2)
arrdom=rhino.CurveDomain(midline)
midplane=rhino.CurvePerpFrame(midline,arrdom(0))
midcircle1=rhino.AddCircle(midplane,dblheight/6)
midplane=rhino.CurvePerpFrame(midline,arrdom(1))
midcircle2=rhino.AddCircle(midplane,dblheight/6)
Call rhino.AddLoftSrf (Array(midcircle1,midcircle2))
Call rhino.DeleteObjects (array(arrline,strquad1,strcentr,strquad2,strcell,midpoint1,midpoint2,midline,midcircle1,midcircle2))
Next
Next
For i = 2.5 To upar-2 Step 3
For J=2 To vpar-2 Step 4
pt1 = matrix(i,j)
pt2 = matrix(i+1,j)
pt3 = matrix(i+2,j+1)
pt4 = matrix(i+1,j+2)
pt5 = matrix(i,j+2)
pt6 = matrix(i-1,j+1)
pta = matrix(i-1,j)
ptb = matrix(i+2,j)
ptc = matrix(i+2,j+2)
ptd = matrix(i-1,j+2)
strcell = rhino.AddCurve(array(pt6,pt1,pt2,pt3,pt4,pt5,pt6),2)
strquad1 = rhino.AddCurve(array(pta,ptb,ptc,ptd,pta),1)
Call rhino.objectcolor(strquad1,rgb(255,255,255))'bianco
arrct = array( (pt6(0)+pt3(0))/2,(pt6(1)+pt3(1))/2,(pt6(2)+pt3(2))/2)
arrptsurf = rhino.SurfaceClosestPoint(strsurf,arrct)
dbldist=rhino.Distance(arrct,attrpointcoord)
dbldist = Rhino.Log10 (dbldist*7)
If dbldist < dbldist ="">
strcell = rhino.scaleobject(strcell,arrct,array(0.95/dbldist,0.95/dbldist,0.95/dbldist))
arrnorm = rhino.SurfaceNormal(strsurf,arrptsurf)
arrnorm = rhino.VectorScale(arrnorm, dblheight)
arrnormend = rhino.PointAdd(arrct,arrnorm)
arrline = rhino.AddLine(arrct,arrnormend)
Call rhino.AddLoftSrf(array(strcell,strquad1))
strquad2=rhino.copyObject(strquad1,arrct,arrnormend)
strcentr=rhino.copyobject(strcell,arrct,arrnormend)
Call rhino.addloftsrf(array(strquad2,strcentr))
Call rhino.addloftsrf(array(strquad2,strquad1))
Call rhino.addloftsrf(array(strcentr,strcell))
midp1 = array((ptd(0)+ptc(0))/2,(ptd(1)+ptc(1))/2,(ptd(2)+ptc(2))/2)
midp2 = array((pta(0)+ptb(0))/2,(pta(1)+ptb(1))/2,(pta(2)+ptb(2))/2)
ptmid= array((arrct(0)+arrnormend(0))/2,(arrct(1)+arrnormend(1))/2,(arrct(2)+arrnormend(2))/2)
midpoint1=rhino.addpoint(midp1)
midpoint2=rhino.AddPoint(midp2)
Call rhino.MoveObjects(array(midpoint1,midpoint2),arrct,ptmid)
midp1=rhino.PointCoordinates(midpoint1)
midp2=rhino.PointCoordinates(midpoint2)
midline = rhino.AddLine(midp1,midp2)
arrdom=rhino.CurveDomain(midline)
midplane=rhino.CurvePerpFrame(midline,arrdom(0))
midcircle1=rhino.AddCircle(midplane,dblheight/6)
midplane=rhino.CurvePerpFrame(midline,arrdom(1))
midcircle2=rhino.AddCircle(midplane,dblheight/6)
Call rhino.AddLoftSrf (Array(midcircle1,midcircle2))
Call rhino.DeleteObjects (array(arrline,strquad1,strcentr,strquad2,strcell,midpoint1,midpoint2,midline,midcircle1,midcircle2))
Next
Next
Call rhino.DeleteObject(strsurf)
Call rhino.EnableRedraw(True)
End Sub