McNeel Wiki
Adding Points at Curve Endpoints
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

中文(简体)

 
.
DeveloperRhinoScript
VersionRhino 4.0
SummaryDemonstrates how to add point at the starting and ending locations of curves.

Quesion

I am looking for a script or help in writing a script that will place points on all the curve end points in a scene (i.e. 5,000 curves, 10,000 end points). Any ideas?

Answer

The following script should do the job:

  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
rename · changes · history · subscriptions · lost and found · references · file upload