Module Curve :: Class Curve

Class Curve

source code

The Curve Data object

This object gives access to Curve and Surface data linked from Blender Objects.

Instance Methods
string
getName()
Get the name of this Curve Data object.
source code
None
setName(name)
Set the name of this Curve Data object.
source code
int
getPathLen()
Get this Curve's path frame length, used for an animated path.
source code
None
setPathLen(len)
Set this Curve's path length.
source code
int
getTotcol()
Get the number of materials linked to the Curve.
source code
None
setTotcol(totcol)
Set the number of materials linked to the Curve.
source code
integer bitfield
getFlag()
Get the Curve flag value.
source code
None
setFlag(val)
Set the Curve flag value.
source code
float
getBevresol()
Get the Curve's bevel resolution value.
source code
None
setBevresol(bevelresol)
Set the Curve's bevel resolution value.
source code
float
getResolu()
Get the Curve's U-resolution value.
source code
None
setResolu(resolu)
Set the Curve's U-resolution value.
source code
float
getResolv()
Get the Curve's V-resolution value.
source code
None
setResolv(resolv)
Set the Curve's V-resolution value.
source code
float
getWidth()
Get the Curve's width value.
source code
None
setWidth(width)
Set the Curve's width value.
source code
float
getExt1()
Get the Curve's ext1 value.
source code
None
setExt1(ext1)
Set the Curve's ext1 value.
source code
float
getExt2()
Get the Curve's ext2 value.
source code
None
setExt2(ext2)
Set the Curve's ext2 value.
source code
list of floats
getControlPoint(numcurve, numpoint)
Get the curve's control point value (deprecated).
source code
None
setControlPoint(numcurve, numpoint, controlpoint)
Set the Curve's controlpoint value.
source code
None
appendPoint(numcurve, new_control_point)
Add a new control point to the indicated curve (deprecated).
source code
CurNurb
appendNurb(new_point)
add a new curve to this Curve.
source code
a list of 3 floats.
getLoc()
Get the curve's location value.
source code
None
setLoc(location)
Set the curve's location value.
source code
a list of 3 floats.
getRot()
Get the curve's rotation value.
source code
None
setRot(rotation)
Set the Curve's rotation value.
source code
a list of 3 floats.
getSize()
Get the curve's size value.
source code
None
setSize(size)
Set the curve size value.
source code
list of Material Objects
getMaterials()
Returns a list of materials assigned to the Curve.
source code
Blender Object or None
getBevOb()
Returns the Bevel Object (BevOb) assigned to the Curve.
source code
None
setBevOb(object)
Assign a Bevel Object (BevOb) to the Curve.
source code
Blender Object or None
getTaperOb()
Returns the Taper Object (TaperOb) assigned to the Curve.
source code
None
setTaperOb(object)
Assign a Taper Object (TaperOb) to the Curve.
source code
None
update()
Updates display list for a Curve.
source code
integer
isNurb(curve_num)
Tells type of a CurNurb (deprecated).
source code
boolean
isCyclic(curve_num)
Tells whether or not a CurNurb is cyclic (closed) (deprecated).
source code
 
switchDirection()
Reverse the direction of a curve.
source code
integer
getNumCurves()
Get the number of curves in this Curve Data object.
source code
integer
getNumPoints(curve_num)
Get the number of control points in the curve (deprecated).
source code
Key object or None
getKey()
Return the Key object containing the keyframes for this curve, if any.
source code
None
recalc()
Recalculate control point handles after a curve has been changed.
source code
Curve
__copy__()
Make a copy of this curve
source code
Instance Variables
Blender Object or None bevob
The Curve Bevel Object
int bevresol
The Curve Data bevel resolution.
float ext1
The Curve Data extent1 Called "Extrude" in the user interface (for bevels only).
float ext2
The Curve Data extent2 - Called "Bevel Depth" in the user interface (for bevels only).
  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).
Blender Object or None taperob
The Curve Taper Object
int totcol
The Curve Data maximal number of linked materials.
float width
The Curve Data width [0 - 2].
Method Details

setName(name)

source code 
Set the name of this Curve Data object.
Parameters:
  • name (string) - The new name.
Returns: None

getPathLen()

source code 
Get this Curve's path frame length, used for an animated path.
Returns: int
the path length.

setPathLen(len)

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

getTotcol()

source code 
Get the number of materials linked to the Curve.
Returns: int
number of materials linked.

setTotcol(totcol)

source code 
Set the number of materials linked to the Curve. Note: this method will probably be deprecated in the future.
Parameters:
  • totcol (int) - number of materials linked.
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.

getFlag()

source code 
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

setFlag(val)

source code 
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 (integer bitfield) - The Curve's flag bits. See getFlag for the meaning of the individual bits.
Returns: None

setBevresol(bevelresol)

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

setResolu(resolu)

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

setResolv(resolv)

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

setWidth(width)

source code 
Set the Curve's width value.
Parameters:
  • width (float) - The new Curve's width value.
Returns: None

setExt1(ext1)

source code 
Set the Curve's ext1 value.
Parameters:
  • ext1 (float) - The new Curve's ext1 value.
Returns: None

setExt2(ext2)

source code 
Set the Curve's ext2 value.
Parameters:
  • ext2 (float) - The new Curve's ext2 value.
Returns: None

getControlPoint(numcurve, numpoint)

source code 
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
Returns: list of floats
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.

setControlPoint(numcurve, numpoint, controlpoint)

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

appendPoint(numcurve, new_control_point)

source code 
Add a new control point to the indicated curve (deprecated). New scripts should use CurNurb.append().
Parameters:
  • numcurve (int) - index for spline in Curve, starting from 0
  • new_control_point (list of floats or BezTriple) - depends on curve's type.
    • type Bezier: a BezTriple
    • type Nurb: a list of four or five floats for the xyzw values
Returns: None
Raises:
  • AttributeError - throws exception if numcurve is out of range.

appendNurb(new_point)

source code 
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 (BezTriple or list of xyzw coordinates for a Nurb curve.) - see CurNurb.append for description of parameter.
Returns: CurNurb
the newly added spline

setLoc(location)

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

setRot(rotation)

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

setSize(size)

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

getMaterials()

source code 
Returns a list of materials assigned to the Curve.
Returns: list of Material Objects
list of Material Objects assigned to the Curve.

getBevOb()

source code 
Returns the Bevel Object (BevOb) assigned to the Curve.
Returns: Blender Object or None
Bevel Object (BevOb) assigned to the Curve.

setBevOb(object)

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

getTaperOb()

source code 
Returns the Taper Object (TaperOb) assigned to the Curve.
Returns: Blender Object or None
Taper Object (TaperOb) assigned to the Curve.

setTaperOb(object)

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

update()

source code 
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
None

isNurb(curve_num)

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

isCyclic(curve_num)

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

switchDirection()

source code 
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()

getNumPoints(curve_num)

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

__copy__()

source code 
Make a copy of this curve
Returns: Curve
a copy of this curve

Instance Variable Details

bevresol

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

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

totcol

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