Module Lattice

Module Lattice

source code

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.
Functions
Blender Lattice
New(name=None)
Create a new Lattice object.
source code
Blender Lattice or a list of Blender Lattices
Get(name=None)
Get the Lattice object(s) from Blender.
source code
Function Details

New(name=None)

source code 
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 (string) - The Lattice name.
Returns: Blender Lattice
The created Lattice Data object.

Get(name=None)

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