WARNING: You're viewing the Rhino WIP version of this page! View the current version instead.

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