ElementIntersectsSolidFilter is not working

I have created a sphere solid and want to detect is it clashing with wall:

wall = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WherePasses(ElementIntersectsSolidFilter(solid)).FirstElement()

image

However I got an empty list of wall, does any one know why?

I tried bimorph in dynamo too, but seems it doesn’t detect any wall too?

1 Like

@newshunhk , hi

Your Wall has also become a geometry to clash with your sphere! they have to be equal opponents … :wink:

KR

Andreas

strange, if I move the sphere closer then it is possible to detect the wall…

image

Spherical solids aren’t supported by the Revit API ElementIntersectsSolidFilter so you’ll see intermittent or zero results. I’ve not tried the following before but it might be worth checking if its a workaround:

  1. Tesselate the sphere.
  2. Convert it to solid via ShapeBuilder.
  3. Attempt the intersection using the resultant solid.
3 Likes

thanks,
by the way what is the best way to check is there a wall beside a stairrun?

I changed
ElementIntersectsSolidFilter
to
BoundingBoxIntersectsFilter to detect any walls near the stair

which also change from slow filter to quick filter, and no longer need to create solid. It is much faster and everything works fine now!

got an answer why sphere is not good for ElementIntersectsSolidFilter

https://thebuildingcoder.typepad.com/blog/2015/07/intersect-solid-filter-avf-and-directshape-for-debugging.html