Here is a graph that I’ve thrown together that pushes the Revit Space number into the COBie parameter “COBie.Component.Space” for elements that are within the Space, **including elements above the ceiling**.

Note that in order for this to include the elements in the area above ceilings (i.e., mechanical and electrical equipment), your spaces must use the “Upper Limit” parameter on your spaces to include the elements that are within the ceilings above the Space. This hasn’t been fully tested, so if it doesn’t work for your project please let me know in the comments below.

### Workflow

- Open the model which contains the elements you wish to populate the COBie parameter (e.g., MEP model).
- Create spaces and rename/renumber as needed (I recommend the Space Naming Utility).
- Launch Dynamo and open the graph linked at the bottom of this post.
- In the graph, choose which categories you would like to push the space data into. Modify the List.Join node if you need to add or remove categories from the list.

- Set the graph to Automatic (for an easier workflow)
- Use the Select Model Element node to pick a space individually.

. - Continue selecting spaces as needed to populate element COBie space data.

### Under the Hood

This graph first gets all elements of the chosen categories and then gets the BoundingBox of a space.

It then filters out the elements whose coordinates are not within the selected Space’s BoundingBox.

Finally, the graph pushes the Space’s “Number” parameter value into the “COBie.Component.Space” parameter.

The unique challenge here was for MEP elements that are above the ceiling. To solve this, I use the Space’s “Upper Limit” parameter to include the ceiling space above the Space.

A new BoundingBox is created using the new MaxPoint from the “Upper Limit”.

### Conclusion

I haven’t tested this on complex spaces, so if this doesn’t work for your project, please let me know in the comments below.

This graph could be modified to iterate through all spaces, but I haven’t had a chance to do so. Please, if you end up modifying it to do so, please share the dyn in the comments below so that I can update this post and share with our readers.

Questions, comments, issues?

Space Number to COBie.Component.Space (159 downloads)