# How to get the name of the object from its coordinates (in object mode)?

How can I find the name of an object given certain coordinates? What if there was more than one object with its origin at that point?

Thank you and I apologize for any errors: translated with PC!

All objects with origin within a tolerance of cursor.

Simple script to make a list of all objects whose origin is within a tolerance TOL of the scene.cursor_location.

import bpy

from bpy import context
scene = context.scene

TOL = 0.1 # get all objects within 0.1 bu of loc
#use cursor for location
loc = scene.cursor_location

obs_in_location = [o for o in scene.objects
if (o.matrix_world.translation - loc).length < TOL]

print(len(obs_in_location), " at ", loc)
if len(obs_in_location):
for o in obs_in_location:
print("\t", o.name)

• Thank you, but I don't want to use the mouse position: I have a series of coordinates (x, y, z) and I would like to know from script if in a given position there is an object and if there is its name. – Ave Jan 17 '18 at 14:54
• It's not the mouse position it's the 3D cursor. Edit such that loc = (x, y, z) then. The 3D cursor position was only being used as a basic example. There are no coordinates in question. – batFINGER Jan 17 '18 at 14:57
• !!! sorry! Grazie. – Ave Jan 17 '18 at 15:00