Python API 2.0 Reference
OpenMaya.MFnNurbsCurve Class Reference
+ Inheritance diagram for OpenMaya.MFnNurbsCurve:

Public Member Functions

def __init__ ()
 
def area ()
 
def closestPoint ()
 
def copy ()
 
def create ()
 
def createWithEditPoints ()
 
def cvPosition ()
 
def cvPositions ()
 
def cvs ()
 
def distanceToPoint ()
 
def findLengthFromParam ()
 
def findParamFromLength ()
 
def getDerivativesAtParam ()
 
def getParamAtPoint ()
 
def getPointAtParam ()
 
def isParamOnCurve ()
 
def isPointOnCurve ()
 
def knot ()
 
def knots ()
 
def length ()
 
def makeMultipleEndKnots ()
 
def normal ()
 
def removeKnot ()
 
def reverse ()
 
def setCVPosition ()
 
def setCVPositions ()
 
def setKnot ()
 
def setKnots ()
 
def tangent ()
 
def updateCurve ()
 
- Public Member Functions inherited from OpenMaya.MFnDagNode
def __init__ ()
 
def addChild ()
 
def child ()
 
def childCount ()
 
def create ()
 
def dagPath ()
 
def dagRoot ()
 
def duplicate ()
 
def fullPathName ()
 
def getAllPaths ()
 
def getConnectedSetsAndMembers ()
 
def getPath ()
 
def hasChild ()
 
def hasParent ()
 
def instanceCount ()
 
def isChildOf ()
 
def isInstanced ()
 
def isInstancedAttribute ()
 
def isParentOf ()
 
def parent ()
 
def parentCount ()
 
def partialPathName ()
 
def removeChild ()
 
def removeChildAt ()
 
def setObject ()
 
def transformationMatrix ()
 
- Public Member Functions inherited from OpenMaya.MFnDependencyNode
def __init__ ()
 
def absoluteName ()
 
def addAttribute ()
 
def addExternalContentForFileAttr ()
 
def affectsAnimation ()
 
def attribute ()
 
def attributeClass ()
 
def attributeCount ()
 
def canBeWritten ()
 
def create ()
 
def dgCallbackIds ()
 
def dgCallbacks ()
 
def dgTimer ()
 
def dgTimerOff ()
 
def dgTimerOn ()
 
def dgTimerQueryState ()
 
def dgTimerReset ()
 
def findAlias ()
 
def findPlug ()
 
def getAffectedAttributes ()
 
def getAffectingAttributes ()
 
def getAliasAttr ()
 
def getAliasList ()
 
def getConnections ()
 
def getExternalContent ()
 
def hasAttribute ()
 
def hasUniqueName ()
 
def isFlagSet ()
 
def isNewAttribute ()
 
def isTrackingEdits ()
 
def name ()
 
def plugsAlias ()
 
def removeAttribute ()
 
def reorderedAttribute ()
 
def setAffectsAnimation ()
 
def setAlias ()
 
def setDoNotWrite ()
 
def setExternalContent ()
 
def setExternalContentForFileAttr ()
 
def setFlag ()
 
def setName ()
 
def setUuid ()
 
def uniqueName ()
 
def userNode ()
 
def uuid ()
 
- Public Member Functions inherited from OpenMaya.MFnBase
def __init__ ()
 
def hasObj ()
 
def object ()
 
def setObject ()
 
def type ()
 

Static Public Member Functions

def __new__ ()
 
- Static Public Member Functions inherited from OpenMaya.MFnDagNode
def __new__ ()
 
- Static Public Member Functions inherited from OpenMaya.MFnDependencyNode
def __new__ ()
 
def allocateFlag ()
 
def classification ()
 
def deallocateAllFlags ()
 
def deallocateFlag ()
 
- Static Public Member Functions inherited from OpenMaya.MFnBase
def __new__ ()
 

Static Public Attributes

