# Filtering a List by another List

**URL:** <https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338>\
**Category:** Lists-Logic\
**Created:** [January 10, 2020, 5:38am UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338 "2020-01-10T05:38:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![A.Sh](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@A.Sh](https://forum.dynamobim.com/u/A.Sh)\
**Post date:** [January 10, 2020, 5:38am UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/1 "2020-01-10T05:38:08Z")

</div>

Hey guys I’m sure this is a repetitive question but I am getting frustrated as it’s very simple but doesn’t work. Would you plz have a look at the attached screenshot and let me know why I get False answer while the item is obviously included in the List. Thanks

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/9/a93b1cab2ec1b80dfed1e655896b55b27822d15d.jpeg)

---

<div class="post-metadata">

**Author:** ![Jan\_Secnik](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jan_secnik/32/55692_2.png) [@Jan\_Secnik](https://forum.dynamobim.com/u/Jan_Secnik)\
**Post date:** [January 10, 2020, 7:24am UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/2 "2020-01-10T07:24:28Z")

</div>

Hi, you cant use equality with points (as points), but you can use equality using X, Y Z coordinates of points.

Something like this:

List of Points X == PT X &&  
List of Points Y == PT Y &&  
List of Points Z == PT Z

Also to avoid further errors use Math.Round to some precision.

---

<div class="post-metadata">

**Author:** ![stillgotme](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@stillgotme](https://forum.dynamobim.com/u/stillgotme)\
**Post date:** [January 10, 2020, 7:35am UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/3 "2020-01-10T07:35:54Z")

</div>

why not use the builtin OOTB node?  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/b/7ba7d52cdbd1df3e794a10a5d59e9cdd78ee90a8.png)  
You are dealing with geometry hence this would be most suitable for you

---

<div class="post-metadata">

**Author:** ![HalfBaked](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/halfbaked/32/87780_2.png) [@HalfBaked](https://forum.dynamobim.com/u/HalfBaked)\
**Post date:** [January 10, 2020, 9:25am UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/4 "2020-01-10T09:25:22Z")

</div>

or you could use a dash of python

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/0/a029b0ef71fd5d18d2c568b28c1f33056eaf4c6c.png)

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [January 10, 2020, 9:38am UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/5 "2020-01-10T09:38:13Z")

</div>

You could use the node, “allindicesof” to get the correct index.

---

<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:** [January 10, 2020, 2:44pm UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/6 "2020-01-10T14:44:47Z")

</div>

Another common issue you encounter when comparing geometries is rounding or precision. Precision between Revit and Dynamo differs and can result in slightly misleading values. Sometimes these values get rounded and _look_ the same but mathematically are not. To avoid dealing with rounding discrepancies you can convert the geometry to strings and compare the string values as they will usually be the same.

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [January 11, 2020, 10:15am UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/7 "2020-01-11T10:15:31Z")

</div>

You can also use the method Geometry.DistanceTo()  
example  
OUT = [x for x in IN[0] if x.DistanceTo(IN[1]) \< 0.01]

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [January 11, 2020, 4:33pm UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/8 "2020-01-11T16:33:27Z")

</div>

In design script: `Geometry.DistanceTo(PntLst, Pnt)<= Tolerance;`

Converting the points to strings with two String.FromObject would also allow for an equality test and might be faster than a geometry comparison.

---

<div class="post-metadata">

**Author:** ![A.Sh](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@A.Sh](https://forum.dynamobim.com/u/A.Sh)\
**Post date:** [January 13, 2020, 12:50am UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/9 "2020-01-13T00:50:33Z")

</div>

Thanks everyone. All comments were kind of helpful but I simply fixed the issue by changing geometry to string. using node “string from object” node. @stillgotme Geometry.isalmostEqualTo is also a quick solution. Thanks.  
@HalfBaked Thanks buddy but I am still a beginner in using Python so couldn’t try your idea. Thanks a lot. Thanks @Daan but didn’t get how that node is helpful in this case. Thanks @Nick_Boyts That was a good point to bear in mind. Thanks guys @jacob.small @c.poupin

---

<div class="post-metadata">

**Author:** ![A.Sh](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@A.Sh](https://forum.dynamobim.com/u/A.Sh)\
**Post date:** [January 14, 2020, 11:09pm UTC](https://forum.dynamobim.com/t/filtering-a-list-by-another-list/45338/10 "2020-01-14T23:09:22Z")

</div>

Hi everyone, Thanks again for your help. Just to share the result of the idea I’ve been working on please have a look at the image below. The idea was to create a Dynamo graph which can develop the cable trench model in Revit using a set of setout points. Still needs more work but there are many other usage of this idea like modeling Channels.

 ![22 Cable trench automated modeling](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/7/a7a2e347e67ff7deb11f7b8b44dd7148caa517b7.jpeg)
