Is it possible to use Dynamo to remove rooms from model groups?

It’s not a good idea to have rooms inside groups, we have a large project with lots of model groups, but many of these groups also include rooms…
This has come up because I have just written a Dynamo script that allows us to coordinate Rooms with the Areas they are within, but it falls over when a room is inside a group.
My aim would be to remove the room - but not delete the room and not un-group the groups

Sadly I am not aware of any way to edit a group via the API. Would love to hear otherwise, but I think you’re stuck doing this the manual way.

Thanks Jacob,
I thought as much by looking through some of the nodes in Dynamo, but was hoping some genius on here might have worked it out… :frowning:

I know you said you didn’t want to ungroup. But a workaround would be to get a list of all the elements in the group. Ungroup and regroup only the elements you want from the list and rename the group back to what it was.

4 Likes

That actually sounded like a good tool, so I went ahead and created a graph. It provides a selection tree of the elements in the group and you select which elements to keep. It has a generic element selection method, so whoever wants it, can modify that part as needed.

Remove Element from Group.dyn (30.3 KB)

2 Likes

Awesome…!
I’ll download that and take a look…

Like my colleague said “This is probably the most helpful forum in the world!”

2 Likes

Definitely. Wouldn’t know half of what I know now without the forum.

BTW, if you have multiple copies of a group and use the script on one, it will not rename the modified group back to the original name like it would if using the Edit Group command. So it does have it’s limitations.

1 Like

You could try swapping the old group instances for the new one, but that would remove the previously created rooms from the project.

Generally speaking groups present a host of automation issues and as such I try to avoid them when I can.

@jacob.small @DoubleG
Actually just figured out a way around the multiple group issue. I pull all the groups with the same name. Get all members of each group. Since every member of the each group should have the same name, I filter each list of members with the names selected by the user. Then ungroup all instances at once and regroup back with the filtered elements list and name all of them with the original name. Updated graph attached.

Remove Element from Group.dyn (47.6 KB)

3 Likes

That was my first thought after downloading it (but before I looked inside)
*Replying to: “if you have multiple copies of a group…”

2 Likes