Sorting lists by XYZ values, returning elements (sorted)

I have run into problems with naming elevation in rooms. I’ve sorted all elevation after orientation and written N, S, E, W in a temp parameter. Hereafter am I trying to sort elevation after their X, Y location. And at the same time, am I trying to sort rooms after their X, Y location. If I can get sorted the two lists objects by coordinates, Will I be able to “name” the elevation after the syntax “Room Name” + " N, S, E, W orientation" e.g. (1.1 – Nord)

I have tried to make a python script where I tried to use designscript commands inside, but I cannot find out how to do that, so help to do this another time would also be good to know.

Rename elevations

Snap000103

Sorry for the mess in my former file, Dynamo 0.81 have som issues not saving… but in %appdata%\Dynamo\backup folder is it possible to get your latest work.
I have now tried some different Things, but problem is, that I need SortByKey to sort XYZ, and I cant figure out how to combine that with sorting the corresponding list with elements. Some of the cool coders on this site might laugh, and think this is to easy… but please try to come with some hints.

Rename elevations

Snap000104

Hi Erik,

I think that the “List.SortByKeyList” node from the Ampersand package will manage that task. Try the below example:

2015-05-02_11-35-21

Thanks Dimitar,

I really hate when I can’t see the forest for the trees, I did try Ampersand, but by using Plane.Origin directly, and that didn’t Work… of course. I even tried to rewrite Ampersand code, for sorting the point x.

But simple as it is, I just need to insert Point.X correctly.

Thanks a lot :slight_smile:

The sorting mechanism now Works…

BUT… looking just at X or just at Y gives wrong sorting, I have to take into account the combination of X and Y.

Does anyone have a clue for how to sort both by X and Y?

We did something similar for piles here: http://dynamobim.com/forums/topic/renumbering-with-filters/

Look at the python script in my response a little down in the thread, it should work.

 

Just remember that when sorting by multiple criteria you’ll have to use the reversed sorting order in your graph, i.e. if you want your results sorted mainly by X and then subsequently by Y, you’ll first have to sort by Y and after that by X. :slight_smile:

I have tried several things now, sorting just dont want to work for me.

Sorting rooms goes one way, sorting elevations goes in different directions… so it is a kind of messy. What am I doing wrong?

I have tried to Jostein/Andreas code, but that has also some problems.

 

dynamo file: Rename elevations - ver4

simple revitfile: Project2

a screen dump showing how different the sorting mechanism is. It should have been in the same order alle five.

Snap000105

 

I have now investigated what is going wrong, and everything comes from getting the coordinates from an elevation. I must do something wrong at that point. Does someone have an idea how to get the right coordinates (X,Y) from an elevation?

Couldn’t test this on your graph as it contained some unknown custom nodes but perhaps this component from package Clockwork may help to retrieve a meaningful location for the view:

ViewPlaneOrigin

Here is a zip-file including my dyf files, in the script is a note with the list of needed packages, but it is the most common ones I have used (which should be default in Dynamo :slight_smile:

SortingProblem

Sorry for my missing nodes, they are included in the below “reply” in a zip file "Sorting Problem"
I didn’t know that you have builded such a node… so I builded my own node “List.XYZByPlane”, which are doing the same.
BUT it is not the solution… something is going wrong retrieving these coordinates.
Thats why I uploaded the smal example file in revit, by measurements can you verify that coordinates is wrong, and that gives the wrong sorting. So is it a Revit problem? Elevation Problem?

this issue is still not solved, but the problem isnt a sorting of lists problem, so I will start another tread. Sorting issue is solved.

I’m having a similar issue, which I can’t seem to sort a point with the X. Did you resolve this and could you share your solution?

Here was the solution it just took a little bit of work.

PointSortX

To help here is one i have just quickly created, it sorts via their positioning to location and it does the sorting by python

.

1 Like