Module MeshPrimitives
[frames] | no frames]

Module MeshPrimitives

The Blender.Mesh.Primitives submodule.

New:

Mesh Primitive Data

This submodule provides access Blender's mesh primitives. Each module function returns a BPy_Mesh object which wraps the mesh data. This data can then be manipulated using the Mesh API.

Example:

 from Blender import *

 me = Mesh.Primitives.Cube(2.0)   # create a new cube of size 2
 sc = Scene.GetCurrent()          # get current scene
 sc.objects.new(me,'Mesh')        # add a new mesh-type object to the scene
 Window.RedrawAll()               # update windows
Functions
BPy_Mesh
Plane(size=2.0)
Construct a filled planar mesh with 4 vertices.
BPy_Mesh
Cube(size=2.0)
Construct a cube mesh.
BPy_Mesh
Circle(verts=32, diameter=2.0)
Construct a circle mesh.
BPy_Mesh
Cylinder(verts=32, diameter=2.0, length=2.0)
Construct a cylindrical mesh (ends filled).
BPy_Mesh
Tube(verts=32, diameter=2.0, length=2.0)
Construct a cylindrical mesh (ends not filled).
BPy_Mesh
Cone(verts=32, diameter=2.0, length=2.0)
Construct a conic mesh (ends filled).
BPy_Mesh
Grid(xres=32, yres=32, size=2.0)
Construct a grid mesh.
BPy_Mesh
UVsphere(segments=32, rings=32, diameter=2.0)
Construct a UV sphere mesh.
BPy_Mesh
Icosphere(subdivisions=2, diameter=2.0)
Construct a Icosphere mesh.
BPy_Mesh
Monkey()
Construct a Suzanne mesh.
Variables
  __package__ = None
Function Details

Plane(size=2.0)

 

Construct a filled planar mesh with 4 vertices. The default size creates a 2 by 2 Blender unit plane, identical to the Blender UI.

Parameters:
  • size (float) - optional size of the plane.
Returns: BPy_Mesh
returns a mesh object.

Cube(size=2.0)

 

Construct a cube mesh. The default size creates a cube with each face 2 by 2 Blender units, identical to the Blender UI.

Parameters:
  • size (float) - optional size of the cube.
Returns: BPy_Mesh
returns a mesh object.

Circle(verts=32, diameter=2.0)

 

Construct a circle mesh. The defaults create a circle with a diameter of 2 Blender units, identical to the Blender UI.

Parameters:
  • verts (int) - optional number of vertices for the circle. Value must be in the range [3,100].
  • diameter (float) - optional diameter of the circle.
Returns: BPy_Mesh
returns a mesh object.

Cylinder(verts=32, diameter=2.0, length=2.0)

 

Construct a cylindrical mesh (ends filled). The defaults create a cylinder with a diameter of 2 Blender units and length 2 units, identical to the Blender UI.

Parameters:
  • verts (int) - optional number of vertices in the cylinder's perimeter. Value must be in the range [3,100].
  • diameter (float) - optional diameter of the cylinder.
  • length (float) - optional length of the cylinder.
Returns: BPy_Mesh
returns a mesh object.

Tube(verts=32, diameter=2.0, length=2.0)

 

Construct a cylindrical mesh (ends not filled). The defaults create a cylinder with a diameter of 2 Blender units and length 2 units, identical to the Blender UI.

Parameters:
  • verts (int) - optional number of vertices in the tube's perimeter. Value must be in the range [3,100].
  • diameter (float) - optional diameter of the tube.
  • length (float) - optional length of the tube.
Returns: BPy_Mesh
returns a mesh object.

Cone(verts=32, diameter=2.0, length=2.0)

 

Construct a conic mesh (ends filled). The defaulte create a cone with a base diameter of 2 Blender units and length 2 units, identical to the Blender UI.

Parameters:
  • verts (int) - optional number of vertices in the cone's perimeter. Value must be in the range [3,100].
  • diameter (float) - optional diameter of the cone.
  • length (float) - optional length of the cone.
Returns: BPy_Mesh
returns a mesh object.

Grid(xres=32, yres=32, size=2.0)

 

Construct a grid mesh. The defaults create a 32 by 32 mesh of size 2 Blender units, identical to the Blender UI.

Parameters:
  • xres (int) - optional grid size in the x direction. Value must be in the range [2,100].
  • yres (int) - optional grid size in the y direction. Value must be in the range [2,100].
  • size (float) - optional size of the grid.
Returns: BPy_Mesh
returns a mesh object.

UVsphere(segments=32, rings=32, diameter=2.0)

 

Construct a UV sphere mesh. The defaults create a 32 by 32 sphere with a diameter of 2 Blender units, identical to the Blender UI.

Parameters:
  • segments (int) - optional number of longitudinal divisions. Value must be in the range [3,100].
  • rings (int) - optional number of latitudinal divisions. Value must be in the range [3,100].
  • diameter (float) - optional diameter of the sphere.
Returns: BPy_Mesh
returns a mesh object.

Icosphere(subdivisions=2, diameter=2.0)

 

Construct a Icosphere mesh. The defaults create sphere with 2 subdivisions and diameter of 2 Blender units, identical to the Blender UI.

Parameters:
  • subdivisions (int) - optional number of subdivisions. Value must be in the range [2,5].
  • diameter (float) - optional diameter of the sphere.
Returns: BPy_Mesh
returns a mesh object.

Monkey()

 

Construct a Suzanne mesh.

Returns: BPy_Mesh
returns a mesh object.