AddNurbsSurface

Adds a NURBS surface object to the document.

Syntax

rhinoscriptsyntax.AddNurbsSurface (point_count, points, knots_u, knots_v, degree, weights=None)

rhinoscript.surface.AddNurbsSurface (point_count, points, knots_u, knots_v, degree, weights=None)

Parameters

point_count

Required.  List.  The number of control points in the U and V directions.

points

Required.  List.  A list of 3-D control points.

knots_u

Required.  List.  The knot values for the surface in the U direction.  The array must contain point_count[0] + degree[0] - 1 elements.

knots_v

Required.  List.  The knot values for the surface in the U direction.  The array must contain point_count[1] + degree[1] - 1 elements.

degree

Required.  List.  The degree of the surface in the U and V directions.  The degree in each direction must be greater than or equal to one (1).

weights

Optional.  List.  The weight values for the surface.  The number of elements in weights equal the number of elements in points.  Weight values must be greater than zero (0).

Returns

Guid

The identifier of the new object if successful.

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

obj = rs.GetObject("Pick a surface", rs.filter.surface)

if obj:

    point_count = rs.SurfacePointCount(obj)

    points = rs.SurfacePoints(obj)

    knots = rs.SurfaceKnots(obj)

    degree = rs.SurfaceDegree(obj)

    if rs.IsSurfaceRational(obj):

        weights = rs.SurfaceWeights(obj)

        obj = rs.AddNurbsSurface(point_count, points, knots[0], knots[1], degree, weights)

    else:

        obj = rs.AddNurbsSurface(point_count, points, knots[0], knots[1], degree)

    if obj: rs.SelectObject(obj)

Also See

IsSurfaceRational

SurfaceDegree

SurfaceKnotCount

SurfaceKnots

SurfacePointCount

SurfacePoints

SurfaceWeights