I'm failing to set the active control point of a nurbs curve using bpy.

For context, I'm trying to add a hook to a selected pose bone. The following snippet demonstrates the idea. A pose bone is already selected:

ob = bpy.context.active_object
curve = ob.data.splines[0]
scene = bpy.context.scene

ob.select = True
scene.objects.active = ob  

bpy.ops.object.mode_set(mode = 'EDIT')
curve.points[0].select = True

This returns the following error:

RuntimeError: Error: Requires selected vertices or active vertex group
  • $\begingroup$ Related blender.stackexchange.com/questions/81395/… $\endgroup$ – Duarte Farrajota Ramos Jul 11 '18 at 12:23
  • $\begingroup$ Thanks for this. There's no equivalent 'active' property on the collection of spline points. bmesh isn't applicable because the curve is not a mesh. $\endgroup$ – MattA Jul 13 '18 at 15:16
  • $\begingroup$ Also, there's no applicable operator under bpy.ops.curve. $\endgroup$ – MattA Jul 13 '18 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.