forked from mcneel/MOVED-rhinoscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnnotateCurveEndPoints.rvb
35 lines (29 loc) · 1.24 KB
/
AnnotateCurveEndPoints.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
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' AnnotateCurveEndPoints.rvb -- May 2012
' 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
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Subroutine: AnnotateCurveEndPoints
' Purpose: Annotates the endpoints of curve objects. If the curve is closed
' then only the starting point is annotated.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub AnnotateCurveEndPoints
Const rhObjectCurve = 4
Dim strObject, arrPoint
' Get the curve object
strObject = Rhino.GetObject("Select curve", rhObjectCurve)
If IsNull(strObject) Then Exit Sub
' Add the first annotation
arrPoint = Rhino.CurveStartPoint(strObject)
Rhino.AddPoint arrPoint
Rhino.AddTextDot Rhino.Pt2Str(arrPoint, 3), arrPoint
' Add the second annotation if necessary
If Not Rhino.IsCurveClosed(strObject) Then
arrPoint = Rhino.CurveEndPoint(strObject)
Rhino.AddPoint arrPoint
Rhino.AddTextDot Rhino.Pt2Str(arrPoint, 3), arrPoint
End If
End Sub