Current | Works

Let Us Calculate

Studio Jonas Coersmeier at University of Pennsylvania

20061016

Dim i, j, m, pointArr, arrParam, uArr, vArr, arrDomV, arrPoint
Dim surface : surface = Rhino.GetObject( "Select a surface" )
Dim U : U = Rhino.getinteger( "How Many Points in U Direction?", 5 )
Dim V : V = Rhino.getinteger( "How Many Points in V Direction?", 5 )

'Rhino.EnableRedraw vbFalse

Call Rhino.unselectallobjects( )
Call Rhino.selectobject( surface )
Call Rhino.command( "-_reparameterize 0 1 0 1" )

Rhino.AddLayer "Points", RGB(0, 255, 255)
CheckLayer("Points")

Rhino.Print ("Calculating Points - Please Be Patient . . .")

For m = 0 To U - 1
uArr = m / ( U - 1 )
For j = 0 To V
vArr = j / V
ReDim Preserve newpoint(j)
newpoint(j) = Rhino.EvaluateSurface(surface,Array(uArr, vArr))
arrpoint = Rhino.AddPoint (newpoint(j))
Next
ReDim Preserve fullpointarray(m)
fullpointarray(m) = newpoint
Next

'Rhino.EnableRedraw vbTrue

Rhino.Print ("Finished with " & CStr(U * V + U) & " Points")
arrNumb = (U * V + U)

Dim arrNumb, iStart, iFinish, iStep
Dim IterationLayer, LayerCount
Dim moveaxis, arrmovenum, arrmoveinc, moveob

iStart = Rhino.GetReal ("Start Value?", 1)
iFinish = Rhino.GetReal ("End Value?", 5)

iStep = (iFinish / arrNumb)

LayerCount = 0
j = 0
m = 0

For i = iStart To iFinish Step iStep

LayerCount = LayerCount + 1
Rhino.AddLayer "IterationLayer " & CStr(LayerCount), RGB(255, 0, 0)
CheckLayer("IterationLayer " & CStr(LayerCount))

Rhino.command "mathsurface", i
moveob = ObjectsByLayer ("IterationLayer " & CStr(LayerCount))

Rhino.MoveObject moveob(0), Array(0,0,0), fullpointarray(j)(m)
m = m + 1
If m > U Then
j = j + 1
m = 0
End If

Next

Rhino.Print("Increment Count is " & CStr(iStep))

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Function CheckLayer(layername)
If Rhino.IsLayer(layername) Then
Rhino.CurrentLayer(layername)
Else
Rhino.AddLayer(layername)
Rhino.CurrentLayer(layername)
End If
End Function

.: Jon 12:08 PM


powered by Blogger