Sort objectID

Hello everyone. I’m looking for a scrit to change ObjectID based on a distance. I have a Rhino file with 2000+ curves (different size of circles) and I have to pass it to a custom postprocessor for CNC machining. I have the NEED of process each curve in a sorted way (from top to bottom) and I used a tool to (external program) to do the sort. For checking it I used a scrit to group each element to a new group and the sorting looks good. I have Group1 on top and so on descending on Y. But if I pass that curves to my postprocessor the order is different. The only thing I see wrong is that ObjectID under proprieties (for example 33519747-75a2-45f9-b450-c679e1af182d (6786)) is not sorted like my groups. I suppose the postprocessor uses the id number (decimal) for processing queue.
Is there a way to change the ID or sort the ID number on a distance basis?
THank you!


I’m not sure of I follow you, but a possible route is to work around the issue with the order in which objects are stored in a document and the subsequent order in which they are exprted.

Take the ordered list of objects and in reverse (iirc) order copy them to the document. Delete the originals.
So now you have the copied objects added to the document in order.


You cannot “change” the ids of objects. But you sort these objects spatially. How this this is done depends on what scripting language. But basically you want to create a array/list that contains one or more data structures/classes. These structures/classes will hold 1.) the object id and 2.) some point that you will use to sort by. Then, sort the array/list by the point.

What scripting language are you using?

Ok, I did some stuff with python and C# so I can use both. Now I’m pushing the postprocessor maker to fix it but yesterday I was in hurry.
So I should sort the objects and then create a copy to get a new ID for each object (that should be sorted too)?