StuFo 6

I had some fun some time ago with plexiglass, a laser printer, rhino, and a very limited and buggy script that made “ribs” out of a surface.

The results were nice, so I decided to share:

Here’s the bugged up script (it’s quite useless, but people may find inspiration where I didn’t):

Option Explicit


‘Script written by Dimitrie Stefanescu
‘Released under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
‘№ 5:28:35 AMW ednesday, May 21, 2008

Call Main()
Sub Main()

Dim surf : surf = Rhino.GetObject(“sel surf “, 8, True)

Dim detailLevel : detailLevel = Rhino.GetInteger(“det lev “, 10, 5, 50)
Dim matTh : matTh = Rhino.GetReal(“mat thickness “, .4, .1, 2)
Dim hght : hght = Rhino.GetReal(“rib height “, 1.5,  matTh, 10)

Dim uDomain : uDomain = Rhino.SurfaceDomain(surf, 0)
Dim uStep : uStep = (uDomain(1) – uDomain(0))/detailLevel

Dim vDomain : vDomain = Rhino.SurfaceDomain(surf, 1)
Dim vStep : vStep = (vDomain(1) – vDomain(0))/detailLevel

Call rhino.enableredraw(False)

Dim pts : pts = Array()
ReDim pts(detailLevel)

Dim i, j, k : k = -1
Dim rib


‘U direction

For i=uDomain(0) To uDomain(1) Step uStep
For j=vDomain(0) To vDomain(1) Step vStep
k = k + 1
ReDim Preserve pts(k)
pts(k) = Rhino.EvaluateSurface(surf, Array(i, j))
Next
rib = addRib(pts, matTh, hght)
k = -1
Next


‘V direction

‘k = -1
‘For j=uDomain(0) To uDomain(1) Step uStep
‘    For i=vDomain(0) To vDomain(1) Step vStep
‘        k = k + 1
‘        ReDim Preserve pts(k)
‘        pts(k) = Rhino.EvaluateSurface(surf, Array(i, j))
‘    Next
‘    rib = addRib(pts, matTh, hght)
‘    k = -1
‘Next

Call rhino.enableredraw(True)

End Sub

Function addRib(pts, matThickness, height)

Dim crv, crvPlane, norm, ppp, art, crvOff, arrCrvs, ribb, perpFrame, fff, dirV, extSurf

crv = Rhino.AddInterpCurve(pts)

crvPlane = Rhino.CurvePlane(crv)

If Not isArray(crvPlane) Then
Call rhino.print(“Surface not ribbable by this script. SORRY!”)
End If

norm = Rhino.CurveNormal(crv)
ppp = Rhino.AddPlaneSurface(crvPlane, 1, 1)
art = Rhino.SurfacePoints(ppp)

crvOff = Rhino.OffsetCurve(crv, art(1) , height , norm)
arrCrvs = Array(crv, crvOff(0))

ribb = Rhino.AddEdgeSrf(arrCrvs)

perpFrame = Rhino.CurvePerpFrame(crv, 0)
fff = Rhino.AddPlaneSurface(perpFrame, matThickness, matThickness)
art = Rhino.SurfacePoints(fff)
dirV = Rhino.AddLine(art(0), art(2))

extSurf = Rhino.ExtrudeSurface(ribb, dirV)

Call Rhino.DeleteObjects(Array(fff, ppp, dirV, ribb))

addRib = extSurf
End Function

Advertisements

3 thoughts on “StuFo 6

  1. remember we learn most through experimentation, at least i do, so even if something ain’t perfect, there’s still value in it. thanks for sharing via the site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s