Code running the wrong way round due to minus Easting value

Hi all,

I have a problem with this code when I have minus values for the eastings it renames the type mark from right to left on screen not left to right. Please see below.

Is there a global solution I can use to stop this from happening in all scenarios regardless where the family lies in space.


@James_Washbourne You can Bump your previous post instead of asking same query twice Specifying a co-ordinate system origin by point for bounding box routine

Thanks :slight_smile:

Sorry Kulkul,

I did see it and I played around with but I can’t get it work. the translate just changes a position of a point, not how Dynamo sorts the family out from left to right on the screen.

I’m a bit lost if I’m honest.

Thanks again

@James_Washbourne Why don’t you use Model line to renumber your elements. Here is an example of piles using model line

1 Like


Thanks for the link. I’ve tried to adapt that code and it runs without warnings but it doesn’t work, I think it’s because I false values in the first listmap. I’m using version 1.2 I don’t know if that makes a difference.

Please graph below



@James_Washbourne First group by X positions, then sort by Y positions within each grouping
Reverse lists to order them left to right and top to bottom
Numbering.dyn (12.5 KB)


Thanks for this, but I’m still having the same problem as before, its renaming the values from right to left even with your code. I’ve adapted the the Dyn. to start with family types instead of family category and that’s all I’ve changed.

This is a live job and I’ve acquired co-ordinates from the Architect file. Could this be causing the issue?Would the position of the project base point be causing the problem?

I’ve tried to upload the Revit file but it too big, Is there any chance I can forward it to by Wetranfer or something.

Thanks in advanced.

@James_Washbourne You can drop the files in google drive/dropbox and share the link here.


There you go.

Thank you

Since all of your Families are beyond your Project Base Point, why not simply extract your eastings coordinate (i.e. Y of your PBP) abs() it, then add it to your bounding box y points list. This will make all values positive without changing relative distances, and now you can use it as the key list for List.SortByKeys.

This will work regardless. Only limitation would be if you have a Family Instance placed before the PBP as it would obviously still have a negative y value despite the addition. If you want it bullet proof, the solution here would be to join the PBP y value to your bounding box list of y values then find the minimum value and use that for the addition.


The end is near surely! haha

I’ve taken what you all said on board. What I think will solve it is having a family of some description in the bottom left hand corner, get it positions which is easy enough, then get some vectors values to the piles to find the relative x,y, co-ordinates form the base family and try and sort it that way.

This has work fine for the top row of piles but not the middle row. It might be lacing problem somewhere. what I’ve found in the second list.sortbykey node there’s the same family listed 3 times. See below. I’ve also attached the DYN.

ThanksNumbering vectors.dyn (18.5 KB)

Combine the approach I suggested with @Vikram_Subbaiah (sorting by X then Y) and that should do it


That’s what I thought I’d done in the Numbering vectors.dyn above.


@James_Washbourne This should work. Eliminated a List.Reverse node from the definition I’d provided above.
Numbering.dyn (11.9 KB)


Thanks for this it works beautifully. Do you think this will work in this manner regardless where the project base point is positioned or would it be an idea incorporate your code above with my one using vectors from a known point. I trying to get to a stage when I have a code that’s bombproof in all scenarios.

Thank you.

Thomas & Kulkal,

Thanks for your input gents, much appreciated.


1 Like