MARC FORNES & THEVERYMANY™

PRACTICING AT THE INTERSECTION OF ART + ARCHITECTURE ^ COMPUTATION

Rh3_OrnementationOntoSurf (v.2005)




Option Explicit
Sub WildOnSurf()
Dim strObject, nLONGITUDE, nTRANSVERSAL
Dim U, V, i, j, arrParam(1)
Dim intRnd
‘ ———————————————————————————
‘ [ Get SURFACE object ]
strObject = Rhino.GetObject(“Select surface”, 8)
If IsNull(strObject) Then Exit Sub

‘ [ PROPERTY LIST BOX ]
Dim arrParameters, arrResults, arrValues
arrParameters = array(“i: rows/sections (>1)”, “j: columns/isoParms (>1)”)
arrValues = array(“15”, “10”)
arrResults = Rhino.PropertyListBox(arrParameters, arrValues, “Parameters”, “ZOOYORK{1117_PAU_Skin_Panels}” )
If IsArray(arrResults) Then
‘ NUMBER of rows/sections:
nLONGITUDE = FormatNumber(arrResults(0))
If IsNull(nLONGITUDE) Then Exit Sub
nLONGITUDE = nLONGITUDE – 1
‘ NUMBER of columns:
nTRANSVERSAL = FormatNumber(arrResults(1))
If IsNull(nTRANSVERSAL) Then Exit Sub
nTRANSVERSAL = nTRANSVERSAL – 1
End If
‘ ———————————————————————————

‘ GET DOMAIN OF SURFACE
U = Rhino.SurfaceDomain(strObject, 0)
V = Rhino.SurfaceDomain(strObject, 1)
If Not IsArray(U) Or Not IsArray(V) Then Exit Sub

‘ set:
intRnd = V(0)

For i = 0 To nLONGITUDE
arrParam(0) = U(0) + (((U(1) – U(0)) / nLONGITUDE) * i)

For j = 0 To nTRANSVERSAL
‘ ORIGINAL: controled
‘arrParam(1) = V(0) + (((V(1) – V(0)) / nTRANSVERSAL) * j)
‘ [ RANDOM ]
‘ Exemple: Random number generated for each loop // 0<=Rnd<1
‘ intRnd = ((intHigh – intLow) * Rnd *0.4 + intLow)

intRnd = intRnd + (((V(1) – V(0)) * (Rnd*0.1)))
If (j = nTRANSVERSAL) Or ( intRnd > V(1)) Then
arrParam(1) = V(1)
Else
arrParam(1) = intRnd
End If
‘ [ GRID POINT ON SURFACE ]
ReDim Preserve arrPt_onSurf(nLONGITUDE,nTRANSVERSAL)
arrPt_onSurf(i,j) = Rhino.EvaluateSurface(strObject, arrParam)
Rhino.AddPoint arrPt_onSurf(i,j)
‘ [ ADD CLOSED CURVE ]
If i 0 And j 0 Then
ReDim Preserve arrCurves(nLONGITUDE,nTRANSVERSAL)
arrCurves(i,j) = Rhino.addCurve (Array( arrPt_onSurf(i,j), _
arrPt_onSurf((i-1),j), _
arrPt_onSurf((i-1),(j-1)), _
arrPt_onSurf(i,(j-1)), _
arrPt_onSurf(i,j) _
) )
ReDim Preserve arrCurves_onSurf(nLONGITUDE,nTRANSVERSAL)
arrCurves_onSurf(i,j) = Rhino.AddInterpCrvOnSrf (strObject, Array( arrPt_onSurf(i,j), _
arrPt_onSurf((i-1),j), _
arrPt_onSurf((i-1),(j-1)), _
arrPt_onSurf(i,(j-1)), _
arrPt_onSurf(i,j) _
) )
Rhino.AddLoftSrf Array ( arrCurves(i,j), arrCurves_onSurf(i,j) )
End If
Next
intRnd = V(0)
Next
End Sub

Advertisements

No comments yet»

Leave a Reply

Please log in using one of these methods to post your comment:

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