Dash Curve

A simple script developed during the Rib maker script, this Rhinoscript interface allows the user to select a set of curves then input a sequential set of curve parameters between 0 and 1. The curve set is then broken according to the sequential parameters.

Rhino Script

Option Explicit
'Script written by <David Mans>
'Script copyrighted by <Neoarchaic Studio>
'Script version Monday, April 27, 2009 9:56:55 PM

Call Main()
Sub Main()

Dim strCurve: strCurve = Rhino.GetObject("Select Curve", 4)
If isnull(strCurve) Then Exit Sub
reparameterize(strCurve)

Call removeSegment(strCurve, array(array(0.1, 0.2), array(0.4, 0.5)))
End Sub
Function removeSegment(strCurve, arrParams)
removeSegment = Null
Dim arrVal()
Dim i, curve, crv, keep
i = 0

keep = strCurve
Do Until i = uBound(arrParams) + 1
curve = Rhino.SplitCurve(keep, arrParams(i)(0), True)
crv = Rhino.SplitCurve(curve(1), arrParams(i)(1), True)
Call Rhino.DeleteObject(crv(0))
keep = crv(1)
ReDim Preserve arrVal(i)
arrVal(i) = keep
i = i + 1
Loop

For i = 0 To ubound(arrVal) Step 1
Call Rhino.ObjectColor(arrVal(i), RGB(255, 0, 0))
Next
removeSegment = arrVal
End Function
Function reparameterize(strCurveID)
If Rhino.IsCurve(strCurveID) = True Then
Call rhino.SelectObject(strCurveID)
Call rhino.Command("reparameterize 0 1")
Call rhino.UnselectAllObjects()
End If
If Rhino.IsSurface(strCurveID) = True Then
Call rhino.SelectObject(strCurveID)
Call rhino.Command("reparameterize 0 1 0 1")
Call rhino.UnselectAllObjects()
End If
End Function