rhinoscript


Though I’m not entirely sure how this will relate to my studio project, I’ve finally made my first Rhino Script. I’ve been fascinated by the pollibility of using a halftone gradient as a generative image, and I’ve created a process to do just that. Take any image (random Photoshop “Clouds” for instance) and transform it with a color halftone filter (all angles set to zero to assure black and white dots). Then, take it to Illustrator, perform a live trace to vectorize the image, export it to a dwg file, and import it in rhino.

In rhino, join all the curves and make surfaces from planar curves. Then comes the script. The script takes a selection of surfaces, and extrudes them each to a height related to the inverse of the square root of the surface area. What this means is from any halftone image, areas of high density will become low, flat areas for inhabitation, while diffuse areas will become either completely open, or populated by tall, slender columns.

Here’s the result of running the script on the image above:

And here’s the script:

Option Explicit'Extrude multiple surfaces to a height depending on surface area'Script written by Evan Chakroff

Public intCount

Call Main()Sub Main()

'Define the height-area ratio   Dim ratio   'ratio = Rhino.GetString("Select height to area ratio", , , True)   ratio = .00005 'smaller number = bigger range of heights

   'need new method for height calculation

   If IsNull(ratio) Then Exit Sub   Rhino.Print "Ratio: " & ratio

'Select surface objects and print area   Dim arrObjects, strObject, arrArea, area, height, strSurface, strCurve    arrObjects = Rhino.GetObjects("Select surface objects", , , True)

   If IsArray(arrObjects) Then      For Each strObject In arrObjects         arrArea = Rhino.SurfaceArea(strObject)         area = CStr(arrArea(0))         height = (100/(area^0.5))         Rhino.Print "Object identifier: " & strObject         Rhino.Print "The surface area is: " & area              Rhino.Print "The height to extrude is: " & heightif height > 100 then height = 100if height < 1 then height = 1         strCurve = Rhino.AddLine(Array(0,0,0), Array(0,0,height))         Rhino.ExtrudeSurface strObject, strCurve         Rhino.DeleteObject (strCurve)

      Next   End If

End Sub

Any scripters out there? Comments are welcome.

Comments

  • Marc S.

    Love the blog. And nice job on cracking into the Rhinoscript. The halftone patterns are pretty great looking, it’s hard to deny.

    Your ambitious forays into hipster architecture programming are raising the bar. I will have to rededicate myself to this endless game of one-upsmanship… stay tuned, nefarious arch-nemesis!

  • cbass

    Hey,

    This is very cool.

    Just one problem for me… I keep getting a type mismatch for the arrArea (it returns a null when I try using the typename function).

    Any ideas?

    cbass

  • Anonymous

    how could you change the script do the big area became the high spots and the small areas and the low spots?

Leave a Reply