Detail groups locations/views

How could i get detail group location? in which views inserted? its not attached to any model group.

Hi @rinag,

Here is some python code which should do it for you. It takes a DetailGroupType as an input and will then try get the Location and Views for you for all the Groups of that GroupType. For nested groups, if the parent is a Model Group it will skip, otherwise it will get the Parent Detail Group instead and report the View and Location…

import clr

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

import Revit

from Autodesk.Revit.DB import *

def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

def CheckIfDetailGroupNotInModelGroup(g):
	if not g.GroupId == ElementId.InvalidElementId:
		grp = doc.GetElement(g.GroupId)
		if grp.IsAttached:
			pg = doc.GetElement(g.AttachedParentId)
			if not pg == None and not pg.Category.Id == Category.GetCategory(doc,BuiltInCategory.OST_IOSModelGroups).Id:		
				return True	
			return False				
	return True

def GetExternalGroup(g):
	if not g.GroupId == ElementId.InvalidElementId:
		return doc.GetElement(g.GroupId)
	return g

grpTypes = tolist(UnwrapElement(IN[0])) # Should be Detail Group Types only

grpsOut = []
viewsOut = []
locsOut = []

for gt in grpTypes:
	grps = [GetExternalGroup(UnwrapElement(g)) for g in gt.Groups if CheckIfDetailGroupNotInModelGroup(g)]
	viewsOut.append([doc.GetElement(g.OwnerViewId) for g in grps])
	locsOut.append([g.Location.Point.ToPoint() for g in grps])
OUT = grpsOut, viewsOut, locsOut

I’ve also attached a .dyn file which has an additional python node for exclusively getting all Detail Group Types in the current Revit Document and filtering by Name as an example of input.

DetailGroupLocsAndViews.dyn (20.8 KB)

I hope this helps…



@Daniel_Woodcock1, any suggestions on how to place detail group types and model group types (I think I’ve got this one figured out) within a Revit model?

I’m trying to place at least one instance of each of these types, in the same vicinity, so I can create a “super group” to save out (using File>Save As>Library>Group) in one shot rather than doing each group one-by-one.

Thanks in advance!