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

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

7 comments:

  1. Alessandro,

    your approach to the hex patterning is quite interesting, please take some time to add explanations, since your code might not be clear to many readers (also a graphic scheme will be appreciated). Since this blog is a playground for mutual growth and experimentation let's try to share with care. ;-)

    ReplyDelete
  2. ok, now I think it's more clear. Please tell me about errors or inaccuracies.
    ;-)

    zompa

    ReplyDelete
  3. hmm... something's wrong with the diagram I guess... wether the dimensions or the proportions...

    Let's presume, for example, that one of your hexagons in the grid can be inscribed in a circle of radius 1 (that will be the measure of any line from the center to one vertex of the hex). In this case the vertical dimension is correct, but not so the horizontal ones...

    On the other side, if (as I guess from the script and the render) you put the correct dimensions the picture is misleading since you don't get regular honeycomb with that proportions. Not that you have to, but correct and precise explanations help you and others in checking if your process was rigorous or not and (most important) help you identify where things happen (in other words, for example, to giva an answer to the question: "why do I get stretched honeycomb here? Was that supposed to happen or just something unexpected?").

    Cheers!

    PS: please help me in enhancing aesthetically the word cloud in the upper right corner of the blog... use keywords when you post. (they also might help some reader in searching stuff...)

    ReplyDelete
  4. Alessandro! Oooops, my bad! Shame on me.... :-(

    Your diagram is correct, please ignore my comment here above... I read 1*cos(60°) instead of 1+cos(60°) and accordingly 2*cos(60°) instead 2*(1+cos(60°)), that's why I was misled... sorry about that!

    ReplyDelete
  5. Don't worry... :-)

    Soon I'll post my developments.

    ReplyDelete
  6. Great work Alessandro your approach for solving hexagonal tessellations is very interesting i´m going to translate this algorithm into grasshopper and add some functions to make apertures according a sunlight vector

    ReplyDelete