[frames | no frames]

Module Curve

The Blender.Curve submodule.

Curve Data

A Blender Curve Data consists of multiple `CurNurb`(s). Try converting a Text object to a Curve to see an example of this. Each curve is of type Bezier or Nurb. The underlying `CurNurb`(s) can be accessed with the [] operator. Operator [] returns an object of type `CurNurb`.

Note that `CurNurb` can be used to acces a curve of any type (Poly, Bezier or Nurb)

The Curve module also supports the Python iterator interface. This means you can access the `CurNurb`(s) in a Curve and the control points in a `CurNurb` using a Python for statement.

Add a Curve to a Scene Example:
``` from Blender import Curve, Object, Scene
cu = Curve.New()             # create new  curve data
scn = Scene.GetCurrent()    # get current scene
ob = scn.objects.new(cu)     # make a new curve from the curve data
```
Iterator Example:
``` from Blender import Curve, Object, Scene
scn = Scene.GetCurrent()    # get current scene
ob = scn.objects.active
curvedata = ob.data
for curnurb in curvedata:
print type( curnurb ), curnurb
for point in curnurb:
print type( point ), point
```
Creating a Curve from a list of Vec triples Examples:
``` from Blender import *
def bezList2Curve(bezier_vecs):
'''
Take a list or vector triples and converts them into a bezier curve object
'''

def bezFromVecs(vecs):
'''
Bezier triple from 3 vecs, shortcut functon
'''
bt= BezTriple.New(      vecs[0].x, vecs[0].y, vecs[0].z,        vecs[1].x, vecs[1].y, vecs[1].z,        vecs[2].x, vecs[2].y, vecs[2].z)

bt.handleTypes= (BezTriple.HandleTypes.FREE, BezTriple.HandleTypes.FREE)

return bt

# Create the curve data with one point
cu= Curve.New()
cu_nurb= cu[0] # Get the first curve just added in the CurveData

i= 1 # skip first vec triple because it was used to init the curve
while i<len(bezier_vecs):
bt_vec_triple= bezier_vecs[i]
bt= bezFromVecs(bt_vec_triple)
cu_nurb.append(bt)
i+=1

# Add the Curve into the scene
scn= Scene.GetCurrent()
ob = scn.objects.new(cu)
return ob
```

Classes
`CurNurb` This object provides access to the control points of the curves that make up a Blender Curve ObData.
`Curve` This object gives access to Curve and Surface data linked from Blender Objects.
`SurfNurb` This object provides access to the control points of the surfaces that make up a Blender Curve.

Function Summary
Blender Curve or a list of Blender Curves `Get(name)`
Get the Curve Data object(s) from Blender.
Blender Curve `New(name)`
Create a new Curve Data object.

Function Details

Get(name=None)

Get the Curve Data object(s) from Blender.
Parameters:
`name` - The name of the Curve Data.
(type=string)
Returns:
It depends on the 'name' parameter:
• (name): The Curve Data object with the given name;
• (): A list with all Curve Data objects in the current scene.

(type=Blender Curve or a list of Blender Curves)

New(name)

Create a new Curve Data object.
Parameters:
`name` - The Curve Data name.
(type=string)
Returns:
The created Curve Data object.
(type=Blender Curve)

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