
As you know, we can't make a simple sum of all apartment rooms. Instead, we have to follow specific rules and guidelines for correct results...
Plus, I'm ready to bet that every office has their own specific workflow in Revit on how to do that...
So, let's create a custom Flat Summarizer.
Today We're Practicing:

Let's Create
"Flat Summarizer"
Using 7-Step PROCESS



Ensure Room Parameters
Whenever you try to get Project/Shared parameter it's worth checking if you managed to get them. Becaus it's very likely that not all project will have them…
Be careful trying to read/write values to shared parameters without checking.
Caption

Ensure Flat Rooms
Whenever you try to get anything - you have to double check if you got it. Because often times - there's no point execution the rest of the code…
So let's verify if we have flat rooms in our project.
And keep in mind that we can have room in the project, but none of them would have flat parameters… So make sure you check dict_flats and not all_rooms.
Caption

Ensure Occupancy value
ChatGPT gave a good hint that we shouldn't try to apply .lower() after reading a built-in parameter.
Yes - it will always be in all projects.
But - It can be None.
Because by default parameters have special None state. It doesn't have any value, but it's also not empty… It just doesn't exist (None).
And this can be problematic when we expect to get a string…
So let's rewrite this section and skip apartment rooms if they don't have an occupancy.
Caption

Ensure Output Parameters Exist
Whenever you try to get Project/Shared parameter it's worth checking if you managed to get them. Becaus it's very likely that not all project will have them…
Be careful trying to read/write values to shared parameters without checking.
Caption

Time To Celebrate
Share Your Win On LinkedIn
With #pyRevitChallenge
I'll Embed You Here!