int kClosed = 2
 
int kFindParamTolerance = 1
 
int kInvalid = 0
 
int kLast = 4
 
int kOpen = 1
 
int kPeriodic = 3
 
float kPointTolerance = 0.001
 
- Static Public Attributes inherited from OpenMaya.MFnDagNode
int kNextPos = 255
 
- Static Public Attributes inherited from OpenMaya.MFnDependencyNode
int kTimerMetrics = 9
 
int kTimerTypes = 3
 
int kExtensionAttr = 3
 
int kInvalidAttr = 4
 
int kLocalDynamicAttr = 1
 
int kNormalAttr = 2
 
int kTimerInvalidState = 3
 
int kTimerOff = 0
 
int kTimerOn = 1
 
int kTimerUninitialized = 2
 
int kTimerMetric_callback = 0
 
int kTimerMetric_callbackNotViaAPI = 6
 
int kTimerMetric_callbackViaAPI = 5
 
int kTimerMetric_compute = 1
 
int kTimerMetric_computeDuringCallback = 7
 
int kTimerMetric_computeNotDuringCallback = 8
 
int kTimerMetric_dirty = 2
 
int kTimerMetric_draw = 3
 
int kTimerMetric_fetch = 4
 
int kTimerType_count = 2
 
int kTimerType_inclusive = 1
 
int kTimerType_self = 0
 

Properties

 degree = property(...)
 
 form = property(...)
 
 hasHistoryOnCreate = property(...)
 
 isPlanar = property(...)
 
 knotDomain = property(...)
 
 numCVs = property(...)
 
 numKnots = property(...)
 
 numSpans = property(...)
 
 planeNormal = property(...)
 
- Properties inherited from OpenMaya.MFnDagNode
 boundingBox = property(...)
 
 inModel = property(...)
 
 inUnderWorld = property(...)
 
 isInstanceable = property(...)
 
 isIntermediateObject = property(...)
 
 objectColor = property(...)
 
 objectColorRGB = property(...)
 
 objectColorType = property(...)
 
 useObjectColor = property(...)
 
- Properties inherited from OpenMaya.MFnDependencyNode
 isDefaultNode = property(...)
 
 isFromReferencedFile = property(...)
 
 isLocked = property(...)
 
 isShared = property(...)
 
 namespace = property(...)
 
 pluginName = property(...)
 
 typeId = property(...)
 
 typeName = property(...)
 

Detailed Description

NURBS (Non-Uniform Rational B-Spline) curve function set.

The shape of a NURBS curve is defined by an array of CVs
(control vertices), an array of knot values, a degree, and a
form.  There are 3 possible 'forms' for the curve: open,
closed and periodic.

The open and closed forms are quite similar, and in fact a
closed curve will become an open curve if either the first
or last CV is moved so that they are no longer coincident.
To create an open or closed curve of degree N with M spans,
you must provide M+N CVs.  This implies that for a degree N
curve, you must specify at least N+1 CVs to get a curve with
a single span.

The number of knots required for a curve is M + 2N - 1. If
you want the curve to start exactly at the first CV and end
exactly at the last CV, then the knot vector must be
structured to have degree N 'multiplicity' at the beginning
and end.  This means that the first N knots must be
identical, and the last N knots must be identical.

A periodic curve is a special case of a closed curve.
Instead of having just the first and last CVs coincident,
the last N CVs in the curve must overlap the first N CVs.
This results in a curve with no tangent break at the seam
where the ends meet.  The last N CVs in a periodic curve are
permanently bound to the first N CVs, and Maya will not
allow those last N CVs to be repositioned.  If one or more
of the first N CVs of the curve are repositioned, the
overlapping CV's will remain bound, and will also be moved.

In order to create a periodic curve, you must specify at
least 2N+1 CVs, so that that last N can overlap the first N
and you still have 1 non-overlapping CV left.  The number of
CVs required to create a periodic curve is still N+M (with a
lower limit of 2N+1), but you must ensure that the positions
of the last N CVs are identical to the positions of the
first N.

