Get model group holding list of rooms

Hi people, is there a way to get the model groups that hold a list of rooms?

Currently I can gather a list of elements from a list of model groups, filter those elements to get the rooms, however the structure of what rooms belong to which model group is being lost. This is important when it comes to my script as I am trying to auto create a bunch of views and then rename them as per their model group and eventually place the elevation markers on separate views (also to do with their model group name).

This is what I have so far.

Any help is greatly appreciated.

Kind regards
Tiara

Hi
Why don’t you try to make a parameter for your rooms and call them later?

I actually found a little bit of code that did the trick.

image