1
2
3 """
4 The Blender.Mesh.Primitives submodule.
5
6 B{New}:
7
8 Mesh Primitive Data
9 ===================
10
11 This submodule provides access Blender's mesh primitives. Each module
12 function returns a BPy_Mesh object which wraps the mesh data. This data can
13 then be manipulated using the L{Mesh} API.
14
15 Example::
16
17 from Blender import *
18
19 me = Mesh.Primitives.Cube(2.0) # create a new cube of size 2
20 sc = Scene.GetCurrent() # get current scene
21 sc.objects.new(me,'Mesh') # add a new mesh-type object to the scene
22 Window.RedrawAll() # update windows
23 """
24
26 """
27 Construct a filled planar mesh with 4 vertices. The default size
28 creates a 2 by 2 Blender unit plane, identical to the Blender UI.
29 @type size: float
30 @param size: optional size of the plane.
31 @rtype: L{BPy_Mesh<Mesh>}
32 @return: returns a mesh object.
33 """
34
36 """
37 Construct a cube mesh. The default size creates a cube with each face
38 2 by 2 Blender units, identical to the Blender UI.
39 @type size: float
40 @param size: optional size of the cube.
41 @rtype: L{BPy_Mesh<Mesh>}
42 @return: returns a mesh object.
43 """
44
45 -def Circle(verts=32,diameter=2.0):
46 """
47 Construct a circle mesh. The defaults create a circle with a
48 diameter of 2 Blender units, identical to the Blender UI.
49 @type verts: int
50 @param verts: optional number of vertices for the circle.
51 Value must be in the range [3,100].
52 @type diameter: float
53 @param diameter: optional diameter of the circle.
54 @rtype: L{BPy_Mesh<Mesh>}
55 @return: returns a mesh object.
56 """
57
58 -def Cylinder(verts=32, diameter=2.0, length=2.0):
59 """
60 Construct a cylindrical mesh (ends filled). The defaults create a
61 cylinder with a diameter of 2 Blender units and length 2 units,
62 identical to the Blender UI.
63 @type verts: int
64 @param verts: optional number of vertices in the cylinder's perimeter.
65 Value must be in the range [3,100].
66 @type diameter: float
67 @param diameter: optional diameter of the cylinder.
68 @type length: float
69 @param length: optional length of the cylinder.
70 @rtype: L{BPy_Mesh<Mesh>}
71 @return: returns a mesh object.
72 """
73
74 -def Tube(verts=32, diameter=2.0, length=2.0):
75 """
76 Construct a cylindrical mesh (ends not filled). The defaults create a
77 cylinder with a diameter of 2 Blender units and length 2 units, identical
78 to the Blender UI.
79 @type verts: int
80 @param verts: optional number of vertices in the tube's perimeter.
81 Value must be in the range [3,100].
82 @type diameter: float
83 @param diameter: optional diameter of the tube.
84 @type length: float
85 @param length: optional length of the tube.
86 @rtype: L{BPy_Mesh<Mesh>}
87 @return: returns a mesh object.
88 """
89
90 -def Cone(verts=32, diameter=2.0, length=2.0):
91 """
92 Construct a conic mesh (ends filled). The defaulte create a cone with a
93 base diameter of 2 Blender units and length 2 units, identical to
94 the Blender UI.
95 @type verts: int
96 @param verts: optional number of vertices in the cone's perimeter.
97 Value must be in the range [3,100].
98 @type diameter: float
99 @param diameter: optional diameter of the cone.
100 @type length: float
101 @param length: optional length of the cone.
102 @rtype: L{BPy_Mesh<Mesh>}
103 @return: returns a mesh object.
104 """
105
106 -def Grid(xres=32, yres=32, size=2.0):
107 """
108 Construct a grid mesh. The defaults create a 32 by 32 mesh of size 2
109 Blender units, identical to the Blender UI.
110 @type xres: int
111 @param xres: optional grid size in the x direction.
112 Value must be in the range [2,100].
113 @type yres: int
114 @param yres: optional grid size in the y direction.
115 Value must be in the range [2,100].
116 @type size: float
117 @param size: optional size of the grid.
118 @rtype: L{BPy_Mesh<Mesh>}
119 @return: returns a mesh object.
120 """
121
122 -def UVsphere(segments=32, rings=32, diameter=2.0):
123 """
124 Construct a UV sphere mesh. The defaults create a 32 by 32 sphere with
125 a diameter of 2 Blender units, identical to the Blender UI.
126 @type segments: int
127 @param segments: optional number of longitudinal divisions.
128 Value must be in the range [3,100].
129 @type rings: int
130 @param rings: optional number of latitudinal divisions.
131 Value must be in the range [3,100].
132 @type diameter: float
133 @param diameter: optional diameter of the sphere.
134 @rtype: L{BPy_Mesh<Mesh>}
135 @return: returns a mesh object.
136 """
137
139 """
140 Construct a Icosphere mesh. The defaults create sphere with 2 subdivisions
141 and diameter of 2 Blender units, identical to the Blender UI.
142 @type subdivisions: int
143 @param subdivisions: optional number of subdivisions.
144 Value must be in the range [2,5].
145 @type diameter: float
146 @param diameter: optional diameter of the sphere.
147 @rtype: L{BPy_Mesh<Mesh>}
148 @return: returns a mesh object.
149 """
150
152 """
153 Construct a Suzanne mesh.
154 @rtype: L{BPy_Mesh<Mesh>}
155 @return: returns a mesh object.
156 """
157