This is a small colaboration with Mary ann busby, from chile.
the aim was generate surface from other surfaces, and create some kind movement.
the code works under recursion: analizing, generating and deleting every surface.
is very abstract and also is very simple how it’s works.
Some Images from the complete generation, saving every “child”:








And here the code:
some functions from Marius Watz:
Option Explicit
‘Script written by carlos de la b.
‘Script copyrighted by designemergente.org
‘Script version miércoles, 24 de junio de 2009 18:17:12
Call Main()
Sub Main()
‘//we need a Surface to grow and grow
Dim Idsrf
Idsrf = Rhino.GetObject(”sel srf”, ![]()
If IsNull(Idsrf) Then Exit Sub
Call rec(Idsrf, 0)
End Sub
Function rec(Idsrf, counter) ‘//recursion under your own Risk!!!
‘domain of the curve
Dim Udom, Vdom
Udom = Rhino.SurfaceDomain(Idsrf, 0)
Vdom = Rhino.SurfaceDomain(Idsrf, 1)
‘parameters, divisions, counters and a point
Dim Up, Vp, divU, divV, i, j, k, pt, l
k = 0
divU = 6
divV = 6
Dim arrPoints(35)
For i = 0 To divU – 1
For j = 0 To divV – 1
Up = Udom(0) + i * ((Udom(1) – Udom(0)) / divU)
Vp = Vdom(0) + j * ((Vdom(1) – Vdom(0)) / divV)
pt = Rhino.SurfaceCurvature(Idsrf, Array(Up, Vp))
‘Randomize
‘ If 0.5 < rnd Then
‘ pt(1) = Rhino.VectorScale(pt(1), rnd * 5)
‘ l = Rhino.PointAdd(pt(1), pt(0))
‘ Else
l = Rhino.PointAdd(pt(1), pt(0))
‘ End If
arrPoints(k) = l
k = k + 1
Next
Next
Call Rhino.DeleteObject(IDsrf)
Dim n: n = Rhino.AddSrfPtGrid (Array(divU, divV), arrPoints)
Call Rhino.sleep(3000)
renderView()
Call rec(n, counter + 1)
End Function
‘ Render current viewport
Function renderView()’this function from Marius Watz, a very little modification by me.
Dim view,filename
view = Rhino.CurrentView
Rhino.Command “_-Render”
filename=getRenderFileName(”GrowSurface”)
Dim cmd : cmd=”_-SaveRenderWindowAs ” & Chr(34) & filename & Chr(34)
Rhino.Command cmd
Rhino.Command “_-CloseRenderWindow”
Rhino.Sleep(3000)
End Function
‘ Get auto-incremented filename
Function getRenderFileName(scriptName) ‘this function from Marius Watz
Dim index,done, doc, file, temp,imgNum
done=-1
index=0
Do While done=-1
doc=Rhino.WorkingFolder & “\” & scriptName & padStr(scriptName,index) & “.jpg”
file=Rhino.FindFile(doc)
If IsNull(file)=True Then
done=1
Else
index=index+1
End If
Loop
getRenderFileName=doc
End Function
Function padStr(prefix,val) ‘this function from Marius Watz
Dim l : l=Len(val)
If l<1 Then
padStr=”000″ & val
ElseIf l<2 Then
padStr=”00″ & val
ElseIf l<3 Then
padStr=”0″ & val
Else
padStr=”" & val
End If
End Function
