0
$\begingroup$

Assuming that I have selected a bone in the scene, how can I extrude it either from either tail or head and position the new bone somewhere in the space using Blender's Python API?

In Edit Mode, I tried the following but nothing happens:

newBoneLocation = (1, 1.5, 1.2)
bpy.ops.armature.extrude_move(ARMATURE_OT_extrude={"forked":False}, 
TRANSFORM_OT_translate={"value":(0, 0, 0), 
"constraint_axis":(False, False, False), 
"constraint_orientation":'GLOBAL', 
"mirror":False, 
"proportional":'DISABLED', 
"proportional_edit_falloff":'SMOOTH', 
"proportional_size":1, 
"snap":False, 
"snap_target":'CLOSEST', 
"snap_point":newBoneLocation, 
"snap_align":False, 
"snap_normal":(0, 0, 0), 
"gpencil_strokes":False, 
"texture_space":False, 
"remove_on_cancel":False, 
"release_confirm":False, 
"use_accurate":False}`

I'm not sure if I should somehow select either the tail or the head in Edit Mode before executing the above command

$\endgroup$
0
$\begingroup$

It turns out it is not hard to do this using Python. I did it using the following instead:

newBoneLocation = (1, 1.5, 1.2)

bpy.ops.armature.extrude_move(ARMATURE_OT_extrude={"forked":False}, 
TRANSFORM_OT_translate={"value":newBoneLocation, 
"constraint_axis":(False, False, False), 
"constraint_orientation":'GLOBAL', 
"mirror":False, 
"proportional":'DISABLED', 
"proportional_edit_falloff":'SMOOTH', 
"proportional_size":1, 
"snap":False, 
"snap_target":'CLOSEST', 
"snap_point":(0, 0, 0), 
"snap_align":False, 
"snap_normal":(0, 0, 0), 
"gpencil_strokes":False, 
"texture_space":False, 
"remove_on_cancel":False, 
"release_confirm":False, 
"use_accurate":False}`
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.