Module Curve :: Class CurNurb
[hide private]
[frames] | no frames]

Class CurNurb

source code

The CurNurb Object

This object provides access to the control points of the curves that make up a Blender Curve ObData.

The CurNurb supports the python iterator protocol which means you can use a python for statement to access the points in a curve.

The CurNurb also supports the sequence protocol which means you can access the control points of a CurNurb using the [] operator.

Note that CurNurb is used for accesing poly, bezier and nurbs type curves.

Instance Methods [hide private]
None
__setitem__(n, point)
Replace the Nth point in the curve.
source code
BezTriple (Bezier Curve) or List of 5 floats [x, y, z, w, t] for Poly or Nurbs
__getitem__(n)
Get the Nth element in the curve.
source code
None
append(new_point)
Appends a new point to a curve.
source code
None
setMatIndex(index)
Sets the Material index for this CurNurb.
source code
integer
getMatIndex()
Returns the Material index for this CurNurb.
source code
boolean
isNurb()
Boolean method used to determine whether a CurNurb is of type Bezier or of type Nurb.
source code
boolean
isCyclic()
Boolean method checks whether a CurNurb is cyclic (a closed curve) or not.
source code
integer
getFlagU()
Get the CurNurb knot flag U.
source code
None
setFlagU(flag)
Set the entire CurNurb knot flag U (knots are recalculated automatically).
source code
integer
getFlagV()
Get the CurNurb knot flag V.
source code
None
setFlagV(value)
Set the CurNurb knot flag V (knots are recalculated automatically).
source code
integer
getType()
Get the type of the curve.
source code
None
setType(value)
Set the type of the curve and converts the curve to its new type if needed
source code
Instance Variables [hide private]
int flagU
The CurNurb knot flag U.
int flagV
The CurNurb knot flag V.
tuple of floats knotsU
The knot vector in the U direction.
tuple of floats knotsV
The knot vector in the V direction.
int orderU
The CurNurb knot order U, for nurbs curves only, this is clamped by the number of points, so the orderU will never be greater.
bool smooth
Set the smoothing for this curve (applies to cuve objects that have a bevel)
int type
The type of the curve (Poly: 0, Bezier: 1, NURBS: 4)
Method Details [hide private]

__setitem__(n, point)
(Index assignment operator)

source code 

Replace the Nth point in the curve. The type of the argument must match the type of the curve. List of 4 floats (optional 5th float is the tilt value in radians) for Nurbs or BezTriple for Bezier.

Parameters:
  • n (integer) - the index of the element to replace
  • point (BezTriple or list of 4 floats (optional 5th float is the tilt value in radians)) - the point that will replace the one in the curve. The point can be either a BezTriple type or a list of 4 floats in x,y,z,w (optionally tilt in radians as 5th value) format for a Nurb curve.
Returns: None
None

__getitem__(n)
(Indexing operator)

source code 

Get the Nth element in the curve. For Bezier curves, that element is a BezTriple. For the rest (Poly and Nurbs), it is a list of 5 floats: x, y, z, weight, tilt (in radians). NOTE 1: This element is independent on the curve, modifying it will not affect the curve. NOTE 2: Each successive call returns a new object.

Parameters:
  • n (integer) - the index of the element to return
Returns: BezTriple (Bezier Curve) or List of 5 floats [x, y, z, w, t] for Poly or Nurbs
The Nth element in the curve

append(new_point)

source code 

Appends a new point to a curve. This method appends points to both Bezier and Nurb curves. The type of the argument must match the type of the curve. List of 4 floats (optional 5th float is the tilt value in radians) for Nurbs or BezTriple for Bezier.

Parameters:
  • new_point (BezTriple or list of 4 floats (optional 5th float is the tilt value in radians)) - the new point to be appended to the curve. The new point can be either a BezTriple type or a list of 4 floats in x,y,z,w (optionally tilt in radians as 5th value) format for a Nurb curve.
Returns: None
None

setMatIndex(index)

source code 

Sets the Material index for this CurNurb.

Parameters:
  • index (integer) - the new value for the Material number of this CurNurb. No range checking is done.
Returns: None
None

getMatIndex()

source code 

Returns the Material index for this CurNurb.

Returns: integer
integer

isNurb()

source code 

Boolean method used to determine whether a CurNurb is of type Bezier or of type Nurb.

Returns: boolean
True or False

isCyclic()

source code 

Boolean method checks whether a CurNurb is cyclic (a closed curve) or not.

Returns: boolean
True or False

getFlagU()

source code 

Get the CurNurb knot flag U.

Returns: integer
See setFlagU for description of return value.

setFlagU(flag)

source code 

Set the entire CurNurb knot flag U (knots are recalculated automatically). The flag can be one of six values:

  • 0 or 1: uniform knots
  • 2 or 3: endpoints knots
  • 4 or 5: bezier knots

Bit 0 controls whether or not the curve is cyclic (1 = cyclic).

Parameters:
  • flag (integer) - CurNurb knot flag
Returns: None
None

getFlagV()

source code 

Get the CurNurb knot flag V.

Returns: integer
See setFlagU for description of return value.

setFlagV(value)

source code 

Set the CurNurb knot flag V (knots are recalculated automatically).

Parameters:
  • value (integer) - See setFlagU for description of return.
Returns: None
None

getType()

source code 

Get the type of the curve.

Returns: integer
0 - Poly, 1 - Bezier, 4 - NURBS

setType(value)

source code 

Set the type of the curve and converts the curve to its new type if needed

Parameters:
  • value (integer) - CurNurb type flag (0 - Poly, 1 - Bezier, 4 - NURBS)
Returns: None
None

Instance Variable Details [hide private]

flagU

The CurNurb knot flag U. See setFlagU for description.
Type:
int

flagV

The CurNurb knot flag V. See setFlagU for description.
Type:
int

knotsU

The knot vector in the U direction. The tuple will be empty if the curve isn't a NURB or doesn't have knots in this direction.
Type:
tuple of floats

knotsV

The knot vector in the V direction. The tuple will be empty if the curve isn't a NURB or doesn't have knots in this direction.
Type:
tuple of floats