How to get all spaces of a zone

Hi all! I’m looking for a way to have all spaces of a chosen zone. The ideal it could be to obtain a list in which they are all listed and divided for zone of appartenance.
Thanks to everyone in advance!

1 Like

Hi @Lucaly1994,

This should work :

#By Nick_Boyts
import clr
import RevitServices
import Autodesk
from Autodesk.Revit.DB import *

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import ToDSType  (bool) extension method
import Revit
# Adds ToProtoType, ToRevitType geometry conversion extension methods to objects
# Import Element wrapper extension methods
from Revit.Elements import *


if not hasattr(zones, '__iter__'):
    zones = [zones]

for i in zones:
	spaceSet = []
	spaces = i.Spaces
	for j in spaces:

#Assign your output to the OUT variable.
OUT =output

Hi Alban, I’m really sorry but I don’t know anything about python so I can’t understand what i have to do. Can you explicate me better this? I have to do a custom node? I have to write this in a code block? How can I set input and output?
Thanks very much!

1 Like


Here is a graph with the python script.

Zones HVAC.dyn (3.5 KB)

1 Like

Thanks very much Alban! Very kind!

1 Like

You’re welcome.

I just saw that there is already an existing node in the MepOver package : the Zone.Spaces node.

You can mark the topic as solved.

1 Like

Hi Alban,

I have another question regarding the zones and space.
I want to use Dynamo/ python to assign each space to a separate zone, or combine certain zones. But I am not sure which function I should use. Do you have any chance know that?