How might someone find the deformed coordinate via Python or otherwise when using a subdivision modifier with the 'show on cage' option?

For example, a subdivided cube with cage enabled and a vertex selected shows the location of the vertex at 1,1,1 but when manually placing the cursor near on the surface it is closer to .5,.5,.5

I know the vertex location needs to be at its non-deformed location for subdivision to even work but would like to get more accurate point locations at the surface without having to apply to mesh.

enter image description here


1 Answer 1


Vertex Parenting

Among other ways can be done with vertex parenting.

Test script, run with mesh in edit mode, adds a vertex parented empty for each selected vert and prints vertex's global location to the console.

import bpy
import bmesh

context = bpy.context
scene = context.scene
obj = context.edit_object
mesh = obj.data
bm = bmesh.from_edit_mesh(mesh)
empties = []
# selected verts
for v in [v for v in bm.verts if v.select]:
    empty = bpy.data.objects.new("Empty", None)
    empty.parent = obj
    empty.parent_type = 'VERTEX'
    empty.parent_vertices = [v.index] * 3
    empties.append((v.index, empty))

# update the scene
for index, empty in empties:    
    print("Vert %d location: " % index, empty.matrix_world.to_translation())

Test result on default cube with subsurf (cat-clark) 3 subdivisions.

Vert 0 location:  <Vector (0.5015, 0.5015, -0.5015)>
Vert 1 location:  <Vector (0.5015, -0.5015, -0.5015)>
Vert 2 location:  <Vector (-0.5015, -0.5015, -0.5015)>
Vert 3 location:  <Vector (-0.5015, 0.5015, -0.5015)>
Vert 4 location:  <Vector (0.5015, 0.5015, 0.5015)>
Vert 5 location:  <Vector (0.5015, -0.5015, 0.5015)>
Vert 6 location:  <Vector (-0.5015, -0.5015, 0.5015)>
Vert 7 location:  <Vector (-0.5015, 0.5015, 0.5015)>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .