forked from mcneel/rhino-developer-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvaluateCurve.rvb
35 lines (26 loc) · 1002 Bytes
/
EvaluateCurve.rvb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' EvaluateCurve.rvb -- December 2003
' If this code works, it was written by Dale Fugier.
' If not, I don't know who wrote it.
' Works with Rhino 4.0.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Sub EvaluateCurve()
Dim crv, pt, t, der, res, msg, i
crv = Rhino.GetObject("Select curve to evaluate", 4, True)
If (VarType(crv) <> vbString) Then Exit Sub
pt = Rhino.GetPointOnCurve(crv, "Point to evaluate")
If Not IsArray(pt) Then Exit Sub
der = Rhino.GetInteger("Number of derivatives to evaluate", 1, 1)
If Not IsNumeric(der) Then Exit Sub
t = Rhino.CurveClosestPoint(crv, pt)
res = Rhino.CurveEvaluate(crv, t, der)
If Not IsArray(res) Then
Rhino.Print "Failed to evalute curve."
Exit Sub
End If
For i = 0 To UBound(res)
msg = msg & CStr(i) & " = " & Rhino.Pt2Str(res(i), 6) & VbCrLf
Next
MsgBox msg, vbOKOnly, "Derivate = " & CStr(der)
End Sub