# Distance between Element and room boundary

Hello
I am wondering if there’s a way to calculate the distance between the door and the line boundary in front of it?!

Make a 3D view with only walls showing.
Get the doors locations.
The the facing vector of the door.
Invert the vector.
Do a raybounce in both directions.
Get the distance from the location point to the raybounce points.

hi Jacob ,
I actually wanna doing based on the room boundary! and on 2d view!
and I didn’t understand “The the facing vector of the door.”

Rooms are typically bound by either walls or room separation lines. I assumed you wouldn’t mind missing a RSL as it looked as if you were checking clearances (is my closet deep enough kinda deal), and you can’t ‘hit’ a RSL with a clearance as they aren’t built. If you need to take RSLs into account this method might not work, another option is way down below.

I believe that raycasting only works in 3D views. Keep in mind that: Revit is BIM, BIM is 3D, 2D view’s are representations of your 3D data. If you want to draw these clearances in 2D use a detail line by curve and view method, 3D is still needed to raycast though (unless I am mistaken).

https://dictionary.dynamobim.com/#/Revit/Elements/FamilyInstance/Query/FacingOrientation
Basically this tells you which direction the door faces - the vector of the red line you drew.

Another method would be to:

• Get each door;
• Get the to and from room for each;
• Get the perimeter cirves of each room, group them and and build a polycurve from each, extrude them and combine each set of polycurve a into one polysurface (incase there is a donut shaped room);
• Get the doors insertion point and facing vector, reverse the facing vector and scale both vectors to the maximum bounding diagonal or other “extreme” length;
• draw a long line from the insertion point of the door by the two vectors;
• Split both of the two lines with the polysurfaces from the room boundaries;
• Get the curve segment at index 1 from each line (index 0 should be the small segment that leads from the door to the wall the door is in);
• Draw your detail lines in Revit or do more upstream calculations (perhaps filtering out doors with adequate clearance based on line length) as desired.

Lacing and list levels will matter quite a bit on all of the above - in my head it goes 5 levels deep at one point (I could be off as I haven’t built either of these).

hello Jacob,
thank you so much i am working on it now and i will let you know soon if something went wrong but thanks a lot

1 Like