Filtering all points from a list

I’m getting a list of intersections as points, but the list also includes lines and empty lists. My question is how to keep a list of just the points?

You can convert the values into Strings and check if the first character is a “P” and if not, remove the item from the list.

or

Using the element.GetType() method, which would return an ‘Autodesk.DesignScript.Geometry.Point’ item which can be used for filtering.

Both methods would need to adapt to your list levels. :slight_smile:

1 Like

RemoveIfNot should do the trick.

https://dictionary.dynamobim.com/#/BuiltIn/Action/RemoveIfNot

You may or may not want to run a List.Flatten in there as well.

2 Likes