Get Elements in Unplaced Groups

Is there a way to use dynamo to get the elements in unplaced model groups? I can get unplaced groups with the archilab node (returning an ElementType), but I can not use clockwork’s Group.Members node to get the elements in the groups (requires a Group).

I do not believe this can be done easily.

Unplaced groups are group types with no instances.

The API has a call to pull the element IDs contained in a group instance (part of the group class): GetMemberIds Method

But I am not aware of, nor can I find a similar API call for the group types: GroupType Methods

One work-around offhand would be to create a new instance of the unplaced group type, pull the desired information from the new instance and store it in memory, roll-back the creation of the instance (so it will be like it was never there to begin with), and then do what you’re after with the data collected from the faux instance.


Thanks! I was afraid that there wasn’t going to be an easy answer, since otherwise the solution would be more readily available to track down where families that aren’t selectable but are still in use are located.

Creating the group instance, getting the information and then deleting it does seem to work, and doesn’t seem to be as bad on performance as I feared.

Yeah - can be Made even faster if you roll the entire process into one node (assuming that was what you described above). There are a few transaction roll-back examples on the forum written in Python if you’re feeling adventurous. :slight_smile:

1 Like

a solution with a decorator of the moment paques-10

import clr
import sys
import System
from Autodesk.DesignScript.Geometry import *

import Autodesk
from Autodesk.Revit.DB import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

def easter_Deco(func):
	def wrapper(*args, **kwargs):
		t = Transaction(doc, func.__name__)
		ret = func(*args, **kwargs)
		return ret      
	return wrapper  

def get_MembersGroupTyp(nameGroup):
	fecGType = FilteredElementCollector(doc).OfClass(GroupType).ToElements()
	for Gtyp in fecGType:
		if Element.Name.GetValue(Gtyp) == nameGroup:
			gp = doc.Create.PlaceGroup(XYZ.Zero, Gtyp)
			members = [doc.GetElement(xId) for xId in gp.GetMemberIds()]
			membersType = [doc.GetElement(e.GetTypeId()) for e in members]
			return [x for x in membersType if x is not None]
OUT = get_MembersGroupTyp(IN[0])