You still need M + 2N - 1 knots for a periodic curve, but
the knot values required are more restrictive than for open
or closed curves because of the overlap at the ends, The
difference between the first N pairs of knots values should
be equal to the difference between the last N pairs.
Additionally there can be no knot multiplicity at the ends
of the curve, because that would compromise the tangent
continuity property. So an example knot sequence could begin
with knots at { -(N-2), -(N-1), ... , 0}.

Note that some third party applications use a different
format for knots, where the number of knots required for a
curve is M+2N+1 rather than M+2N-1 as used in Maya. Both
knot representations are equivalent mathematically. To
convert from one of these external representations into the
Maya representation, simply omit the first and last knots
from the external representation when creating the Maya
representation. To convert from the Maya representation into
the external representation, add two new knots at the
beginning and end of the Maya knot sequence. The value of
these new knots depends on the existing knot sequence. For a
knot sequence with multiple end knots, simply duplicate the
existing first and last knots once more, for example:

Maya representation: {0,0,0,...,N,N,N}
External representation: {0,0,0,0,...,N,N,N,N}

For a knot sequence with uniform end knots, create the new
knots offset at an interval equal to the existing first and
last knot intervals, for example:

Maya representation: {0,1,2,...,N,N+1,N+2}
External representation: {-1,0,1,2,...,N,N+1,N+2,N+3}

Method resolution order:
-   MFnNurbsCurve
-   MFnDagNode
-   MFnDependencyNode
-   MFnBase
-   builtins.object

Constructor & Destructor Documentation

def OpenMaya.MFnNurbsCurve.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMaya.MFnNurbsCurve.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMaya.MFnNurbsCurve.area ( )
area(tolerance=kPointTolerance) -> float

Returns the area bounded by the curve. The curve must be closed and
planar. A value of 0.0 will be returned if area cannot be determined.

* tolerance (float) - Amount of error allowed in the calculation
def OpenMaya.MFnNurbsCurve.closestPoint ( )
closestPoint(testPoint, guess=None, tolerance=kPointTolerance,
    space=kObject) -> (MPoint, float)

Returns a tuple containing the point on the curve which is closest
to 'testPoint', and the parameter value at which that point occurs.

* testPoint (MPoint) - point to get closest to
* guess      (float) - a guess as to roughly where on the curve the
           closest point will be. If the guess is in the
           correct span than it can significantly speed
           up the search. If not then it may slow down
           the search a bit. If no guess is supplied
           then the search will begin at the start of
           the curve.
* tolerance  (float) - maximum allowed distance between the curve
           and the returned point.
* space (MSpace constant) - coordinate space to use for the points
def OpenMaya.MFnNurbsCurve.copy ( )
copy(source, parent=MObject.kNullObj) -> MObject

Returns a new NURBS curve which is a copy of 'source' and resets
the functionset to operate on it.

* parent (MObject)
 - the parent/owner of the new curve. If it's a NURBS
   curve data wrapper (MFn.kNurbsCurveData) then the
   created curve will be returned as a geometry object
   (MFn.kNurbsCurveGeom) owned by the wrapper. If
   'parent' is a DAG node then the new curve will be
   returned as nurbsCurve node parented under it. If
   'parent' is not provided then a new top-level
   transform will be created with the new curve parented
   beneath it as a nurbsCurve node. In this last case it
   will be the transform node which is returned.
def OpenMaya.MFnNurbsCurve.create ( )
create(cvs, knots, degree, form, is2D, rational, parent=kNullObj)
    -> self
create(subCurves, parent=kNullObj) -> self

Returns a newly created curve and resets the functionset to operate
on it. The first version creates the curve based on the control
vertices and knots provided while the second creates the curve as a
copy of the provided subCurves, all joined together.

