Help with Group by Key

I need some help… I am looking to group all of the family types of wall and then collect all of the area of the wall types and export that to excel. Any one have an easy solution…?

hi @astone
This sould solve your problem

1 Like

Yeah, that does not allow me to calculate the area of type of wall…

The easiest option would be a Revit Material Take-off Schedule.

True, that was my first option, however i need to get the data to write to excel takeoff sheet…

You could use BimorphNodes package GetScheduleData then simply export the table data to Excel. If your Excel already contains formulae then use @Konrad_K_Sobon Archi-labs Excel exporter (I think the package is called bumblebee) since the Dynamo Excel exporter destroys preexisting formulas (its a known bug)…

Just adjust my previous graph a bit

1 Like

You could also write your own ‘Type Summation’

The code in the example has two possible outputs, adjust commenting for the solution you want.

import sys
sys.path.append('C:\\Program Files (x86)\\IronPython 2.7\\Lib')
import collections

#The inputs to this node
fam = IN[0]
area = IN[1]

#group the values in a dictionary
elemVal = collections.defaultdict(int)

#sum grouped values
for f, v in zip(fam, area) :
	elemVal[f] += v

#Output sorted as types(list0) and sums(list1)
OUT = zip(*elemVal.items())

#Output sorted as types and sums (grouped)
#OUT = elemVal.items()

Thanks, that worked!