Reorder curves order in Rhino?

I do need to export as .dxf some circles that I do created in Rhino and I need to import this dxf files in a CAM program for drilling.

The issue is that this circles are created random and I do need a way to change the order of them according to x-y coordinates to don’t make the machine to jump from one place to other and I can’t find any command in Rhino for reordering the geometry. Please help.

Normally this is something the CAM program should handle, but if not you can only do this easily by making a script that removes the objects from Rhino, sorts them and recreates them in order. There are many examples already if you search the forum that sort based on proximity, is that what you need?

Yes, something like this. The problem is that I do have quite a lot of holes, more than 100/file, and I do need to keep in sync the Rhino drawings and the dxf files as I do need to take measurements from Rhino to program the depth of drilling into the CAM. So, in my CAM software, the circles are imported as “Geo 1”, “Geo 2”, “Geo 120”, etc.

I do created a Grasshopper definition that can select one by one every circle and measure his depth, but I can’t find a way to sort the order of the circles from the Rhino file.

I don’t see the problem, if you can sort the curves, so can you sort the data in sync, no? Not sure if you can bake curves in order, this has to be done with a script also, or anemone maybe.

edit: btw: have you checked that the order the curves are now in corresponds to the way your cam program is reading them in? otherwise it’s not sure this is solvable

Quite difficult for me to create one. Any help will be apreciated.

Hello - here’s a quick sorted export - very quick and not tested in real life - please test before relying on this - (587 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"


Thank you for your script. I do tested today but unfortunately it is not reordering the curves. I do exported using this script and re-imported back in Rhino. I do run my Grasshopper definition to check the order and seems to don’t be changed.

reordered.3dm (253.2 KB) (24.1 KB)

I also tried to replicate this definition without success:

Hello - yep, looks like selection order does not do it - try this one - (792 Bytes)


1 Like (21.1 KB)

doesn’t this work?

1 Like

Thank you. Much better now.

This way also work. Thank you.