* cvs (MPointArray or seq of MPoint)
 - positions of the control vertices
* knots (MDoubleArray seq of float)
 - parameter values of the knots. There must be
   (# spans + 2*degree - 1) knots provided and they must
   appear in non-decreasing order.
* degree (int) - degree of the curve to create
* form (int) - one of kOpen, kClosed or kPeriodic
* is2d (bool)- if True the Z-coordinates of 'cvs' will be ignored,
   giving a curve in the local XY plane.
* rational (bool)
 - set True if you want the new curve to be rational
* parent (MObject)
 - the parent/owner of the new curve. If it's a NURBS
   curve data wrapper (MFn.kNurbsCurveData) then the
   created curve will be returned as a geometry object
   (MFn.kNurbsCurveGeom) owned by the wrapper. If
   'parent' is a DAG node then the new curve will be
   returned as nurbsCurve node parented under it. If
   'parent' is not provided then a new top-level
   transform will be created with the new curve parented
   beneath it as a nurbsCurve node. In this last case it
   will be the transform node which is returned.
* subCurves (MObjectArray or seq of MObject)
 - array of curves from which the new curve will be built
   The curves must all be in the same direction, must not
   intersect themselves or each other, the start of each
   curve in the array must be coincident with the end of
   the previous curve in the array, and the curves must be
   be at least C0 continuous (i.e. tangent breaks are okay).
def OpenMaya.MFnNurbsCurve.createWithEditPoints ( )
createWithEditPoints(eps, degree, form, is2D, rational, uniform,
    parent=kNullObj) -> MObject

Returns a new curve based on the given edit points (i.e. points
which lie on the curve) and resets the functionset to operate on it.

* eps (MPointArray or seq of MPoint)
 - positions of the edit points
* degree (int) - degree of the curve to create
* form (int) - one of kOpen, kClosed or kPeriodic
* is2d (bool)- if True the Z-coordinates of 'eps' will be ignored,
   giving a curve in the local XY plane.
* rational (bool)
 - set True if you want the new curve to be rational
* uniform (bool)
 - if True then parameter values of the knots will be
   uniformly spaced, otherwise they will be based on
   chord length.
* parent (MObject)
 - the parent/owner of the new curve. If it's a NURBS
   curve data wrapper (MFn.kNurbsCurveData) then the
   created curve will be returned as a geometry object
   (MFn.kNurbsCurveGeom) owned by the wrapper. If
   'parent' is a DAG node then the new curve will be
   returned as nurbsCurve node parented under it. If
   'parent' is not provided then a new top-level
   transform will be created with the new curve parented
   beneath it as a nurbsCurve node. In this last case it
   will be the transform node which is returned.
def OpenMaya.MFnNurbsCurve.cvPosition ( )
cvPosition(index, space=kObject) -> MPoint

Returns the position of a single control vertex.

* index (int) - index of the CV to return
* space (int) - an MSpace constant giving the coordinate space in
    which the point is given
def OpenMaya.MFnNurbsCurve.cvPositions ( )
cvPositions(space=kObject) -> MPointArray

Returns the positions of all of the curve's control vertices.

* space (int) - an MSpace constant giving the coordinate space in
    which the point is given
def OpenMaya.MFnNurbsCurve.cvs ( )
cvs(startIndex[, endIndex]) -> MObject

Returns a CV or a range of CVs as a component. MItCurveCV can be
used to examine or modify the CVs in the component. Any modifications
made to them will affect the curve. After all modifications are done,
updateCurve() should be called to have the curve recalculate its
cached geometry.

* startIndex (int) - start of the range of CVs to return.
* endIndex   (int) - end of the range of CVs to return. If not
         provided then only the CV specified by
         startIndex will be returned.
def OpenMaya.MFnNurbsCurve.distanceToPoint ( )
distanceToPoint(point, space=kObject) -> float

Returns the distance from the given point to the point on the curve
which is closest to it.

* point (MPoint) - the point to calculate the distance to
* space (int)    - an MSpace constant giving the coordinate space in
       which the point is given
def OpenMaya.MFnNurbsCurve.findLengthFromParam ( )
findLengthFromParam(param) -> float

Returns the length along the curve corresponding to a given
parameter value on the curve. If the length cannot be found for
the given parameter value then a length of zero is returned.

* param (float) - parameter value on the curve
def OpenMaya.MFnNurbsCurve.findParamFromLength ( )
findParamFromLength(length, tolerance=kFindParamTolerance) -> float

Returns the parameter value corresponding to a given length along
the curve. If the parameter value cannot be determined then the value
for the end point of the curve is returned.

* length (float) - distance along the curve
* tolerance (float) - search tolerance
def OpenMaya.MFnNurbsCurve.getDerivativesAtParam ( )
getDerivativesAtParam(param, space=kObject) -> (MPoint, MVector[, MVector])

Evaluates the curve at the given parameter value, returning a tuple
containing the position and first derivative at that value. If 'dUU'
is True then the returned tuple will include the second derivative
as well as its third element.

* param (float) - parameter value at which to do the evaluation
* space   (int) - an MSpace constant giving the coordinate space in
      which the point is given
* dUU    (bool) - if True include the second derivative in the result.
def OpenMaya.MFnNurbsCurve.getParamAtPoint ( )
getParamAtPoint(point, tolerance=kPointTolerance, space=kObject) -> float

Returns the parameter value corresponding to the given point on the
curve.

* point    (MPoint) - point on curve.
* tolerance (float) - max distance 'point' can be from the curve and
          still be considered to lie on it.
* space       (int) - an MSpace constant giving the coordinate space
          in which the point is given
def OpenMaya.MFnNurbsCurve.getPointAtParam ( )
getPointAtParam(param, space=kObject) -> MPoint

Returns the point on the curve at the given parameter value.

* param (float) - parameter value at which to find the point
* space   (int) - an MSpace constant giving the coordinate space in
      which the point should be returned
def OpenMaya.MFnNurbsCurve.isParamOnCurve ( )
isParamOnCurve(param) -> bool

Returns True if the given parameter value lies on the curve (i.e. is
within the curve's knot domain), False otherwise.

* param (float) - parameter value to test
def OpenMaya.MFnNurbsCurve.isPointOnCurve ( )
isPointOnCurve(point, tolerance=kPointTolerance, space=kObject) -> bool

Returns True if the given point lies on the curve, False otherwise.

* point    (MPoint) - point to test.
* tolerance (float) - max distance 'point' can be from the curve and
          still be considered to lie on it.
* space       (int) - an MSpace constant giving the coordinate space
          in which the point is given
def OpenMaya.MFnNurbsCurve.knot ( )
knot(index) -> float

Returns the parameter value of a single knot.

* index (int) - index of the knot to return. These range from 0 to
    (numKnots - 1)
def OpenMaya.MFnNurbsCurve.knots ( )
knots() -> MDoubleArray

Returns the parameter values for all of the curve's knots.
def OpenMaya.MFnNurbsCurve.length ( )
length(tolerance=kPointTolerance) -> float

Returns the arc length of this curve or 0.0 if it cannot be computed.

* tolerance (float) - max error allowed in the calculation.
def OpenMaya.MFnNurbsCurve.makeMultipleEndKnots ( )
makeMultipleEndKnots() -> self

Sets the curve's end knots to have full multiplicity. This ensures
that the end points interpolate the first and last CVs (i.e. lie
directly on them). It can also be used to convert a periodic curve
to a closed curve.
def OpenMaya.MFnNurbsCurve.normal ( )
normal(param, space=kObject) -> MVector

Returns the normal at the given parameter value on the curve. For
degree 1 curves the normal is the vector at right angles to the
curve that lies in the average plane of the curve. For higher degrees
the normal is defined by the local curvature at the parameter.

* param (float) - parameter value at which to find the normal
* space   (int) - an MSpace constant giving the coordinate space in
      which the normal should be returned
def OpenMaya.MFnNurbsCurve.removeKnot ( )
removeKnot(param, removeAll=False) -> self

Removes one or more knots at the given parameter value.

If there are multiple knots at the parameter value then 'removeAll'
determines which ones will be removed. If it is True then they will
all be removed. If it is False then all but one will be removed.

* param     (float) - parameter of the knot
* removeAll  (bool) - how to handle multiple knots at the same param
def OpenMaya.MFnNurbsCurve.reverse ( )
reverse() -> self

Reverses the direction of the curve.
def OpenMaya.MFnNurbsCurve.setCVPosition ( )
setCVPosition(index, point, space=kObject) -> self

Sets the position of a single control vertex of the curve.

* index    (int) - index of the cv
* point (MPoint) - new position for the cv
* space    (int) - an MSpace constant giving the coordinate space
       in which the point is given
def OpenMaya.MFnNurbsCurve.setCVPositions ( )
setCVPositions(points, space=kObject) -> self

Sets the positions of all of the curve's control vertices.

* points (MPointArray or seq of MPoint)
   - the points to be set. The array/sequence must
     contain exactly the same number of points as the
     curve has control vertices.
* space  (int) - an MSpace constant giving the coordinate space
     in which the points are given
def OpenMaya.MFnNurbsCurve.setKnot ( )
setKnot(index, param) -> self

Sets the parameter value of a single knot.
* index   (int) - index of the knot
* param (float) - new parameter value for the knot
def OpenMaya.MFnNurbsCurve.setKnots ( )
setKnots(params, startIndex, endIndex) -> self

Sets the parameter values of a contiguous group of knots.

* params (MDoubleArray of seq of float)
       - the parameter values to set, one per knot in
         the range
* startIndex (int) - first knot in the range to be set
* endIndex   (int) - last knot in the range to be set
def OpenMaya.MFnNurbsCurve.tangent ( )
tangent(param, space=kObject) -> MVector

Returns the normalized tangent vector at the given parameter value
on the curve.

* param (float) - parameter value at which to find the tangent
* space   (int) - an MSpace constant giving the coordinate space in
      which the tangent should be returned
def OpenMaya.MFnNurbsCurve.updateCurve ( )
updateCurve() -> self

Tells the shape node which represents the curve in the scene, if
any, that the curve has changed and needs to be redrawn.

Property Documentation

OpenMaya.MFnNurbsCurve.degree = property(...)
static
 The degree of the curve or 0 if the degree cannot be determined.
OpenMaya.MFnNurbsCurve.form = property(...)
static
 The form of the curve: kOpen, kClosed, kPeriodic or kInvalid
OpenMaya.MFnNurbsCurve.hasHistoryOnCreate = property(...)
static
 True if the curve was created with history.
OpenMaya.MFnNurbsCurve.isPlanar = property(...)
static
 True if the curve is planar.
OpenMaya.MFnNurbsCurve.knotDomain = property(...)
static
 A tuple containing a pair of floats corresponding to the maximum and
 minimum parameter values for this curve.
OpenMaya.MFnNurbsCurve.numCVs = property(...)
static
 Number of CVs in the curve or 0 if the number of CVs cannot be
 determined.
OpenMaya.MFnNurbsCurve.numKnots = property(...)
static
 Number of knots in the curve or 0 if the number of knots cannot be
 determined.
OpenMaya.MFnNurbsCurve.numSpans = property(...)
static
 Number of spans in the curve or 0 if the number of spans cannot be
 determined.
OpenMaya.MFnNurbsCurve.planeNormal = property(...)
static
 MVector of the normal to the plane of the curve, if the curve is
 planar, or None if the curve is not planar.