Module Lattice
[frames | no frames]

Module Lattice

The Blender.Lattice submodule.

Lattice Object

This module provides access to Lattice object in Blender.

Example:
       import Blender
       from Blender import Lattice, Object, Scene, Modifier

       # Make new lattice data
       lattice_data = Lattice.New()
       lattice_data.setPartitions(5,5,5)
       lattice_data.setKeyTypes(Lattice.LINEAR, Lattice.CARDINAL, Lattice.BSPLINE)
       lattice_data.setMode(Lattice.OUTSIDE)

       for y in range(125):
               vec = lattice_data.getPoint(y)
               co1 = vec[0] + vec[0] / 5
               co2 = vec[1] - vec[2] * 0.3
               co3 = vec[2] * 3
               lattice_data.setPoint(y,[co1,co2,co3])
       
       # Create a new object from the lattice in the current scene
       scn = Scene.GetCurrent()
       ob_lattice = scn.objects.new(lattice_data)
       
       # Get an object to deform with this lattice
       mySphere = Object.Get('Sphere')

       # Apply lattice modifier
       mod= mySphere.modifiers.append(Modifier.Type.LATTICE)
       mod[Modifier.Settings.OBJECT] = ob_lattice
       mySphere.makeDisplayList()

       Blender.Redraw()

Classes
Lattice This object gives access to Lattices in Blender.

Function Summary
Blender Lattice or a list of Blender Lattices Get(name)
Get the Lattice object(s) from Blender.
Blender Lattice New(name)
Create a new Lattice object.

Function Details

Get(name=None)

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

           (type=Blender Lattice or a list of Blender Lattices)

New(name=None)

Create a new Lattice object. Passing a name to this function will name the Lattice datablock, otherwise the Lattice data will be given a default name.
Parameters:
name - The Lattice name.
           (type=string)
Returns:
The created Lattice Data object.
           (type=Blender Lattice)

Generated by Epydoc 2.1 on Thu May 10 20:32:01 2007 http://epydoc.sf.net