get vertices coordinate after deformation

Hi everybody !

I try some away to get access to vertices coordinate before ( original meshes ) and after deformations ( modifiers, blendshape , softbody or cloth)

I try for example this code on a cube :

bpy.context.object.data.vertices[0].co

or

bpy.context.object.data.vertices[0].undeformed_co

and I always get the same coordinate result even if I put some shape keys , deform modifiers ( example: displace ) or cloth. It’s only change if I modify the “Basis” key shape ( so the original meshes vertices ).

Somebody know a way to access to this informations ?

After many research and changing my keyword in google , I find this article:

Where a guy show this code :

import bpy
C = bpy.context
ob = C.object

print(ob.data.vertices[0].co, "- Vert 0 (original)")

me = ob.to_mesh(scene=C.scene, apply_modifiers=True, settings='PREVIEW')
print(me.vertices[0].co, " - Vert 0 (deformed/modified)")

me.transform(ob.matrix_world)
print(me.vertices[0].co, " - Vert 0 (deformed/modified, world space)")
 bpy.data.meshes.remove(me)

If I understand , you need to create a datablock copy of your original mesh with the option " apply_modifiers" at True. Apply modifiers don’t mean only modifiers , because it’s apply blendshape too.

you could look at the bmesh module, if i’m not mistaken it allows to apply specified things to the mesh but only in memory without the need to create an additional mesh datablock.

import bmesh
bm = bmesh.new()

bm.from_mesh(...)
# - OR -
bm.from_object(...)