Remove Lattice and apply Deformation

Things seem to change - documentation does not.

I’m trying to make a Lattice-Deformation permanent and remove the Lattice, all in Python.
I already tried a lot of combinations of applyDeform (obviously deprecated ?), clrParent and update, but nothing seems to work.
I get some error messages, i should use the modifiers instead, but i can’t figure out how. Also the documentation seems out of Date.

This snapshot down here gives the idea. After selecting several edges as guide, the python-program already moves the chosen lattice to the target-object, obeying the object’s surface-structure.
All i need is the last step, an remove the lattice.

have you tried the Modifiers module?

also, you can get the mesh thats displayed with
me= Mesh.New()

Just realized, that it’s hard trying finding the modifiers-module in 2.41.

Some Remarks.
Parenting a mesh with a lattice-deform is a virtual modifier. As long as the modifier ist virtual, there seems to be no way to apply the modifier (in 2.42).

So, all you have to do is to make this modifier real:

myMeshMod = myMeshObject.modifiers
mod = myMeshMod.append(Modifier.Type.LATTICE)
mod[Modifier.Settings.OBJECT] = myLattice

Even a real modifier you can’t apply (or i just don’t know, how to do).
But the script does a few steps more, which mostly get confused…
and so far, that is quite a lot.

Added to epydocs, second example