Advanced Sorting w/ Code Block or Python

I am trying to assign the correct beam number to my lines loads that are in my model but they are not in the correct order.

I need help creating a code block statement that will do the following:

while holding the first value in my watch nodes (i.e. x1.1 , y1.1 , xx1.1 , yy1.1)
loop through the values that are part of the beam start and end X and Y coordinates with an if statement similar to below.

if x1=x1.1
if y1=y1.1
if xx1=xx1.1
if yy1=yy1.1

Once all the if conditions become true then I would like to get the number from SetIntersection.

For example:
When the 4th number that is part of the beam start and end X and Y coordinates become equal to the the 2nd number in my line load start and end X and Y coordinates I would like to obtain the number 7 in SetIntersection and assign it to a list.

The final list will be in the following order. 1,7,2,14,4

Here is a link to my Revit 2019 test model and Dynamo Script.

I tweeted one solution for this yesterday… And there is a verb I never thought I’d use too.

List.GroupByKey is your friend here. :slight_smile:

Can you be more specific? I don’t see how this is related to what I am trying to do.

Once you download the model, try clicking on the beam in plan that has a line load on it. Then take at look at the project browser on the left and view the “Unique ID” for that beam. I am trying to assign that value to the “Beam Unique ID” that is a parameter for the line load that is associated with that beam. Make sure that you have the line loads turned on in the visibility graphics under the analysis tab

Please don’t create duplicate posts. Reorganizing Lists is the same situation and you are just copying and pasting the same posts in each.

1 Like

That is correct. No one seems to know how to solve this issue. Thanks for your reply