Number piles as per Certain Conditions

I want to automate the numbering of pile, first as per X coordinate
and then according to y coordinate, if i find any group then i want to use above criteria first locally within the group and then globally, how can i get it done

Currently i am not sure how it is being numbered

The algorithm looks flawed to me above, as it is sorting the pile caps a bit arbitrarily. If we sort caps by X then Y, then the cap with 15 should come after the one with 8 as it is closest to the X side. A human had to make the conscious decision to work in such a way.

Imagine you have to instruct a computer to work in the way shown above (talking, not code). How would you do it? Once you solve that part, begin thinking of the code.

@pics.munmun I’ve de-flagged my reply as a solution. Feel free to have an attempt and share it, and the community will no doubt be able to help you further.

1 Like

I’ve done a similar script for numbering columns. The issue you run into there is not a algorithmic way to describe the where a new Y row start. I made an attempt to split the points up using a quadtree, but the results were underwhelming for the amount of coding.

Gavin is right. The best thing to do is to manually determine the number of rows. Sort those out by the overall bounds to groups. Then just sort the group members by X.

Another alternative, is to draw detail lines representing the center lines of rows. And sort based on the parameter ratio value of the closest point on the lines. I had to use this method when I few of my older engineers on staff insist on numbering based on a spiral system.

1 Like