Finding elements just outside of space

Hi Everyone,

I’m trying to create a script which will count number of sockets in all spaces in my project. I found a lot of solutions for doing that, however some of the sockets are placed just outside of the space (15mm into the wall) like on the photo below and are not picked up by the script.

I am using the Elements in Space node to get all elements in the space as shown below. Is there a way to maybe extend the spaces by 20mm in each direction so it picks up these sockets in the walls? Or any other solution so these sockets are counted?

Thanks for help!

Translate the origin point of the socket in to the space via the normal vector of the family. There is a function in the Revit API to check if a point is in a space (https://www.revitapidocs.com/2015/33c97031-a9ad-00d0-4d4a-42522201d2db.htm). If you want to extend the space volumes, then you need go get the geometry of the space, scale this geometry up and then check if a point is in this geometry. I would try the first option.

If you would provide a sample file, I could help you.