Today, I made some progress with the Blender Python API, including realizing simple interfaces and basic controls.

For example, I encapsulated the logic of creating basic objects.

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
def plane(size: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_plane_add(
size=size, # Size of the plane
enter_editmode=False,
align="WORLD",
location=location, # Location where the plane will be added
)
return bpy.context.active_object


def cube(size: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_cube_add(
size=size, # Size of the cube
enter_editmode=False,
align="WORLD",
location=location, # Location where the cube will be added
)
return bpy.context.active_object


def circle(radius: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_circle_add(
radius=radius, # Radius of the circle
enter_editmode=False,
align="WORLD",
location=location, # Location where the circle will be added
)
return bpy.context.active_object


def uv_sphere(radius: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_uv_sphere_add(
radius=radius, # Radius of the sphere
enter_editmode=False,
align="WORLD",
location=location, # Location where the sphere will be added
)
return bpy.context.active_object


def ico_sphere(radius: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_ico_sphere_add(
radius=radius, # Radius of the icosphere
enter_editmode=False,
align="WORLD",
location=location, # Location where the icosphere will be added
)
return bpy.context.active_object


def cylinder(radius: float = 1.0, depth: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_cylinder_add(
radius=radius, # Radius of the cylinder
depth=depth, # Depth of the cylinder
enter_editmode=False,
align="WORLD", # Location where the cylinder will be added
location=location,
)
return bpy.context.active_object


def cone(radius: float = 1.0, depth: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_cone_add(
radius1=radius, # Radius of the cone
depth=depth, # Depth of the cone
enter_editmode=False,
align="WORLD", # Location where the cone will be added
location=location,
)
return bpy.context.active_object


def torus(radius: float = 1.0, depth: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_torus_add(
major_radius=radius, # Radius of the torus
minor_radius=depth, # Depth of the torus
align="WORLD", # Location where the torus will be added
location=location,
)
return bpy.context.active_object


def monkey(radius: float = 1.0, location: tuple = (0, 0, 0)):
bpy.ops.mesh.primitive_monkey_add(
size=radius, # Size of the monkey
enter_editmode=False,
align="WORLD",
location=location, # Location where the monkey will be added
)
return bpy.context.active_object

I also created a Quadric Surface script for visualizing quadric surfaces. I think Blender Python API is promising to be the powerful tool to empower the learning process. I can learn and visualize at the same time, combining abstract math concepts with concrete physical graphs, and even contribute and sell some assets.

For next step, I’m expecting to explore the animation functionality, which really fascinates me.
In addition, the combination of animation and Physical Simulation will be very splendid.
Another direction is Rust, given that its ecosystem for scientific computation is still in the early stage.