-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patha_cone.py
51 lines (43 loc) · 1.13 KB
/
a_cone.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import bpy
def cone(verticies=128, r1=1, r2=0, depth=2, name='cone'):
"""
Create a cone with the specified parameters.
:param r1: radius of the base
:param r2: radius of the top
:param depth: height of the cone
:param verticies: number of verticies
:param name: name of the cone
:return: cone
"""
bpy.ops.mesh.primitive_cone_add(
vertices=verticies,
radius1=r1,
radius2=r2,
depth=depth,
enter_editmode=False,
align='WORLD',
location=(0, 0, 0),
rotation=(0, 0, 0),
scale=(1, 1, 1)
)
bpy.context.object.name = name
return bpy.data.objects[bpy.context.object.name]
def populate():
# populate the scenes with cones
# - fixed attributes = [r1]
# - stepped attributes = [r2, depth, verticies]
m = 2
opt_r2 = [(0, None), (m / 100, f'r2={m / 100}', 'fillet')]
opt_depth = [
(m, f'z-r:{1}'),
(m / 2, f'z-r:{2}')
(m / 10, f'z-r:{10}')
]
opt_verticies = [
(32, '32-gon'),
(128, '128-gon'),
(1024, '1024-gon')
]
...
if __name__ == "__main__":
pass