Module Curve :: Class Curve
[frames | no frames]

Class Curve


The Curve Data object

This object gives access to Curve and Surface data linked from Blender Objects.
Method Summary
Curve __copy__()
Make a copy of this curve
CurNurb appendNurb(new_point)
add a new curve to this Curve.
None appendPoint(numcurve, new_control_point)
Add a new control point to the indicated curve (deprecated).
Blender Object or None getBevOb()
Returns the Bevel Object (BevOb) assigned to the Curve.
float getBevresol()
Get the Curve's bevel resolution value.
list of floats getControlPoint(numcurve, numpoint)
Get the curve's control point value (deprecated).
float getExt1()
Get the Curve's ext1 value.
float getExt2()
Get the Curve's ext2 value.
integer bitfield getFlag()
Get the Curve flag value.
Key object or None getKey()
Return the Key object containing the keyframes for this curve, if any.
a list of 3 floats. getLoc()
Get the curve's location value.
list of Material Objects getMaterials()
Returns a list of materials assigned to the Curve.
string getName()
Get the name of this Curve Data object.
integer getNumCurves()
Get the number of curves in this Curve Data object.
integer getNumPoints(curve_num)
Get the number of control points in the curve (deprecated).
int getPathLen()
Get this Curve's path frame length, used for an animated path.
float getResolu()
Get the Curve's U-resolution value.
float getResolv()
Get the Curve's V-resolution value.
a list of 3 floats. getRot()
Get the curve's rotation value.
a list of 3 floats. getSize()
Get the curve's size value.
Blender Object or None getTaperOb()
Returns the Taper Object (TaperOb) assigned to the Curve.
int getTotcol()
Get the number of materials linked to the Curve.
float getWidth()
Get the Curve's width value.
boolean isCyclic(curve_num)
Tells whether or not a CurNurb is cyclic (closed) (deprecated).
integer isNurb(curve_num)
Tells type of a CurNurb (deprecated).
None recalc()
Recalculate control point handles after a curve has been changed.
None setBevOb(object)
Assign a Bevel Object (BevOb) to the Curve.
None setBevresol(bevelresol)
Set the Curve's bevel resolution value.
None setControlPoint(numcurve, numpoint, controlpoint)
Set the Curve's controlpoint value.
None setExt1(ext1)
Set the Curve's ext1 value.
None setExt2(ext2)
Set the Curve's ext2 value.
None setFlag(val)
Set the Curve flag value.
None setLoc(location)
Set the curve's location value.
None setName(name)
Set the name of this Curve Data object.
None setPathLen(len)
Set this Curve's path length.
None setResolu(resolu)
Set the Curve's U-resolution value.
None setResolv(resolv)
Set the Curve's V-resolution value.
None setRot(rotation)
Set the Curve's rotation value.
None setSize(size)
Set the curve size value.
None setTaperOb(object)
Assign a Taper Object (TaperOb) to the Curve.
None setTotcol(totcol)
Set the number of materials linked to the Curve.
None setWidth(width)
Set the Curve's width value.
  switchDirection()
Reverse the direction of a curve.
None update()
Updates display list for a Curve.

Instance Variable Summary
Blender Object or None bevob: The Curve Bevel Object
int bevresol: The Curve Data bevel resolution.
float ext1: The Curve Data extent1 (for bevels).
float ext2: The Curve Data extent2 (for bevels).
  flag: The Curve Data flag value; see getFlag() for the semantics.
Blender Key key: The Key object associated with this Curve, if any.
list of 3 floats loc: The Curve Data location(from the center).
list of Materials materials: The curves's materials.
string name: The Curve Data name.
int pathlen: The Curve Data path length, used to set the number of frames for an animation (not the physical length).
int resolu: The Curve Data U-resolution (used for curve and surface resolution) [0 - 1024].
int resolv: The Curve Data V-resolution (used for surface resolution) [0 - 1024].
list of 3 floats rot: The Curve Data rotation(from the center).
list of 3 floats size: The Curve Data size(from the center).
int totcol: The Curve Data maximal number of linked materials.
float width: The Curve Data width [0 - 2].

Method Details

__copy__()

Make a copy of this curve
Returns:
a copy of this curve
           (type=Curve)

appendNurb(new_point)

add a new curve to this Curve. The new point is added to the new curve. Blender does not support a curve with zero points. The new curve is added to the end of the list of curves in the Curve.
Parameters:
new_point - see CurNurb.append for description of parameter.
           (type=BezTriple or list of xyzw coordinates for a Nurb curve.)
Returns:
the newly added spline
           (type=CurNurb)

appendPoint(numcurve, new_control_point)

Add a new control point to the indicated curve (deprecated). New scripts should use CurNurb.append().
Parameters:
numcurve - index for spline in Curve, starting from 0
           (type=int)
