@Tanookh wrote:
... I want to add numbering to it in a sequential manner,
from left to right and then bottom to top.
....
Correct me if I'm misunderstanding, but the image and drawing show the numbering being first from top to bottom with the 0° set and then left to right with the 90° ones. Can you clarify?
One three-part glaring error: 1) If the green and magenta Text objects already exist at rotations you want to remain, there's no need to check the rotation and correct it to the more readable direction [if that's what the rotation check is supposed to be for] -- just use the rotation of the existing ones for the new ones. 2) Even if it were necessary to do that, it shouldn't check the relationship to 180° [and entity data would never store such a thing as less than negative 180°, nor for that matter as a negative value at all], but rather whether the rotation is greater than 90° but not greater than 270°. 3) It's written as though rotation numerical values in entity data are in degrees, but they're in radians.
You have two B19's -- is that intended?
There's no accounting in the code for right-justification of the new ones [see the 72 & 73 entries in entity data], nor of moving the insertion point off. Are the super-tiny ones the result of the code you posted? Is there some way of "writing to" ChatGPT and describing what it got wrong?
It would need to separate the selection into a set of things at 0 [same in ° and radians] rotation and another set at 90° [i.e. (/ pi 2) radians] rotation. Then it would need to sort the 0 set by insertion-point Y coordinate, and do its thing with those, then sort the 90° set by insertion-point X coordinate, and do its thing with those.
Kent Cooper, AIA