Adds a NURBS curve object to the document.
rhinoscriptsyntax.AddNurbsCurve (points, knots, degree, weights=None )
rhinoscript.curve.AddNurbsCurve (points, knots, degree, weights=None )
points |
Required. A list of 3-D control points. |
knots |
Required. List. The knot values for the curve. The number of elements in knots must equal the number of elements in points plus degree minus one (1). |
degree |
Required. Number. The degree of the curve. The degree must be greater than or equal to one (1). |
weights |
Optional. List. The weight values for the curve. The number of elements in weights equal the number of elements in points. Weight values must be greater than zero (0). |
Guid |
The identifier of the new object if successful. |
None |
If not successful, or on error. |
import rhinoscriptsyntax as rs
curve_id = rs.GetObject("Pick a curve", rs.filter.curve)
if curve_id:
points = rs.CurvePoints(curve_id)
knots = rs.CurveKnots(curve_id)
degree = rs.CurveDegree(curve_id)
newcurve = rs.AddNurbsCurve( points, knots, degree)
if newcurve: rs.SelectObject(newcurve)