# Blender vertex mapping code

This below is my code that is trying to put empties over the verts on the selected mesh but for some reason every time I run the code blender just crashes. I am testing the code on the basic cube.

import bpy
from bpy import context
i = 0
c = 7
obj = context.active_object

while not i == c:
v = obj.data.vertices[i]
co_final = obj.matrix_world @ v.co
obj_empty = bpy.data.objects.new("Point", None)

• It shouldn't crash; it loops forever. i + 1 should be i += 1. But it'd be better to use for v in obj.data.vertices: .... – scurest Jan 23 at 5:17
• .... looping forever while adding an object will ultimately hang or crash blender. Can kill a script by pressing Ctrl-C over the system console. (IMO always have system console open when writing scripts). As above adds empties with global coords Can also make the object the empty's parent obj_empty.parent = obj and then set obj_empty.location = v.co to give empties coords matching the underlying verts. – batFINGER Jan 23 at 6:48