Sunday, September 30, 2007

Newbie's struggle

Inspired from the script Sky wrote last night, I would like to write a script that lets user select many curves and decides the min. length to keep, and deletes shorter-than-the-min. curves. My struggle is that CurveLength (script method) seems to evaluate only ONE curve at a time. If someone know how to do it better, please let me know. array still confuses me.


Option Explicit

EvaluateCurve ()
Sub EvaluateCurve ()

Call Rhino.AddLayer ("Curve")

Dim strCurve, intShort
intShort = Rhino.GetReal ("min. length to keep?", 0.1)
strCurve = Rhino.GetObject ("select a curve to evaluate", 4)

If Rhino.CurveLength (strCurve) > intShort Then
Call Rhino.ObjectLayer (strCurve, "Curve")
Else
Call Rhino.DeleteObject (strCurve)
End If

End Sub