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
Showing posts with label honeycumb. Show all posts
Showing posts with label honeycumb. Show all posts

25.5.09

honeycumb

Hi guys! Before studying Vink's exeples about texturing I tryed to create an honeycumb surface. It is only a simple test and probably I didn't follow the better way for create an Hexagon grid. In future I'll optimize this, may be using rules like attractors or surface curvature...

(sorry for comments, but is only a draft, and coding is simple to understand)


[EDIT]

well, I modified the code revising some errors (like problems with closed surfaces, not completly solved). I also insert comments. I hope it's clear now... ;-)


[/EDIT]

[EDIT]

I also added a diagram for better explain meaning of formulas with sin() and cos() ;-)


[/EDIT]


Option Explicit
' Script written by Alessandro Zomparelli
' alessandro.zomparelli@gmail.com
' http://alessandrozompa.altervista.org/
' Script version sabato 9 maggio 2009 17.11.41

Call Main()
Sub Main()
Call Rhino.EnableRedraw(False)

Dim strSrf, u, v, arrParC, arrUdom, arrVdom, s, u1, v1
ReDim arrParC(1)
strSrf = Rhino.GetObject("pick target surface")
u1 = Rhino.GetInteger("number of U subdivision", 10, 2)
v1 = Rhino.GetInteger("number of V subdivision", 10, 2)

'we are trying to define a grid for drawing hexagons,
'For Do this we need to define the unit parameter to whom refer coordinates:
'For example I choose the radius of circle in whom hexagon is inscribed
'Now we evaluate the number of radius needed for drawing the choosen number of hexagons
v = v1*2*sin(ToRadians(60))
u = u1*(1+cos(ToRadians(60)))

'Here we ask to user the scale of holes
s = Rhino.GetReal("scale value for holes", 0.5, 0.1, 1)

arrUdom = Rhino.SurfaceDomain(strSrf, 0)
arrVdom = Rhino.SurfaceDomain(strSrf, 1)

Dim arrPts, i, j, arrPtsE, arrPtM
ReDim arrPts(3), arrPtsE(6), arrPtM(2)


'now I define the parameter to use for conversion from xy units to uv
Dim parU, parV
parU=(arrUdom(1)-arrUdom(0))/u
parV=(arrVdom(1)-arrVdom(0))/v

For i=0 To u1/2-1
For j=0 To v1-1

'center of hexagon A
arrParC(0) = 2*i*parU*(1+cos(ToRadians(60)))
arrParC(1) = j*parV*2*sin(ToRadians(60))

'drawing hexagon
Call Hexagon(strSrf, parU, parV, arrParC, arrPtsE)
'creating panels
Call Panel (strSrf, arrParC, arrPtsE, s)

'center of hexagon B
arrParC(0) = 2*(i+0.5)*parU*(1+cos(ToRadians(60)))
arrParC(1) = (j+0.5)*parV*2*sin(ToRadians(60))
'drawing hexagon
Call Hexagon(strSrf, parU, parV, arrParC, arrPtsE)
'creating panels
Call Panel (strSrf, arrParC, arrPtsE, s)
Next
Next
Call Rhino.DeleteObject(strSrf)
Call Rhino.EnableRedraw(True)

End Sub

Sub Hexagon (strSrf, parU, parV, arrParC, arrPtsE)
Dim i, strExa
ReDim arrPtsE(6)
For i=0 To 6
'coordinates of vertex related to local center
arrPtsE(i)=Rhino.EvaluateSurface(strSrf, array(arrParC(0)+cos(i*ToRadians(60))*parU,arrParC(1)+sin(i*ToRadians(60))*parV))
Next
End Sub

Sub Panel (strSrf, arrParC, arrPtsE, s)
Dim strExa, strIn, arrPtM, arrPlane
strExa=Rhino.AddPolyline(arrPtsE)
strIn=Rhino.AddPolyline(arrPtsE)
arrPlane=Rhino.SurfaceNormal(strSrf,arrParC)
If isnull (arrPlane) Then Exit Sub
arrPtM=Rhino.EvaluateSurface(strSrf,arrParC)
Call Rhino.ScaleObject(strIn, arrPtM, (array(s,s,s)))
Call Rhino.MoveObject(strIn,arrPlane)
Call Rhino.AddLoftSrf(array(strExa,strIn))
Call Rhino.DeleteObjects(array(strExa,strIn))
End Sub