M_Rhino_Geometry_NurbsCurve_Create - mcneel/rhinocommon-api-docs GitHub Wiki

NurbsCurve.Create Method

Constructs a 3D NURBS curve from a list of control points.

Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll) Version: Rhino 6.0

Syntax

C#

public static NurbsCurve Create(
	bool periodic,
	int degree,
	IEnumerable<Point3d> points
)

VB

Public Shared Function Create ( 
	periodic As Boolean,
	degree As Integer,
	points As IEnumerable(Of Point3d)
) As NurbsCurve

Parameters

 

periodic
Type: System.Boolean
If true, create a periodic uniform curve. If false, create a clamped uniform curve.
degree
Type: System.Int32
(>=1) degree=order-1.
points
Type: System.Collections.Generic.IEnumerable(Point3d)
control vertex locations.

Return Value

Type: NurbsCurve
new NURBS curve on success null on error.

Examples

VB

Partial Class Examples
  Public Shared Function AddNurbsCurve(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result
    Dim points As New Rhino.Collections.Point3dList(5)
    points.Add(0, 0, 0)
    points.Add(0, 2, 0)
    points.Add(2, 3, 0)
    points.Add(4, 2, 0)
    points.Add(4, 0, 0)
    Dim nc As Rhino.Geometry.NurbsCurve = Rhino.Geometry.NurbsCurve.Create(False, 3, points)
    Dim rc As Rhino.Commands.Result = Rhino.Commands.Result.Failure
    If nc IsNot Nothing AndAlso nc.IsValid Then
      If doc.Objects.AddCurve(nc) <> Guid.Empty Then
        doc.Views.Redraw()
        rc = Rhino.Commands.Result.Success
      End If
    End If
    Return rc
  End Function
End Class

C#

using System;

partial class Examples
{
  public static Rhino.Commands.Result AddNurbsCurve(Rhino.RhinoDoc doc)
  {
    Rhino.Collections.Point3dList points = new Rhino.Collections.Point3dList(5);
    points.Add(0, 0, 0);
    points.Add(0, 2, 0);
    points.Add(2, 3, 0);
    points.Add(4, 2, 0);
    points.Add(4, 0, 0);
    Rhino.Geometry.NurbsCurve nc = Rhino.Geometry.NurbsCurve.Create(false, 3, points);
    Rhino.Commands.Result rc = Rhino.Commands.Result.Failure;
    if (nc != null && nc.IsValid)
    {
      if (doc.Objects.AddCurve(nc) != Guid.Empty)
      {
        doc.Views.Redraw();
        rc = Rhino.Commands.Result.Success;
      }
    }
    return rc;
  }
}

Python

import Rhino
import scriptcontext
import System.Guid

def AddNurbsCurve():
    points = Rhino.Collections.Point3dList(5)
    points.Add(0, 0, 0)
    points.Add(0, 2, 0)
    points.Add(2, 3, 0)
    points.Add(4, 2, 0)
    points.Add(4, 0, 0)

    nc = Rhino.Geometry.NurbsCurve.Create(False, 3, points)
    rc = Rhino.Commands.Result.Failure
    if nc and nc.IsValid:
        if scriptcontext.doc.Objects.AddCurve(nc)!=System.Guid.Empty:
            scriptcontext.doc.Views.Redraw()
            rc = Rhino.Commands.Result.Success
    return rc

if __name__=="__main__":
    AddNurbsCurve()

Version Information

Supported in: 6.0.16224.21491, 5D58w

See Also

Reference

NurbsCurve Class
Rhino.Geometry Namespace

⚠️ **GitHub.com Fallback** ⚠️