List.Sort Not Sorting Nested Lists the Same

Hi.
Dynamo beginner trying to figure things out and finally got stuck.

I have attached my graph.

My problem is at the ‘Sort Conduit Lists by UniqueID’ group. This list is made up of conduit and all connected conduit. So I am attempting to sort the nested lists the same so in the next step the duplicates can be eliminated.

I had this working find when I had a couple small runs of conduit. I’ve been playing around with it more and it has started to mess up the sorting.

I’ve read a little on lacing and messed around with the settings for that, but that didn’t fix my problem.

In my project I have 6 runs of conduit. 4 runs have 3 elements, 1 run has 23 elements, and 1 run has 15 elements. It seems that the 23 element and 15 element runs are not being sorted the same from what i can tell.

I appreciate any help to get me pointed in the right direction.

Sorry you can’t make out the image. So here is one you can make out.

you dont need to sort, you need to group by key

After use the ‘ELEMENTS IN CONNECTED NETWORK’ node?

That lists the connected ‘runs’ of conduit (conduit and fittings) in different orders. So if I group by key won’t that group different elements together?

So my end goal is to create a list of all the conduit runs (there included elements conduit and fittings) in the project.
From what I have found so far is you can pull all the elements from a conduit run using the ‘Elements in connected network’ node. So my work around for this was to select all the conduit in the project and then make a list using ‘Elements in connected network’ for all the conduit. This creates multiples of the same list just in different orders.
I am now trying to sort each of the list by something (I said their ID because that was my original thought it can be something else) so I can then eliminate the lists that are identical. So I will be left with a list that contains the elements in each conduit run.
Hopefully I explained that in a way that makes sense.

I tried out your nodes but they still seem to sort the same way the ones I’m currently using do. Which leaves multiple of the same conduit run just in a different order.

It seems that my problem is being caused when the conduit run starts to have more than 6 elements (conduit and fittings). If the runs are all less than that the lists are sorted and eliminated correctly.

Not sure if this helps.

So I have tried a couple different sorting nodes and uploaded some screenshots with the results.

In the group ‘Trims number of lists down to one for each ‘run’ of conduit (Eliminates the duplicate lists from before)’ should have 7 lists with a total of 43 items. It is counting the big loop 3 times so its adding an additional 42 items (the big loop has 21 elements) for a total of 85.

(Being new to this forum I hope I’m not posting too many updates.)


My current Graph.

Here i am trying some of the different sorting nodes and getting the same result.

Conduit layout. Total of 43 elements conduit and fittings. Just to show what i have modeled. The issue is with the big loop of conduit it is being counted three times.

i presume you don’t have warnings on those elements??

Correct no warnings.
I have also redrawn the conduit to see if it was just a random error and reapplied conduit type. Not sure if either of those things matter.

just to narrow it down…
do you have worksets enabled?
do you have designoptions in the file?

No worksets and no design options.

It’s just a new blank project to test out the graph before actually using it.

why do you think te elements in connected network will create duplicate lists?
also you mention unique Id’s, thats not what i’m seeing tho they are unique :slight_smile:
use the node uniqueId and you will see

So for example one of the conduit runs is a conduit, a 90 degree fitting, and a conduit. So before the ‘elements in connected network’ node i am selecting all the conduit in the project. So when all the conduit runs through the ‘elements in connected network’ node it would select the same 3 elements twice. There are 25 conduits in the project and after the ‘elements in connected network’ node there are 285 items in the list.

Does that make sense?

Good to know on the uniqueID. So i’m not sure what the number is that is referencing the conduit/fittings.

the numbers in green are Id’s
maybe if you try to get the networks first and see what it is made off with the all elements of connected network? i’m not a MEP guy, sorry

ID’s and uniqueID’s well that seems a bit confusing, but thats not important. Thanks for letting me know.

I’m assuming you are saying to get the ‘Conduit Run’ category then run the ‘elements in connected network’ node. Unfortunately that doesn’t work.

From what I have found online apparently (at least with Dynamo) you can’t get all the elements in a conduit run.

found this ( in the same post i guess)
Conduit and fitting for every conduit run.dyn (5.7 KB)

Awesome that seems to work.

Not sure exactly how it works though.

Thanks I appreciate the help.

One thing I learned recently is that List.Sort will not sort elements correctly unless you get the id out as an integer. It comes close sometimes, which had me scratching my head.

I did basically the same thing as @djforeman , just a little different. I took out the id as an integer, then put it back together.

@Marcel_Rijsmus I know that you didn’t make this graph, but I have just recently started to use Revit 2019 and have been trying to use the same graph that I made for 2018, but when I run the Python script

import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

if isinstance(IN[0], list):
	elements = UnwrapElement(IN[0])
else:
	elements = [UnwrapElement(IN[0])]
	
OUT = [doc.GetElement(x.RunId) for x in elements]

I get the following warning.

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 26, in
AttributeError: ‘ConduitRun’ object has no attribute ‘RunId’

I was thinking that maybe in 2019 they eliminated this attribute from the conduitrun, but it doesn’t look like they did.

I’m currently looking for another way to go about this part of my graph, but just wanted to see if you had any idea why in 2019 I get a warning.