I know basically nothing about python but seeing other questions/answers I think this might be possible. I am wondering if it can be used to select an object based on the rough location of it's origin.
What I have is a series of objects aligned in a grid like this:
They have just been split from the same object and so their names are object.001, object.002, object.003, etc in a random order. After doing 'Origin to Geometry' all their origins will roughly align in a grid but not perfectly on specific coordinates.
The objects were all originally separated by 15m so the coordinates of "A"'s origin will always be between X (-7.5, 7.5), Y (-7.5, 7.5) and Z (-7.5, 7.5); the coordinates of "B"'s origin will always be between X (7.5, 22.5), Y (-7.5, 7.5) and Z (-7.5, 7.5); etc.
What I want to do is rename the objects so that the "A" object is called "1", the "B" object "2", the "C" object "3" and so on.
Is it possible to have a script that selects an object if it's origin is on a specific range of coordinates, e.g "A"'s XYZ will be between (-7.5 , 7.5, -7.5) and (7.5, -7.5, 7.5) and then renames it to a specific name?
The names are irregular and don't follow a pattern so I assume a script like this would be the same segment copy-pasted as many times as necessary with the coordinates and names changed manually on each iteration. I need a script for this because I do this process with multiple objects split into separate parts so it'd be much quicker if it could be automated
TL;DR How to use Python to select an object within a specific cubic area
I've found the same question with an answer but it's from 6 years ago and the script doesn't work on blender 3.5: Select objects in a specified region with python
object.001
isA
to begin with? $\endgroup$