pymel.core.nodetypes.NurbsCurve¶
digraph inheritance936a4ce2dc { rankdir=TB; ranksep=0.15; nodesep=0.15; size="8.0, 12.0"; "ContainerBase" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="pymel.core.nodetypes.ContainerBase.html#pymel.core.nodetypes.ContainerBase",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "DependNode" -> "ContainerBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CurveShape" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="pymel.core.nodetypes.CurveShape.html#pymel.core.nodetypes.CurveShape",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "DeformableShape" -> "CurveShape" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DagNode" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="pymel.core.nodetypes.DagNode.html#pymel.core.nodetypes.DagNode",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "Entity" -> "DagNode" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DeformableShape" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="pymel.core.nodetypes.DeformableShape.html#pymel.core.nodetypes.DeformableShape",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "GeometryShape" -> "DeformableShape" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DependNode" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="pymel.core.nodetypes.DependNode.html#pymel.core.nodetypes.DependNode",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "PyNode" -> "DependNode" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Entity" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="pymel.core.nodetypes.Entity.html#pymel.core.nodetypes.Entity",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "ContainerBase" -> "Entity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GeometryShape" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="pymel.core.nodetypes.GeometryShape.html#pymel.core.nodetypes.GeometryShape",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "Shape" -> "GeometryShape" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NurbsCurve" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="#pymel.core.nodetypes.NurbsCurve",style="setlinewidth(0.5)",tooltip="class counterpart of mel function `curve`",height=0.25,shape=box,fontsize=8]; "CurveShape" -> "NurbsCurve" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ProxyUnicode" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="../pymel.util.utilitytypes/pymel.util.utilitytypes.ProxyUnicode.html#pymel.util.utilitytypes.ProxyUnicode",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "PyNode" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="../pymel.core.general/pymel.core.general.PyNode.html#pymel.core.general.PyNode",style="setlinewidth(0.5)",tooltip="Abstract class that is base for all pymel nodes classes.",height=0.25,shape=box,fontsize=8]; "ProxyUnicode" -> "PyNode" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Shape" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="pymel.core.nodetypes.Shape.html#pymel.core.nodetypes.Shape",style="setlinewidth(0.5)",height=0.25,shape=box,fontsize=8]; "DagNode" -> "Shape" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
- class NurbsCurve(*args, **kwargs)¶
class counterpart of mel function curve
The curve command creates a new curve from a list of control vertices (CVs). A string is returned containing the pathname to the newly created curve. You can create a curve from points either in world space or object (local) space, either with weights or without. You can replace an existing curve by using the -r/replaceflag. You can append a point to an existing curve by using the -a/appendflag. To create a curve-on-surface, use the curveOnSurface command. To change the degree of a curve, use the rebuildCurve command. To change the of parameter range curve, use the rebuildCurve command.
- Form = Enum( EnumValue('Form', 0, 'invalid'), EnumValue('Form', 1, 'open'), EnumValue('Form', 2, 'closed'), EnumValue('Form', 3, 'periodic'), EnumValue('Form', 4, 'last'))¶
- area(tolerance=0.001)¶
This method returns the area bounded by this curve. The curve must be closed and planar.
Parameters: - tolerance : float
The amount of error (epsilon value) in the calculation
Return type: float
Derived from api method maya.OpenMaya.MFnNurbsCurve.area
- closestPoint(toThisPoint, param=None, tolerance=0.001, space='preTransform')¶
This method determines the closest point on the curve to the given point.
Parameters: - toThisPoint : Point
The point to test
- param : float
If non-null, on successful returns this will contain the parameter value of the returned point.
- tolerance : float
The amount of error (epsilon value) to allow in the calculation
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: Point
Derived from api method maya.OpenMaya.MSpace.closestPoint
- copy(source, parentOrOwner='MObject::kNullObj')¶
This method creates a copy of a nurbs curve.
Parameters: - source : PyNode
the curve to be copied
- parentOrOwner : PyNode
the DAG parent or kNurbsCurveData the new curve will belong to
Return type: PyNode
Derived from api method maya.OpenMaya.MFnNurbsCurve.copy
- createWithEditPoints(editPoints, degree, form, create2D, createRational, uniformParam, parentOrOwner='MObject::kNullObj')¶
This method creates a nurbs curve from the given edit points and sets this function set to operate on the new curve.
Parameters: - editPoints : Point list
an array of edit points
- degree : int
the degree to create the curve with
- form : NurbsCurve.Form
either kOpen, kClosed, kPeriodic
values: ‘open’, ‘closed’, ‘periodic’
- create2D : bool
true means that the Z-coordinates of the controlVertices will be ignored, giving a curve in the local XY plane
- createRational : bool
true means curve being created will be rational
- uniformParam : bool
true means curve being created will have uniform parameterization, false means chord length
- parentOrOwner : PyNode
the DAG parent or kNurbsCurveData the new curve will belong to
Return type: PyNode
Derived from api method maya.OpenMaya.MFnNurbsCurve.createWithEditPoints
- cvs(startIndex, endIndex)¶
Returns a contiguous group of CVs as a component. MItCurveCV can be used to examine or modify the returned CVs.
Parameters: - startIndex : int
the start index for the CVs to return
- endIndex : int
the end index for the CVs to return
Return type: PyNode
Derived from api method maya.OpenMaya.MFnNurbsCurve.cvs
- degree()¶
Return the degree of this curve. If the degree cannot be determined then 0 is returned.
Return type: int Derived from api method maya.OpenMaya.MFnNurbsCurve.degree
- distanceToPoint(pt, space='preTransform')¶
Returns the distance from the given point to the point on the curve which is closest to it.
Parameters: - pt : Point
The point to calculate the distance to
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: float
Derived from api method maya.OpenMaya.MSpace.distanceToPoint
- findParamFromLength(partLength)¶
Returns the parameter value corresponding to a given length along the curve. If the parameter value cannot be found for the given length then ReturnStatus is set to kInvalidParameter and the parameter for the end point of the curve is returned.
Parameters: - partLength : float
Length along the curve to find parameter value at
Return type: float
Derived from api method maya.OpenMaya.MFnNurbsCurve.findParamFromLength
- form()¶
This method returns the form of the curve. The curve can be open, closed, or periodic.
Return type: NurbsCurve.Form Derived from api method maya.OpenMaya.MFnNurbsCurve.form
- getCV(index, space='preTransform')¶
Get the CV at the given index.
Parameters: - index : int
The index of the CV that will be retrieved
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: Point
Derived from api method maya.OpenMaya.MSpace.getCV
- getCVs(space='preTransform')¶
Get the positions of the CVs of this curve. The returned group can be accessed via the MPointArray class. Any modifications to these CVs will not affect this curve. setCVs should be called to modify the original curve. updateCurve should be called to cause the curve to redraw itself.
Parameters: - space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: Point list
Derived from api method maya.OpenMaya.MSpace.getCVs
- getDerivativesAtParm(param, space)¶
Evaluate the curve at the given parameter returning the position, first derivative and optionally the second derivative. Derivatives are not normalized.
Parameters: - param : float
U parameter value to evaluate
- space : Space.Space
Coordinate space for the returned vectors
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: (Point, Vector, Vector)
Derived from api method maya.OpenMaya.MSpace.getDerivativesAtParm
- getKnot(index)¶
Get the parameter value of the specified knot for this curve. Knot indices range from 0 to numKnots() - 1
Parameters: - index : int
The knot index
Return type: float
Derived from api method maya.OpenMaya.MFnNurbsCurve.knot
- getKnotDomain()¶
Return the range corresponding to the maximum and minimum parameter values for this curve.
Return type: (float, float) Derived from api method maya.OpenMaya.MFnNurbsCurve.getKnotDomain
- getKnots()¶
This method retrieves a copy of the knot array for this curve.
Return type: float list Derived from api method maya.OpenMaya.MFnNurbsCurve.getKnots
- getParamAtPoint(atThisPoint, space='preTransform')¶
This method retrieves the parameter value corresponding to the given point on the curve.
Parameters: - atThisPoint : Point
Point to check
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: float
Derived from api method maya.OpenMaya.MSpace.getParamAtPoint
- getPointAtParam(param, space='preTransform')¶
Returns the point in space that is at the given parameter value of the curve. If the parameter value does not give a valid point on the curve, then MS::kInvalidParameter is returned.
Parameters: - param : float
The parameter value that we are examining
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: Point
Derived from api method maya.OpenMaya.MSpace.getPointAtParam
- hasHistoryOnCreate()¶
This method determines if the shape was created with history.
Return type: bool Derived from api method maya.OpenMaya.MFnNurbsCurve.hasHistoryOnCreate
- isParamOnCurve(param)¶
Determines whether the specified parameter value is within the bounds of the knot vector of this curve
Parameters: - param : float
The parameter value to check
Return type: bool
Derived from api method maya.OpenMaya.MFnNurbsCurve.isParamOnCurve
- isPlanar(planeNormal=None)¶
This method determines if this curve is a planar curve. If planeNormal is non-NULL then the normal to the plane containing this curve is returned in this location.
Parameters: - planeNormal : Vector
Normal to the plane containing this curve
Return type: bool
Derived from api method maya.OpenMaya.MFnNurbsCurve.isPlanar
- isPointOnCurve(point, tolerance=0.001, space='preTransform')¶
Determines whether the given point is on this curve.
Parameters: - point : Point
The point to test
- tolerance : float
The amount of error (epsilon value) in the calculation
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: bool
Derived from api method maya.OpenMaya.MSpace.isPointOnCurve
- length(tolerance=0.001)¶
Return the arc length of this curve or 0.0 if it cannot be computed.
Parameters: - tolerance : float
The amount of error (epsilon value) in the calculation
Return type: float
Derived from api method maya.OpenMaya.MFnNurbsCurve.length
- makeMultipleEndKnots()¶
This method gives end knots full multiplicity. This ensures the end points of the curve interpolate the first and last CVs. It can also be used to convert a periodic curve to a closed curve. Derived from api method maya.OpenMaya.MFnNurbsCurve.makeMultipleEndKnots
Undo is not currently supported for this method
- normal(param, space='preTransform')¶
This method 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 param.
Parameters: - param : float
The parameter of the point on the curve from which to get the normal
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: Vector
Derived from api method maya.OpenMaya.MSpace.normal
- numCVs(editableOnly=True)¶
Returns the number of CVs.
Parameters: - editableOnly : bool
If editableOnly evaluates to True (default), then this will return the number of cvs that can be actually edited (and also the highest index that may be used for cv’s - ie, if
myCurve.numCVs(editableOnly=True) == 4- then allowable cv indices go from
- myCurve.cv[0] to mySurf.cv[3]
If editablyOnly is False, then this will return the underlying number of cvs used to define the mathematical curve - degree + numSpans.
These will only differ if the form is ‘periodic’, in which case the editable number will be numSpans (as the last ‘degree’ cv’s are ‘locked’ to be the same as the first ‘degree’ cvs). In all other cases, the number of cvs will be degree + numSpans.
Examples: >>> from pymel.core import * >>> # a periodic curve >>> myCurve = curve(name='periodicCurve1', d=3, periodic=True, k=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), pw=[(4, -4, 0, 1), (5.5, 0, 0, 1), (4, 4, 0, 1), (0, 5.5, 0, 1), (-4, 4, 0, 1), (-5.5, 0, 0, 1), (-4, -4, 0, 1), (0, -5.5, 0, 1), (4, -4, 0, 1), (5.5, 0, 0, 1), (4, 4, 0, 1)] ) >>> myCurve.cv NurbsCurveCV(u'periodicCurveShape1.cv[0:7]') >>> myCurve.numCVs() 8 >>> myCurve.numCVs(editableOnly=False) 11 >>> >>> # an open curve >>> myCurve = curve(name='openCurve1', d=3, periodic=False, k=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), pw=[(4, -4, 0, 1), (5.5, 0, 0, 1), (4, 4, 0, 1), (0, 5.5, 0, 1), (-4, 4, 0, 1), (-5.5, 0, 0, 1), (-4, -4, 0, 1), (0, -5.5, 0, 1), (4, -4, 0, 1), (5.5, 0, 0, 1), (4, 4, 0, 1)] ) >>> myCurve.cv NurbsCurveCV(u'openCurveShape1.cv[0:10]') >>> myCurve.numCVs() 11 >>> myCurve.numCVs(editableOnly=False) 11
Return type: int
- numEPs(editableOnly=True)¶
Returns the number of EPs.
Examples: >>> from pymel.core import * >>> # a periodic curve >>> myCurve = curve(name='periodicCurve2', d=3, periodic=True, k=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), pw=[(4, -4, 0, 1), (5.5, 0, 0, 1), (4, 4, 0, 1), (0, 5.5, 0, 1), (-4, 4, 0, 1), (-5.5, 0, 0, 1), (-4, -4, 0, 1), (0, -5.5, 0, 1), (4, -4, 0, 1), (5.5, 0, 0, 1), (4, 4, 0, 1)] ) >>> myCurve.ep NurbsCurveEP(u'periodicCurveShape2.ep[0:7]') >>> myCurve.numEPs() 8 >>> >>> # an open curve >>> myCurve = curve(name='openCurve2', d=3, periodic=False, k=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), pw=[(4, -4, 0, 1), (5.5, 0, 0, 1), (4, 4, 0, 1), (0, 5.5, 0, 1), (-4, 4, 0, 1), (-5.5, 0, 0, 1), (-4, -4, 0, 1), (0, -5.5, 0, 1), (4, -4, 0, 1), (5.5, 0, 0, 1), (4, 4, 0, 1)] ) >>> myCurve.ep NurbsCurveEP(u'openCurveShape2.ep[0:8]') >>> myCurve.numEPs() 9
Return type: int
- numKnots()¶
Return the number of knots for this curve. If the number of knots cannot be determined then 0 is returned.
Return type: int Derived from api method maya.OpenMaya.MFnNurbsCurve.numKnots
- numSpans()¶
Return the number of spans for this curve. If the number of spans cannot be determined then 0 is returned.
Return type: int Derived from api method maya.OpenMaya.MFnNurbsCurve.numSpans
- removeKnot(atThisParam, removeAll=False)¶
Remove one or more knots at the given parameter.
Parameters: - atThisParam : float
Status code
- removeAll : bool
How to handle multiple knots at the same param.
Derived from api method maya.OpenMaya.MFnNurbsCurve.removeKnot
Undo is not currently supported for this method
- reverse(constructionHistory=False)¶
This method reverse the curve direction.
Parameters: - constructionHistory : bool
This parameter has no effect. Regardless of how it is set, if the function set was initialized with the DAG path of a curve node which already has history, then the reverse operation will be added into that history, otherwise the reverse operation will be applied directly to the curve’s data and no history will be left behind.
Derived from api method maya.OpenMaya.MFnNurbsCurve.reverse
Undo is not currently supported for this method
- setCV(index, pt, space='preTransform')¶
Set the CV at the given index to the given point. The method updateCurve should be called to trigger changes in the curve.
Parameters: - index : int
The index of the CV that will be changed
- pt : Point
The new value that the CV will take
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Derived from api method maya.OpenMaya.MSpace.setCV
- setCVs(array, space='preTransform')¶
Set the CVs for this curve to the given points.
Parameters: - array : Point list
The array of point values for the CVs
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Derived from api method maya.OpenMaya.MSpace.setCVs
- setKnot(index, param)¶
Set the given knot’s parameter value. Knot indices range from 0 to numKnots() - 1 .
Parameters: - index : int
Index of the knot to be set
- param : float
The parameter value that the knot will take
Derived from api method maya.OpenMaya.MFnNurbsCurve.setKnot
- setKnots(array, startIndex, endIndex)¶
This method is used to set the values of a contiguous group of knots of the curve. The range of knots to set is specified using the start and end index. The knots of index startIndex to endIndex inclusive will be set using the value in the double array.
Parameters: - array : float list
a double array of knot points
- startIndex : int
the starting index of the knots to be altered.
- endIndex : int
the ending index of the knots to be altered.
Derived from api method maya.OpenMaya.MFnNurbsCurve.setKnots
- tangent(param, space='preTransform')¶
This method returns the tangent at the given parameter value on the curve. The resulting tangent vector is normalized.
Parameters: - param : float
The parameter of the point on the curve from which to get the tangent
- space : Space.Space
Specifies the coordinate system for this operation
values: ‘transform’, ‘preTransform’, ‘object’, ‘world’
Return type: Vector
Derived from api method maya.OpenMaya.MSpace.tangent
- updateCurve()¶
This method signals that this curve has changed and needs to be recalculated. Derived from api method maya.OpenMaya.MFnNurbsCurve.updateCurve
Undo is not currently supported for this method