new_control_point - depends on curve's type.
  • type Bezier: a BezTriple
  • type Nurb: a list of four or five floats for the xyzw values

           (type=list of floats or BezTriple)
Returns:
None
Raises:
AttributeError - throws exception if numcurve is out of range.

getBevOb()

Returns the Bevel Object (BevOb) assigned to the Curve.
Returns:
Bevel Object (BevOb) assigned to the Curve.
           (type=Blender Object or None)

getBevresol()

Get the Curve's bevel resolution value.
Returns:
float

getControlPoint(numcurve, numpoint)

Get the curve's control point value (deprecated). The numpoint arg is an index into the list of points and starts with 0. Note: new scripts should use the [] operator on Curves and CurNurbs. Example:
 curve = Blender.Curve.Get('Curve')
 p0 = curve[0][0]    # get first point from first nurb
        # -- OR --
 nurb = curve[0]     # get first nurb
 p0 = nurb[0]        # get nurb's first point
Parameters:
numcurve
           (type=int)
numpoint
           (type=int)
Returns:
depends upon the curve's type.
  • type Bezier : a list of nine floats. Values are x, y, z for handle-1, vertex and handle-2
  • type Nurb : a list of 4 floats. Values are x, y, z, w.

           (type=list of floats)

getExt1()

Get the Curve's ext1 value.
Returns:
float

getExt2()

Get the Curve's ext2 value.
Returns:
float

getFlag()

Get the Curve flag value. This item is a bitfield whose value is a combination of the following parameters.
  • Bit 0 : "3D" is set
  • Bit 1 : "Front" is set
  • Bit 2 : "Back" is set
  • Bit 3 : "CurvePath" is set.
  • Bit 4 : "CurveFollow" is set.
Returns:
integer bitfield

getKey()

Return the Key object containing the keyframes for this curve, if any.
Returns:
Key object or None

getLoc()

Get the curve's location value.
Returns:
a list of 3 floats.

getMaterials()

Returns a list of materials assigned to the Curve.
Returns:
list of Material Objects assigned to the Curve.
           (type=list of Material Objects)

getName()

Get the name of this Curve Data object.
Returns:
string

getNumCurves()

Get the number of curves in this Curve Data object.
Returns:
integer

getNumPoints(curve_num)

Get the number of control points in the curve (deprecated). New scripts should use the len operator (len(curve)).
Parameters:
curve_num - zero-based index into list of curves in this Curve
           (type=integer)
Returns:
integer

getPathLen()

Get this Curve's path frame length, used for an animated path.
Returns:
the path length.
           (type=int)

getResolu()

Get the Curve's U-resolution value.
Returns:
float

getResolv()

Get the Curve's V-resolution value.
Returns:
float

getRot()

Get the curve's rotation value.
Returns:
a list of 3 floats.

getSize()

Get the curve's size value.
Returns:
a list of 3 floats.

getTaperOb()

Returns the Taper Object (TaperOb) assigned to the Curve.
Returns:
Taper Object (TaperOb) assigned to the Curve.
           (type=Blender Object or None)

getTotcol()

Get the number of materials linked to the Curve.
Returns:
number of materials linked.
           (type=int)

getWidth()

Get the Curve's width value.
Returns:
float

isCyclic(curve_num)

Tells whether or not a CurNurb is cyclic (closed) (deprecated). New scripts should use CurNurb.isCyclic().
Parameters:
curve_num - zero-based index into list of curves in this Curve
           (type=integer)
Returns:
True if is cyclic, False if not
           (type=boolean)
Raises:
AttributeError - throws exception if curve_num is out of range.

isNurb(curve_num)

Tells type of a CurNurb (deprecated). New scripts should use CurNurb.isNurb().
Parameters:
curve_num - zero-based index into list of curves in this Curve.
           (type=integer)
Returns:
Zero if curve is type Bezier, one if curve is of type Nurb.
           (type=integer)
Raises:
AttributeError - throws exception if curve_num is out of range.

recalc()

Recalculate control point handles after a curve has been changed.
Returns:
None

setBevOb(object)

Assign a Bevel Object (BevOb) to the Curve. Passing None as the object parameter removes the bevel.
Parameters:
object - Blender Object to assign as Bevel Object (BevOb)
           (type=Curve type Blender Object)
Returns:
None
           (type=None)
Raises:
TypeError - throws exception if the parameter is not a Curve type Blender Object or None

setBevresol(bevelresol)

Set the Curve's bevel resolution value.
Parameters:
bevelresol - The new Curve's bevel resolution value.
           (type=float)
Returns:
None

setControlPoint(numcurve, numpoint, controlpoint)

Set the Curve's controlpoint value. The numpoint arg is an index into the list of points and starts with 0.
Parameters:
numcurve - index for spline in Curve, starting from 0
           (type=int)
