# Match element to room

**URL:** <https://forum.dynamobim.com/t/match-element-to-room/57148>\
**Category:** Revit\
**Created:** [November 11, 2020, 5:14pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148 "2020-11-11T17:14:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nschmittIPDG](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nschmittIPDG](https://forum.dynamobim.com/u/nschmittIPDG)\
**Post date:** [November 11, 2020, 5:14pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148/1 "2020-11-11T17:14:14Z")

</div>

I’m trying to use Dynamo to measure the general location of an element to a room. We need to make sure the element is within range of a room. I have it set to override the color of the element if it’s out of range, or keep it the same if it is.

Right now, I have an easy way of selecting 1 room and several elements, but that would be slow and inefficient when we have a high rise or large building with multiple rooms. We want to be able to run a dynamo script to compare elements assigned to rooms without them being in the room.

So far, I’m trying to use a parameter to set my room assignment value and us creating a room within the room we’re going to use as our base point. I don’t want to have to run the script every time I want compare 1 room to the elements assigned to it. I want to be able to lay the ground work for the script and just hit Run. Is there a way of looping the script to run Elements with Parameter Value of X against Room X, then run Elements with Y to Room Y, etc?

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [November 11, 2020, 5:29pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148/2 "2020-11-11T17:29:55Z")

</div>

@nschmittIPDG Welcome to the forum  
since there is no graph i would like to ask you if you use the Elements in Room node (Archilab package)

---

<div class="post-metadata">

**Author:** ![Robert\_Younger](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/robert_younger/32/205603_2.png) [@Robert\_Younger](https://forum.dynamobim.com/u/Robert_Younger)\
**Post date:** [November 11, 2020, 5:36pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148/3 "2020-11-11T17:36:54Z")

</div>

It sounds like you have objects outside of the room geometry that you want to correlate to the room (I assume you aren’t able to work with room calculation points?).

- What defines the measurement? Centroid of the room? Room location point?
- Are you associating the elements to the room in a separate workflow?

To generically answer your question, you can group the elements in a list structure that matches your room list, get the point data of both, then run a distanceto calculation comparing list A to list B.

---

<div class="post-metadata">

**Author:** ![nschmittIPDG](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nschmittIPDG](https://forum.dynamobim.com/u/nschmittIPDG)\
**Post date:** [November 11, 2020, 5:44pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148/4 "2020-11-11T17:44:21Z")

</div>

@Marcel_Rijsmus No I’m not using that node since I’m trying to work with elements outside the room I’m focusing on.

@Robert_Younger Yes I am using the room centroid as the location point in which I am basing my geometry for the elements. That part I have figured out. I did get the elements grouped by the parameter value. It’s getting the script to run Room X with elements assigned to Room X, then Y with Y without going back through X.

---

<div class="post-metadata">

**Author:** ![Robert\_Younger](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/robert_younger/32/205603_2.png) [@Robert\_Younger](https://forum.dynamobim.com/u/Robert_Younger)\
**Post date:** [November 11, 2020, 5:49pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148/5 "2020-11-11T17:49:45Z")

</div>

I’m a little weak on efficient list management practices, but the ‘nothing else is working’ method I fall back to:

\*List.Count the bin size of the elements.  
\*List.Cycle the Room list. This will give you equal-sized, equal-structure lists to compare to the element points list.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/7/77499aa4d8154e73cbcb2f1332523a8968cb1d57.png)

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [November 11, 2020, 5:53pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148/6 "2020-11-11T17:53:53Z")

</div>

if you have all elements, and all elements in room, then subtract 🙂

---

<div class="post-metadata">

**Author:** ![nschmittIPDG](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nschmittIPDG](https://forum.dynamobim.com/u/nschmittIPDG)\
**Post date:** [November 13, 2020, 8:35pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148/7 "2020-11-13T20:35:36Z")

</div>

@Marcel_Rijsmus That would work for having one room, but I’m looking to use this for multiple rooms at the same time. I want this to be a universal tool so there’s little prep work to do before running it and I can run it on a high rise where we usually have longer distances and multiple rooms.

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [November 13, 2020, 9:42pm UTC](https://forum.dynamobim.com/t/match-element-to-room/57148/9 "2020-11-13T21:42:46Z")

</div>

Why would this work for just one Room?
