# Identifying and Removing Duplicate Lines in a List

**URL:** <https://forum.dynamobim.com/t/identifying-and-removing-duplicate-lines-in-a-list/100783>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [May 8, 2024, 9:33am UTC](https://forum.dynamobim.com/t/identifying-and-removing-duplicate-lines-in-a-list/100783 "2024-05-08T09:33:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![szekeressz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/szekeressz/32/180256_2.png) [@szekeressz](https://forum.dynamobim.com/u/szekeressz)\
**Post date:** [May 8, 2024, 9:33am UTC](https://forum.dynamobim.com/t/identifying-and-removing-duplicate-lines-in-a-list/100783/1 "2024-05-08T09:33:57Z")

</div>

Hi everyone,

I’d like to filter out duplicate lines from a list along with their counterparts. I’ve managed to extract one member of each pair, effectively eliminating the duplication. Now, I also want to remove the other member of the pair from the list of lines. To achieve this, I intend to find the indices of the duplicate lines in the original list based on the list of duplicates, but I’m getting ‘-1’ for everything. What could be the solution to this problem?

List.SetDifference also didn’t work. It didn’t take out any elements, but I can see both two are the same(start.p, end.p, vector, length).

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/3/43f960178e8a3ed4f06f60892af91f53a570e95a.png)

---

<div class="post-metadata">

**Author:** ![A.C3D](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/a.c3d/32/196902_2.png) [@A.C3D](https://forum.dynamobim.com/u/A.C3D)\
**Post date:** [May 8, 2024, 9:58am UTC](https://forum.dynamobim.com/t/identifying-and-removing-duplicate-lines-in-a-list/100783/2 "2024-05-08T09:58:49Z")

</div>

Hi,  
I can’t understand your objective well. Could you share the Dynamo file?  
Have you tried using List.UniqueItems?

---

<div class="post-metadata">

**Author:** ![szekeressz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/szekeressz/32/180256_2.png) [@szekeressz](https://forum.dynamobim.com/u/szekeressz)\
**Post date:** [May 8, 2024, 11:03am UTC](https://forum.dynamobim.com/t/identifying-and-removing-duplicate-lines-in-a-list/100783/3 "2024-05-08T11:03:13Z")

</div>

[Building.dyn](https://forum.dynamobim.com/uploads/short-url/9GbqGbSD7u9jb2FWBGf6CPuHIYc.dyn) (104.4 KB)  
[fh\_alap.dwg](https://forum.dynamobim.com/uploads/short-url/6e2129UfVTyI9hCMzu75LA7el31.dwg) (747.8 KB)  
[REVIT\_ép.rvt](https://forum.dynamobim.com/uploads/short-url/bdlEgnlJK6tJPMe57Eje6EipRar.rvt) (5.4 MB)

List.UniqueItems output the same list as the original.

---

<div class="post-metadata">

**Author:** ![Vladimir](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vladimir/32/147600_2.png) [@Vladimir](https://forum.dynamobim.com/u/Vladimir)\
**Post date:** [May 8, 2024, 1:40pm UTC](https://forum.dynamobim.com/t/identifying-and-removing-duplicate-lines-in-a-list/100783/4 "2024-05-08T13:40:32Z")

</div>

Like this?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/e/fe2a9da859aec4a0b043d0e413cc6cbdbdda2e00.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [May 8, 2024, 1:47pm UTC](https://forum.dynamobim.com/t/identifying-and-removing-duplicate-lines-in-a-list/100783/5 "2024-05-08T13:47:43Z")

</div>

Geometry objects don’t compare well as there are inherent rounding issues. You’ll want to convert them to something comparable (like a string) in order to check for matching indices.

---

<div class="post-metadata">

**Author:** ![Vladimir](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vladimir/32/147600_2.png) [@Vladimir](https://forum.dynamobim.com/u/Vladimir)\
**Post date:** [May 8, 2024, 2:02pm UTC](https://forum.dynamobim.com/t/identifying-and-removing-duplicate-lines-in-a-list/100783/6 "2024-05-08T14:02:14Z")

</div>

Or this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/7/47c1a476d17726168e0f7e725adabb67f3ca3677.png)
