How can I get one unique combination of lists?

Hello everyone

I’ve got a list of n (depending of model) lists containing each one two lists, each one in its turn containing three elements, that could be numbers or strings. I want to order sets of two triangles that share one side, thus I could build a quadrilateral with one and only one diagonal.

I’ve tried to perform sets operations, turn the arrays and objects into strings, filter the lists, but nothing works for me.

I have a pair with the list [ [0,1,2 ] , [ 0,5,6 ] ] , but down there the pair is repeated as [ [0,5,6 ] , [ 0,1,2] ].

I don’t want to have repeated lists, it doesn’t matter which of the two options I can get. I just want to have only [ [0,1,2 ] , [ 0,5,6 ] ] or [ [0,5,6 ] , [ 0,1,2] ] , and thus for all items.

I want to clear up that in the list of the image I’ve got all quadrilaterals within the polgon that have one and only diagonal, being the numbers the indexes of lines. It’s only that the lists, all of them containing two lists of three elements, are repeated with two different orders

Parejas de triángulos que tienen un lado en común: Pairs of triangles that share one side

Thanks in advance

@joavegaco See if this helps:

I tried to do that, but, instead item list I can return to original list, it operates with deepest level of elements and I get undesired results. I tried to convert the array of flatten lists but the same problem.

I mean, I want to work the deepest level lists as if they were items. Suppose that if I have a list containing [1,2] and [2,1], I need a list only containing [1,2] or [2,1], but not both. Now, suppose that 1 and 2 are not items but lists of elements, any quantity of them you want.

@joavegaco I’m not able to understand you.
Can you share your Dynamo file and a sample Revit file?

Dynamo script:
Sets of triangles.dyn (116.7 KB)

The last node is the one I can’t solve:
Parejas de triángulos que tienen un lado en común: Pairs of triangles that share one side

Revit file (Model with lines):

polígono no convexo.rvt (3.3 MB)

@joavegaco Something like this?
Sets of triangles.dyn (51.3 KB)

I’m not trying to get the sets of objects in Revit or any concrete geometry. I’m trying to get the triangles in terms of retations of lines, for I use the indexes of objects for that goal.

Supose that AB,BC,CD,DA,AC and BD, the signs of lines of parallelogram of the graphic, are the indexes of lines. AB could be 1; BC, 2; CD, 3;…
I already have the combinations of triangles that togheter form a parallelogram or a quadrilateral:
[AB, BC, AC], [AD, DC,AC]
Remember that pairs of letters, in this case, are representations of numbers that are indexes.

My problem is this:
I need: [AB, BC, AC], [AD, DC,AC]
But I have: [ [AD, DC,AC] , [AB, BC, AC] ] , [[AB, BC, AC], [AD, DC,AC] ]

I just need one of both them. I don’t want to have repeated quadrilaterals. And the structure of the problem requires that quadrilaterals only to have 1 diagonal, if they’re convex.

I thank you a lot the effort you’re doing to understand me. I’m sorry if I can’t express well my ideas.

@joavegaco Here you go
Sets of triangles.dyn (67.6 KB)

1 Like

That’s great. Lots of thanks. There are nodes I didn’t know they existed. It will be useful for my learning process.

1 Like


Triangle.dyn (40.7 KB)

1 Like