How to select the tip, body or root of a bone.

I am using blender 2.56, which uses Python 3.1, and am working on a script
to build a skeleton. Problem I have is that after I switch the direction
of an armature, I then try to do an extrude, but the extrude occurs at
BOTH ends of the armature. So I need a way to select the tip, root, or
body of the armature . . .

bpy.ops.object.armature_add()
bpy.data.objects[“Armature”].location.z = 7.7 #8.6
bpy.ops.object.editmode_toggle()
bpy.ops.armature.extrude()
bpy.ops.transform.translate(value=(0.0, 0.1, 0.92))
bpy.ops.armature.select_hierarchy()
bpy.ops.armature.select_hierarchy()
bpy.ops.armature.switch_direction()
bpy.ops.armature.extrude(forked=False)
bpy.ops.transform.translate(value=(1.0, 0.0, 0.0))
bpy.ops.armature.extrude(forked=False)

When I try to do this:
>>>bpy.data.armatures[“Armature”].bones[“Bone.003”].select_tail=True
>>>bpy.data.armatures[“Armature”].bones[“Bone.003”].select_head=False

If will not work. I have tried many other ideas, but am not able to find a way
to select the tip, head or tail of the bone. As best I can tell, the functionality
as listed in the previous two lines of code just does not exist, or I am just
using the wrong syntax.

“Time is the fire in which we burn.” Gene Roddenberry

wrong counting Bone.003 does not exist! Bone Bone.000 Bone.001 Bone.002

But nevertheless the select_* = True seams not to be done … so question remains :wink:

By the way, the Info-panesl does not show ani API command if one selects any bone in edit mode,
(or in pose mode)

Though the commands are not rejected … (but visible if afterwards printed) but no effect in the 3dView

The Bone.003 was just an example, so trying it on bone.000 has the same results, which is in fact no results. My goal is only to make sure that when I do extrude, I only get one extrusion, not two. If I can select the tip or root, I should be able to accomplish that.

Setting True does not complain, thus try and see the extrude :wink: ?!

I’d like to know the answer to this too.

I can select between bones with
bpy.ops.armature.select_hierarchy(direction=‘CHILD’) # or ‘PARENT’

but can’t get the tips selected by any command i’ve found.

kesten

When I try to do this:
>>>bpy.data.armatures[“Armature”].bones[“Bone.003”].select_tail=True
>>>bpy.data.armatures[“Armature”].bones[“Bone.003”].select_head=False

It will not work.

of course it won’t, you try to access the wrong data structure. You gotta use edit_bones[“Bone.003”].select_tail=True etc. in edit mode