numpoint - index for point in spline, starting from 0
           (type=int)
controlpoint - The new controlpoint value. See getControlPoint for the length of the list.
           (type=list)
Returns:
None

setExt1(ext1)

Set the Curve's ext1 value.
Parameters:
ext1 - The new Curve's ext1 value.
           (type=float)
Returns:
None

setExt2(ext2)

Set the Curve's ext2 value.
Parameters:
ext2 - The new Curve's ext2 value.
           (type=float)
Returns:
None

setFlag(val)

Set the Curve flag value. The flag corresponds to the Blender settings for 3D, Front, Back, CurvePath and CurveFollow. This parameter is a bitfield.
Parameters:
val - The Curve's flag bits. See getFlag for the meaning of the individual bits.
           (type=integer bitfield)
Returns:
None

setLoc(location)

Set the curve's location value.
Parameters:
location - The new Curve's location values.
           (type=list[3])
Returns:
None

setName(name)

Set the name of this Curve Data object.
Parameters:
name - The new name.
           (type=string)
Returns:
None

setPathLen(len)

Set this Curve's path length.
Parameters:
len - the new curve's length.
           (type=int)
Returns:
None

setResolu(resolu)

Set the Curve's U-resolution value. [0 - 1024] This is used for surfaces and curves.
Parameters:
resolu - The new Curve's U-resolution value.
           (type=float)
Returns:
None

setResolv(resolv)

Set the Curve's V-resolution value. [0 - 1024]. This is used for surfaces only.
Parameters:
resolv - The new Curve's V-resolution value.
           (type=float)
Returns:
None

setRot(rotation)

Set the Curve's rotation value.
Parameters:
rotation - The new Curve's rotation values.
           (type=list[3])
Returns:
None

setSize(size)

Set the curve size value.
Parameters:
size - The new Curve's size values.
           (type=list[3])
Returns:
None

setTaperOb(object)

Assign a Taper Object (TaperOb) to the Curve. Passing None as the object parameter removes the taper.
Parameters:
object - Blender Object to assign as Taper Object (TaperOb)
           (type=Curve type Blender Object)
Returns:
None
           (type=None)
Raises:
TypeError - throws exception if the parameter is not a Curve type Blender Object or None

setTotcol(totcol)

Set the number of materials linked to the Curve. Note: this method will probably be deprecated in the future.
Parameters:
totcol - number of materials linked.
           (type=int)
Returns:
None

Warning: It is not advisable to use this method unless you know what you are doing; it's possible to corrupt a .blend file if you don't know what you're doing. If you want to change the number of materials, use the materials attribute.

setWidth(width)

Set the Curve's width value.
Parameters:
width - The new Curve's width value.
           (type=float)
Returns:
None

switchDirection()

Reverse the direction of a curve.
Returns:

None

Example: # This example switches the direction of all curves on the active object. from Blender import * scn = Scene.GetCurrent() ob = scn.objects.active # must be a curve data = ob.data for cu in data: cu.switchDirection()

update()

Updates display list for a Curve. Used after making changes to control points. You must use this if you want to see your changes!
Returns:
None
           (type=None)

Instance Variable Details

bevob

The Curve Bevel Object
Type:
Blender Object or None

bevresol

The Curve Data bevel resolution. [0 - 32]
Type:
int

ext1

The Curve Data extent1 (for bevels).
Type:
float

ext2

The Curve Data extent2 (for bevels).
Type:
float

flag

The Curve Data flag value; see getFlag() for the semantics.

key

The Key object associated with this Curve, if any.
Type:
Blender Key

loc

The Curve Data location(from the center).
Type:
list of 3 floats

materials

The curves's materials. Each curve can reference up to 16 materials. Empty slots in the curve's list are represented by None. Note: Object.colbits needs to be set correctly for each object in order for these materials to be used instead of the object's materials. Note: The list that's returned is not linked to the original curve. curve.materials.append(material) won't do anything. Use curve.materials += [material] instead.
Type:
list of Materials

name

The Curve Data name.
Type:
string

pathlen

The Curve Data path length, used to set the number of frames for an animation (not the physical length).
Type:
int

resolu

The Curve Data U-resolution (used for curve and surface resolution) [0 - 1024].
Type:
int

resolv

The Curve Data V-resolution (used for surface resolution) [0 - 1024].
Type:
int

rot

The Curve Data rotation(from the center).
Type:
list of 3 floats

size

The Curve Data size(from the center).
Type:
list of 3 floats

totcol

The Curve Data maximal number of linked materials. Read-only.
Type:
int

width

The Curve Data width [0 - 2].
Type:
float

Generated by Epydoc 2.1 on Sun Feb 11 13:30:18 2007 http://epydoc.sf.net