Which object is within which room, and fetching the room name to fill a parameter

I have to know which element of certain categories are in each room of a model. Then I need to place the name of these rooms in each of the components that are within them. As I know there’s some issues regarding walls, and ceilings and floors can be at multiple rooms simultaneously, I thought of crossing points to find the right spot.

I’m not so sure but I guess I succeed in doing it. However I have no clue how to filter the result of the last node with each room, as I flattened the lists many times.

preencheParamAmbiente.dyn (47.1 KB)

I made a subtle modification, flattening less the original lists. Now, as I get in the BoundingBox.Contains node, I’m guessing I have the Casework category at L2[0] and the flattened list of Walls+Ceilings+Floors at L2[1]. The L3 I guess is for the bounding boxes related to each room of the model.

Still I have no clue how to carry on.

preencheParamAmbiente.dyn (49.3 KB)

Hi, seems your problem is solvable, might it be possible to change the grouping names to english because I cant run your script since I dont have your revit files.

Here it is.

And heres a stripped part of my original file: https://1drv.ms/u/s!AtRfQpEohXfRgrkb6qDB7-Msxyezxg?e=lJ46vP

Hi,
You can use this node to know what element geometry(in this case a point) intersects to the room geometry(rectangular box).
A
But I think, with your current script, its very difficult to do what you want to do.

If you send me your revit file, I can try to make a simpler script for you.

-Biboy

I appreciate your offer! A small stripped portion of my model is at https://1drv.ms/u/s!AtRfQpEohXfRgrkb6qDB7-Msxyezxg?e=lJ46vP. I’m sorry I can’t send you the complete model, because it’s under non-disclosure agreement.

Hi,

Please check the script I made. preencheParamAmbiente.dyn (41.8 KB)

-biboy

1 Like

So close!

Got a warning at the last node:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 20, in
StandardError: Unable to transform the body! : ILLEGAL_ENTITY_MODIFICATION – entity modification outside API_BEGIN/END block

Hi when that warning appears, you have to restart revit, its an internal error of revit.

I’ll try it. Meanwhile, one more question if I may… This whole work is to set the room name at a specific parameter my client asked. From which node will I pull the elements to input at SetParameterValue.ByName node?

Where is that specific parameter is located?

It’s a custom shared parameter named “Ambiente” (portuguese for Room), filled by instance. In the end, if this certain wall intersects with a room, the Room Name will fill the Ambiente parameter. And so on to casework, floors, ceilings (might do for plumbing fixtures as well, have to confirm)

Restarted Revit and still got it. Can it be something to do with overlapping walls, floors, whatever?

please try this script preencheParamAmbiente.dyn (41.8 KB)
I dont get any error from the revit file you gave me.

1 Like

If you look at this picture:

You can get the detail at the rightmost python node.

Warned again…

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 20, in
SystemError: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

That’s odd. Memory? Like RAM memory card?

based from your last error, please restart your revit.

I see… It’s a matter of organizing the lists with some codeblocks and them input the sublists to the SetParameterValue.ByName node.

I just did… Doing it again.

You’re a very patient person! Thank you so much!

no i am not, just quit my job because I dont have patience with my manager. LOL