Sort by X,Y

Hi guys. I have another challenge. I need to sort some rectangles. What I need to get done is this: select all objects and name them consecutive, like Sheet 01, Sheet 02, etc.

Here is my .3dm

Example.3dm (78.9 KB)

Hi @Tudor_Chirila,

See attached script. 2 things are tricky here:

  1. I assume you want to label them XY from upper left - in order to do it the X sorting method had to be tricked by inverting the X values before sorting and then reverted back after sorting points
  2. since your rectangle sizes are not the same or not aligned, the Y value (I use centers) needs to be rounded to a value that makes all 'Y’s equal per each row. In the sample file a value of 500 does the job

The dots are created for testing purposes only - you can delete/comment it out.



SortXY_and_Name.rvb (1.3 KB)

Thanks for the quick reply. I was trying to sort it out, but i had some issues in the process.

Just Drag&Drop the RVB file in your Rhino model

What is the problem on your end ?