Adding Hooks to a Lattice

Hi,

Is there a way to add a hook to each point on a lattice through Python? I’ve tried:

for points in bpy.data.lattices['Lattice.022'].points:
    bpy.ops.object.hook_add_newob()

However tis adds four hook in the centre of the lattice (it has four points). How would I make each hook only control a single point and be right on top of the point?

Thanks
Tom

If you do it thru the UI with the lattice in edit mode, you select a lattice point then add the hook (using the op via the console) and it adds at the selected point. Or the median if you have selected points. How you select points of a lattice with code… had a quick look and have no idea, was hoping it was a select thing like mesh / vertices.

That’s the conclusion I came to as well, surley it must be possible?

Thanks
Tom

Don’t mesh verts get names? Are there any scripts that generate vert groups, how do they find the right verts to add to group?

some thoughts:

you must be in (Lattice selected) EditMode to execute: bpy.ops.object.hook_add_newob()

i think you need to select the Point in Lattice (or put curser there?) from Python Script -> but i haven’t found out how to do this in python