To convert any flat mesh to a Bezier curve, we need to perform several operations: first, convert the mesh to a curve, then convert its points to Bezier format (with “handles”), and, optionally, recalculate the number of control points to remove points that don’t affect the curves shape. All of this can be done in a single-click with the help of a simple script.
Let’s say our currently selected object is a flat mesh that we want to quickly convert to a Bezier curve.
We can convert a mesh to a regular curve using the universal object transformation operator “convert()”.
|
1 |
bpy.ops.object.convert(target='CURVE', keep_original=False) |
In the “target” parameter, we specified the type of object—a curve, we want to convert the active object to. We also specified “False” in the “keep_original” parameter so that the original mesh is automatically deleted after the conversion.
Now, to convert a regular curve into a Bezier curve, we need to assign the “Bezier” type to all of its splines (individual contours).
Let’s loop through the curve’s splines and assign the desired type to each.
|
1 2 |
for spline in bpy.context.object.data.splines: spline.type = 'BEZIER' |
The next step is to reduce the number of points using the “decimate()” operator.
The decimate operator works in object edit mode, so let’s switch to edit mode before calling it, and return to the object mode after.
|
1 2 3 |
bpy.ops.object.mode_set(mode='EDIT') bpy.ops.curve.decimate(ratio=0.5) bpy.ops.object.mode_set(mode='OBJECT') |
Pay attention to the value of the ratio parameter in the “decimate” operator. It should be specified in the range from 0 to 1, and the lower its value, the fewer points will remain on the curve. Values in the range of 0.5–0.7 are usually a good balance between the exact match of the curve’s shape to the original contour and the number of points on the curve.
If we now switch to the edit mode, we’ll see that all the control handles on the Bezier curve points are positioned at different angles. To convert them to regular, straight handles, we need to change their type.
Let’s loop through all the points and set the type to “AUTO” for the left and right control handles.
|
1 2 3 4 |
for spline in bpy.context.object.data.splines: for point in spline.bezier_points: point.handle_left_type = 'AUTO' point.handle_right_type = 'AUTO' |
Now, the resulting Bezier curve has a completely familiar appearance and controls.

.blend file on Patreon