Site Tools


Print Surface Control Points

RhinoScript

Summary: How to print the location of a surface's control points.

RhinoScript's SurfacePoints method returns a single-dimensional array of control point locations of a surface object. Because the array is single-dimensional, it is not obvious how to identify individual control point locations.

The following script demonstrates how to identify individual control point locations.

 Option Explicit
 
 Sub PrintSurfacePoints
 
 Dim strSurface
 strSurface = Rhino.GetObject("Select surface", 8)
 If IsNull(strSurface) Then Exit Sub  
 
 Dim arrPoints
 arrPoints = Rhino.SurfacePoints(strSurface)
 If Not IsArray(arrPoints) Then Exit Sub
 
 Dim arrCount
 arrCount = Rhino.SurfacePointCount(strSurface)
 
 Dim u, v
 Dim ulast : ulast = arrCount(0)
 Dim vlast : vlast = arrCount(1)
 Dim i : i = 0
 
 For u = 0 To ulast - 1
   For v = 0 To vlast - 1
     Rhino.Print "CV[" & CStr(u) & "," & CStr(v) & "] = " _ 
           & Rhino.Pt2Str(arrPoints(i), 3)
     i = i + 1
   Next
 Next
 
 End Sub
developer/scriptsamples/printsurfacepoints.txt ยท Last modified: 2015/09/14 (external edit)