This code is developed to transfer the idea
of taking the iso curves of a surface or dif-
ferent Uv params on the surface and creating a
pattern through piping.
the next stage will involve deformation using point
attractor logic on these tubes.
Code:
Option Explicit
'Script written by robert_both
Call Piping()
Sub Piping()
'Set Variables
Dim StrSurf
Dim nRows
Dim nColumns
Dim arrParam(1)
Dim arrPointv()
Dim arrPointU()
Dim interpCurve
Dim u,v,i,j
Dim StartRadius,EndRadius
strSurf = Rhino.getObject("Select Surface",8)
nRows = 75
nColumns = 75
u = Rhino.SurfaceDomain(strSurf, 0)
v = Rhino.SurfaceDomain(strSurf, 1)
If Not IsArray(U) Or Not IsArray(V) Then
Exit Sub
End If
Rhino.EnableRedraw(False)
For i = 0 To nRows
arrParam(0) = U(0) + (((U(1) - U(0)) / nRows) * i)
For j = 0 To nColumns
arrParam(1) = V(0) + (((V(1) - V(0)) / nColumns) * j)
ReDim Preserve arrpoint(j)
arrPoint(j) = Rhino.EvaluateSurface(strsurf, arrParam)
Next
InterpCurve = rhino.AddInterpCrvOnSrf(strSurf,arrPoint)
Rhino.SelectObject InterpCurve
StartRadius = random(0.5, 1)
EndRadius = random(0.5, 1)
Rhino.Command ("_Pipe " & StartRadius & " " & EndRadius & " " & " enter ")
Rhino.UnselectAllObjects()
Next
For i = 0 To nColumns
arrParam(1) = V(0) + (((V(1) - V(0)) / nColumns) * i)
For j = 0 To nRows
arrParam(0) = U(0) + (((U(1) - U(0)) / nRows) * j)
ReDim Preserve arrpoint(j)
arrPoint(j) = Rhino.EvaluateSurface(strsurf, arrParam)
Next
InterpCurve = rhino.AddInterpCrvOnSrf(strSurf,arrPoint)
Rhino.SelectObject InterpCurve
Rhino.Command ("_Pipe " & StartRadius & " " & EndRadius & " " & " enter ")
Rhino.UnselectAllObjects()
Next
Rhino.EnableRedraw(true)
End Sub
Function random(low, up)
Randomize
random = (up - low) * Rnd + low
End Function
script inspired by the following image: