I want to create a curve with 4 points in python. So i figured that I could subdivide a primitive curve twice and delete one of the points. The code below kinda works by selecting a single point and deleting it. Well, except that by default all points are selected so this simply deletes all the points. I suppose that I can loops through all the points and handles and deselect that way. But you can deselect everything by a single mouseclick (or a single command in object mode), so isn't there a easier/more elegant way to do this?
bpy.ops.curve.primitive_bezier_curve_add(enter_editmode=False, align='WORLD') my_curve= bpy.context.active_object bpy.ops.object.editmode_toggle() bpy.ops.curve.subdivide() bpy.ops.curve.subdivide() my_curve.data.splines.bezier_points.select_control_point = True bpy.ops.curve.delete(type='VERT') bpy.ops.object.editmode_toggle()