# Delete a single vertex from a spline

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[0].bezier_points[3].select_control_point = True
bpy.ops.curve.delete(type='VERT')

bpy.ops.object.editmode_toggle()


• Actually the looping works fine and isn't so cumbersome. But I'm still interested in a better understanding of manipulating curves, so any answer to my question would still be valued. – DrDress Dec 3 '20 at 10:13
• What really is the question here?. To create a spline from points would not go anywhere using code above Dupe of intention: blender.stackexchange.com/questions/120074/… . blender.stackexchange.com/questions/180148/… – batFINGER Dec 3 '20 at 11:22
• – batFINGER Dec 3 '20 at 12:00
• Thanks for insightfull feedback. I didn't state clearly that I had to use subdivide when I create the curve and then remove unwanted points – DrDress Dec 3 '20 at 12:49
• It's becoming clearer. To clarify further is it also a requirement to subdivide twice instead of once with number_cuts = 2. ? – batFINGER Dec 3 '20 at 14:03