Python - Clear duplicate elements from a list of lines

How can duplicate geometric elements be cleared from a Python list?
I found a Python solution which works for integers or points.
But it doesn’t for identical lines?

image<a class=“attachment”

href="//discourse-cloud-file-uploads.s3.dualstack.us-west-2.amazonaws.com/business6/uploads/dynamobim/original/3X/e/d/edc695b3ffa92c03a47b470953720d8775744c6e.dyn">Line multiple PY Intersection TEST 07.dyn (5.1 KB)

A sort of work-around is to convert the lines to “strings” and compare the strings like so:

Inspired by:

1 Like

So the ‘StringFromObject’ node reduces geometry to a textual desciption of geometry? Thus duplicate lines, despite of their different IDs, do have the same ‘describing string’ and would therefore be reduced to one line.
Is that right?

Yes that is correct :), though it is not the string i pass out of the python node, that is in fact the geometric line :slight_smile:

I would however make sure to still keep my geometry “alive” either through the python code or some bool-masks, as a “string” defining your “line” is not of much use. :slight_smile: