Which window belongs to which group

Hi there, I’m new to Dynamo and I’m trying to create a script that read which window belongs to which group. I have the basics but I do not now where to start.

I have 6 windows (names all start with 31A…) and I have 4 groups (1, 2, 3, 4).
I’m trying to get something like:

  • 31A… belongs to group 2
  • 31A… belongs to group 1
  • 31A… belonhs to group 1
  • 31A… belongs to group 4
  • etc.

Help please???

Where do you have the “groups”? Is this a parameter you’ve added?

Can you please upload the picture using the camera button in the top right corner (zoom in so that the text is readable and press it to save a screenshot of the entire graph in a readable format).

Alternatively upload a sample .rvt file containing the grouped windows :slight_smile:

Hi Jonathan. Thanks for the reply but I don’t see a camera button in the top right corner. I’m new to this so maybe I’m missing something…

This Is what I see…please help

Duh…Got It…you mean in Dynamo…
Here is my screenshot:

Above I have the group I want filtered out (merk 1,2,3,4) and under I filtered out the windows. I would like to know which window belongs to which group.

Don’t mind the rubbish around the green areas :wink: I’m trying…

Try this:

and set the lacing of the node boundingbox.contains to cross

Try searching your library for group elements. I can’t recall the exact name but I know there is a node which retrieves the elements out of the group. You could then filter that to just the windows (element.category) so get a list of just windows from the groups. You can then use Whatever method you want to filter the windows in the groups out of the windows not in groups.

Thanks for your reply Nico. I tried to lace the boxes together but I get a warning: Warning: One or more of the input types are not matching. Couldn’t find a version of ByGeometry that takes arguments of type (__array)

Any suggestions? I’m stuck here

Hey Everyone,

I hope I am understanding the desired workflow correctly, but elements have a property in them to report what group they belong to. http://www.revitapidocs.com/2018.1/9508a6c5-9681-bbef-07c5-1351583b0e1e.htm

Doesn’t seem to make sense to be dealing with clunky intersection tests.
(But then again I might be missing something)

And the python script (for copy/paste)

import clr

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

#your input elements
elements = UnwrapElement(IN[0])
#output list
groups = []
#iterate through the elements and see what group it belongs to
for i in elements:

OUT = groups

The node Element.Group from Clockwork package is what Jacob means
It does the same as the python script from Jhon

Thanks Nico, that was what I’m looking for. I’m one step further in my Dynamo-script :wink: See below…

Now what I want is that the Areas of the same group are combined (add toghether)
So the output needs to be only list 0 to 3 with unique groups (merk 01, merk 02, merk 03 and merk 04) and the areas added. So the result would be something like:


0 List

0 Merk 01
1 31A_BdB_Reynaers_CS77_vastglas
2 2,20763…

1 List

0 Merk 02
1 31A_BdB_Reynaers_CS77_vastglas
2 1,28888… (0,78889 + 0,49999 added together)

etc. for list 2 and 3


Hmm could GroupByKey and after that use math.sum to add together

So I’m trying to get this:


@Jonathan.Olesen gave you the answer i think in post 11

1 Like

I have a feel that a lot of recent posts request complete solutions and not the learning which comes with struggling with a graph… (and reading the primer)…
(This is not an attack on this post in particular)


not pointing what strawberry to pick but just showing where they grow makes better teachers
and students


Could not agree more :slight_smile: and nice metaphor :wink:


I totally get your critcism but you have no idea the time and effort I’m putting into this to find the right node. I’m not looking for complete solutions. I want to learn from experience but if you don’t know what you are looking for it’s hard to get any result.

Nevertheless, I have looked into the List.GroupByKey but if I’m right, it sorts the same value. For “merk” this does the trick but not for the area.

How does Dynamo know that the second and third area and the last four areas need to be added together because they belong to the same group? This does not work with List.GroupByKey. Or does it?

You’re right, I have no idea what you’ve tried and how you’ve struggled, mainly because you have not shown what you’ve tried in regards to grouping. I don’t believe you will learn much from just copying my graph… I do not think it has to do with “knowing which nodes to use” rather you should know what you want to do and think what keywords relate to what you might want and use the logic build around Dynamo.

(I’ve blurred a single node which you will have to figure out yourself.)


Here are some tips

Start with the beginning and the end of the graph, the middle is mostly list management stuff.
Read this to get an idea of what nodes there are for list actions http://plevit1.blogspot.com/2015/01/examples-for-all-list-actions-in-dynamo.html
https://dynamonodes.com/ gives an incomplete overview of the nodes in packages
http://dictionary.dynamobim.com/#/ gives you an overview of the out of the box nodes and what they do


The comment given by @Jonathan.Olesen and @Marcel_Rijsmus mean that they are helping you, but the are not going to do it for you.

In order to improve your skills, understanding and help received: show us what you are doing, where you are struggling etc.

You don’t show the result you now get with groupbykey. You don’t show where the suggested math.sum doesn’t do the trick for you.

Share your graphs and people can easily see what is going wrong in your graph and also in your current way of thinking.

1 Like