Apply Parameter if element lies within Bounding Box



As the title says I am trying to apply a drawing number to an element if the element lies within a specific Space/ Room/ Zone.

I understand how to set and get the required parameters, but it is a case of the boolean I believe that I am stuck on.

I am thinking that if I could take the bounding box coordinates and prove if the element geometry is modelled inside the region - if true apply the specific parameter value - if false test next region.

Thanks in advance,

To check if an element (represented by a point, actually) is within a bounding box you could use BoundingBox.Contains

Maybe you search the forum for “grouping casework by room location”

That should help

Rather than the bounding box contains I used BoundingBox.Intersects (Cross Product lacing) from the resulting boolean, I am stuck on how to proceed!

Should I use the result into Logic.If ?

I am stumbling because I think there maybe another step involved? - the parameter needs to include the correct room number! how does dynamo track this?!

Peter - I had a look through the forum post and most of it went over my head! still very much a beginner here!!!

thanks again,

The attached file should hopefully serve as a guide for you.

File: RoomContains.dyn

File: Demo.rvt


1 Like

What are you trying to locate in rooms? There’s a node in Rhythm called Element.Room which works great for furnishing and casework and a few others…


Trying to locate the Ductwork!

Ultimate goal is to append a new parameter that can be used in our fabrication processes. It would also translate to our Planning dept. as most of our contracts allow for access to site on a zone by zone basis.

I have gotten to the point with the help of Vikram but feel there is still a step in ensuring the Duct is given the correct Zone/ Space identifier.

A sort of if statement - If Duct lies in Room/Space 1 then name duct accordingly.

The BoundingBox.Contains laced Cross, tests all spaces with all instances of duct and correctly identifies if the duct lies in the region, but I need another step to append the correctly named space to the duct.!



Thomas, going by what you’ve described above using a Bounding box may not be accurate as the extents of the bounding box are determined taking the WCS as reference. If your rooms/spaces/zones are at angles it can be quite misleading.

BoundingBox.ByGeometryCoordinateSystem may be better, but even that may not be suitable for irregular spaces.

Why don’t you consider avoiding the bounding box and use Geometry.DoesIntersect instead.

The example I’ve provided in my earlier reply should help guide you to associate a duct with a room.

Hi Thomas,

You can also try custom node called Tool.GetSurroundingElements from Steam Nodes. It will give you the location of ducts in which room/space it is located. I have created a sample below in which i have two Duct names called SAD (Supply Air Duct) and RAD (Return Air Duct). Good Luck!

Duct System1

Duct System

Vikram, I had tried using the .DoesIntersect previously. But I always got stuck on the referencing the correct space to the correct duct! I guess its all a learning process! and lots of head bashing against a wall until the penny drops!


Kulkul, Thanks massively for the node advice, I have used it and it works! one quick question on the tolerance input - What is the integer referencing? is it proximity to the boundary?!

I will try and clean up the definition when I get some time today and post it if anyone is interested?

Thanks again guys.


Hi Thomas

How did you get on this script?

I have been trying something similar myself but with no joy

Hi Alan,

What are you trying to create something similar. Could you be more specific or create a new topic with screenshot of your workflow instead of hijacking this one.



I’m trying to do the same thing. Locate ducts and pipes in my project.
i noticed that it’s easier to locate ducts and pipes in levels then in zones, spaces … (2D).

in order to do so, i tried to use element.location node to be able to get pipe’s coordinate, but when i connect the results with the boudingBox.Contains i get an empty list.

is there an other way to locate ducts and pipe in spaces ?

Thanks in advance,

@john_pierson is a similar node available for MEP spaces?

Element.Space is also in Rhythm

1 Like

great! Sorry I could not spot it and assumed it was not there

import clr
import Revit
import RevitServices
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
bbs = IN[0]
output = []

for bb in bbs:
	bbx = bb.ToRevitType()
	outline = Outline(bbx.Min, bbx.Max)
	#filter = BoundingBoxIntersectsFilter(outline)
	filter = BoundingBoxIsInsideFilter(outline)
	collector = FilteredElementCollector(doc, doc.ActiveView.Id).WherePasses(filter)
	for i in collector:
OUT = output

@Thomas_Bilbe and @Andrea_Botti hope this could help. Let me know.

Hi Kulkul
I am trying to do the same thing: to ask dynamo to pick up the “system families” elements, such as ducts/pipes/walls ecc, in order to get the room/space they lay in with the purpose of automatically copy/paste the room name to another paramter of my choice. Anyway, I can’t seem to be able to zoom in the 2 images you shared some years ago. Would it be possible for you to help?

Same thing with the Vikram files. It seems they expired.

Thanks guys

Hi @carmineaucello

Those images are old. Might be able to help if you, if you could share rvt file.