Hi I am new to dynamo and I am trying to calculate the Area of all rooms per their respective level. Below is a quick example of where I am stuck:
[0]
—[0]
-----[0]Ground Floor
-----[1]11
—[1]
-----[0]Ground Floor
-----[1]15
—[2]
-----[0]Ground Floor
-----[1]20
—[3]
-----[0]etc.
-----[1]etc.
[1]
—[0]
-----[0]First Level
-----[1]11
—[1]
-----[0]First Level
-----[1]76
—[2]
-----[0]First Level
-----[1]32
—[3]
-----[0]etc.
-----[1]etc.
and sort and group by level similar to below…
-[0]Ground Floor
—[0]11
—[1]15
—[2]20
—[3]etc.
-[1]First Level
—[0]11
—[1]76
—[2]32
—[3]etc.
After which I want to calculate the sum of each “Ground Floor” list and “First Level” list which I think it to be just a Math.Sum operation for each list.
Any help would be greatly appreciated!
Welcome to Dynamo
First im sure you know you can entirely do that in Revit without Dynamo so ièm going to assume this is a learnign experience
There’s a couple way to do that so here’s a linear approach.
Get all Rooms
Get all the Rooms Level
Group by Level
Get the Area
Sum the Area
If you need to keep the structure of your lists for exporting to Excel or some other means, then if you throw a couple of List.Create and List.Transpose nodes in there you should get the output similar to what you had outlined in your question.
1 Like
Thats superb, thanks for the quick reply! Happy New Year!
Did something change in the past year to where this would no longer work? I’m using Revit 2017 and Dynamo 1.3 and either way I run these graphs I get errors. Here is trying the second approach.
No, it should be no problem in any version of Dynamo.
What does the error say?
You may be getting an unusual output in either the Room Area or Level. Just check all of the lists.
Do you have any unplaced or unenclosed rooms?
1 Like
So this morning I fired it up and it worked on a sanitized model with a few rooms on one level. But then I re-opened the original large 150,000 SF 3 story building and it threw an error at the Math.Sum node “Asked to convert non-convertible types.” I thought maybe it was nulls which I tried unsuccessfully to remove.
The empty values being bought through by the List.GroupByKey is causing the problem, they are not nulls they are empty.
You have to remove the empty values before they get to the Math.Sum
The trick in Dynamo is to maintain the integrity of the data and ensure that if you are removing indexes in one list that you are also removing the corresponding index in the other list (Element.GetParameterValueByName). Otherwise you will be getting data that corresponds to the incorrect index in the list.
1 Like