Renumbering with filters



I’ve been tasked with setting out approximately 10k foundation piles. I have the coordindates sorted, however, the subscription tools only allow renumbering from survey origin. I have been asked to number the piles from where the contractor is starting to drive from.

I have also been asked to separate a portion of the building which is sequenced first.

This is the first time that I’ve done any programming, and looking through the clockworks package, I can see that something similar has been achieved. I have recreated the script, with the inclusion of some parameter filters (shared parameter for zone, shared parameter for foundation type).

The script selects the correct piles, however the listing function at the end is throwing up errors - any help on this would be greatly appreciated. At the moment, I’m using the unique element ID to number the piles, but the sequence isn’t logical for the schedules.






Thanks in advance




Someone might be able to help if you share what the error is :slight_smile:



The error is in the sort list of lists function. The list created prior to this works fine. Due to the first “sort list of lists” failing (sorting the X value of the points), the second “sort list of lists” (sorting Y value of the points) cannot function.



The problem is not with the List.SortListOfLists node. The nested list you are passing into it does not have the expected format, because the first sublist only contains a single item (the result of your List.Count operation). It looks like the result you want to get is a list of sorted indices, so you would have to pass a list of indices into the first sublist. Have a look here how to do that:



We’ve added the code block, this fixes the “List.SortListOfLists” for both the X & the Y sort, and correctly feeds the “list.FirstItem”.

However, the “Element.SetParameterByName” node inst reading the sorted list as an acceptable input to the element.

Does the list function maintain a relationship with the item in the list and the element’s identification?


My first guess:

Mark is usually a text parameter. The indices are numbers. Try converting them into strings.


I fiddled with this and managed to get some form of definition going. I couldn’t quite understand your List.SortListofLists node, Andreas, but I couldn’t see that you used the “itemgetter” from the “operator” module? I think you can skip the double List.SortListofLists node if you use that.
The way my definition works now it is sorted one way or the diagonal opposite. I hope some other Python gurus can do better so one can sort it anyway possible! :slight_smile: Element.SortByXYZ in Clockwork maybe?




This has fixed the problem pretty much completely. It would be nice to be able to sort from different directions, but this will be great for now.


It’s great to see similar code… thanks for the “sorted” python snippet.

Before your suggestion (did not sort X and Y)







After your suggestion implemented:





Thanks for the snippets and conversation!