Get triangles within a diagonalized polygon according the indexes of segments or lines

Hello everyone.

I want to solve a problem related to triangles and polygons. I’ve built in Revit a polygon completely diagonalized

When I transform the model in Revit to geometry, lines, in Dynamo, I get a list with an index

I would like to get each triangle of the set of lines in terms of indexes of lines.

If the numbers in the graphic are the indexes of the lines, that i get after run Dynamo script, I want my script to get the sets, or permutations, of indexes of lines that form triangles, in form of lists or data.

For example, I would like to get these triangles:

{1,3,4}
{2,3,5}
{5,6,7}

I would like to know that if the fact that the lines of a triangle, unlike the lines of an open polygonal chain, hold an equivalence relation would help to solve this problem.

Thanks a lot

I hope this image may help to understand this problem

I’d usually go the other way around - start with a polygon and then triangulate that to get the individual triangles:

However in your case, where you have a flat list of unordered lines, you’ll need to use the topologic package:

In addition, you’ll need to get a special custom node called WireFaces from here:
https://topologic.app/tutorials/WireFaces.dyf

2 Likes

Thanks a lot. I didn’t know how to transform a geometry to topology, and that tool wil be really useful for me in the activity I’m developing and in the future.

Nevertheless, I think I didn’t explain well my idea. I wanted to get the sets of three indexes, as numbers or integer numbers, of lines that form closed triangles, if you’ll excuse the repetition.

From the numbers pointed within the first rectangle, I wanted to get the permutations of index of lines that form triangles. Sorry if it’s in Spanish but this script is for an activity I must present in my origin country.

Lots of thanks

This is the script I used to achieve my goal