Skip to main content
deleted 47 characters in body
Source Link
MattA
  • 73
  • 1
  • 4

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

bpy.ops.object.mode_set(mode = 'OBJECT') 
ob.select = True
scene.objects.active = ob  

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.curve.select_all(action='DESELECT')
curve.points[0].select = True
bpy.ops.object.hook_add_selob(use_bone=True)

This returns the following error:

RuntimeError: Error: Requires selected vertices or active vertex group

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

bpy.ops.object.mode_set(mode = 'OBJECT') 
ob.select = True
scene.objects.active = ob  

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.curve.select_all(action='DESELECT')
curve.points[0].select = True
bpy.ops.object.hook_add_selob(use_bone=True)

This returns the following error:

RuntimeError: Error: Requires selected vertices or active vertex group

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')
bpy.ops.curve.select_all(action='DESELECT')
curve.points[0].select = True
bpy.ops.object.hook_add_selob(use_bone=True)

This returns the following error:

RuntimeError: Error: Requires selected vertices or active vertex group
Source Link
MattA
  • 73
  • 1
  • 4

How to set active control point of a curve using python

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

bpy.ops.object.mode_set(mode = 'OBJECT') 
ob.select = True
scene.objects.active = ob  

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.curve.select_all(action='DESELECT')
curve.points[0].select = True
bpy.ops.object.hook_add_selob(use_bone=True)

This returns the following error:

RuntimeError: Error: Requires selected vertices or active vertex group