Create Mesh from Empties

Generate a connected mesh using the world-space positions of empties in a collection.
Broken button... I'll fix it eventually...
import bpy
import bmesh
class OBJECT_OT_empties_to_points(bpy.types.Operator):
bl_idname = "object.empties_to_points"
bl_label = "Convert Empties to Points"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
empties = [o for o in context.selected_objects if o.type == 'EMPTY']
if not empties:
self.report({'ERROR'}, "Select one or more empties.")
return {'CANCELLED'}
active = context.view_layer.objects.active
name_source = active if active in empties else empties[0]
object_name = f"{name_source.name} - Mesh"
positions = [o.matrix_world.translation.copy() for o in empties]
mesh = bpy.data.meshes.new(object_name)
obj = bpy.data.objects.new(object_name, mesh)
context.collection.objects.link(obj)
bm = bmesh.new()
for p in positions:
bm.verts.new(p)
bm.to_mesh(mesh)
bm.free()
obj["source_empty_names"] = [o.name for o in empties]
self.report({'INFO'}, f"Created mesh object: {obj.name}")
return {'FINISHED'}
# Register + run
bpy.utils.register_class(OBJECT_OT_empties_to_points)
bpy.ops.object.empties_to_points()
Description
This Blender Python script creates a mesh object by sampling the positions of empties from a specified collection. It reads each empty’s world-space coordinates and creates vertices at those locations. The script then connects these vertices with edges to form a polyline. Optionally, you can close the loop to generate a face, allowing fast mesh generation from control points or rig markers in 3D space. This tool is ideal for creating guides, light paths, rig helpers, or surface outlines from reference points.
