NEW: Welcome to the Rhino 6 version of this page! Looking for the older Rhino 5 version?

Add Points at Curve Endpoints

Demonstrates how to add point at the starting and ending locations of curves.

VBScript

Option Explicit

Sub AddCurveEndPoints()
  Const rhCurve = 4

  ' Get all the curve objects in the document
  Dim arrCurves
  arrCurves = Rhino.ObjectsByType(rhCurve)
  If IsNull(arrCurves) Then Exit Sub

  ' For better performance, turn off screen redrawing  
  Call Rhino.EnableRedraw(False)

  ' Process each curve       
  Dim strCurve
  For Each strCurve In arrCurves
    ' Add a point at the start of the curve
    Call Rhino.AddPoint(Rhino.CurveStartPoint(strCurve))
    ' If not closed, add a point at the end of the curve
    If Not Rhino.IsCurveClosed(strCurve) Then
      Call Rhino.AddPoint(Rhino.CurveEndPoint(strCurve))
    End If
  Next

  ' Turn screen redrawing back on  
  Call Rhino.EnableRedraw(True)
End Sub