Place Detail Group on Sheet

Hello! :wave:
Sorry in advance if this is an easy request - I spent the entire afternoon trying to figure it out but not luck so far - but how does one place a detail group (already present in the file) on a view/sheet using Python/Revit-API?
I am trying to get this as part of a workflow that would “duplicate” sheet content from one sheet to another within the same file (similar to what the pyRevit tool does between different documents) and I have everything figured out except the groups (I hope/think).

Thanks in advance!

Hi,

The method to place groups in the API is found here:

https://www.revitapidocs.com/2015/586d4f2e-0985-2d0b-dbb7-ea6d2f704336.htm

It works by placing the group in the active view. So if you want to have it place the group on a different view you would have to:

#Change to whatever view you want:
doc.ActiveView = view  
#Place the group 
groups = doc.Create.PlaceGroup(location, detail_group_type)  

Here is an example of placing a detail group in the active view:

from Autodesk.Revit.DB import \
FilteredElementCollector, \
BuiltInCategory, \
View, \
XYZ

from rpw import revit,db

doc = revit.doc

detail_group = FilteredElementCollector(doc)\
                .OfCategory(BuiltInCategory.OST_IOSDetailGroups)\
                .WhereElementIsNotElementType()\
                .ToElements()
                
#typeId from the detail group of interest
detail_group_typeId = [e.GetTypeId() for e in detail_group if e.Name == 'test'][0]

detail_group_type = doc.GetElement(detail_group_typeId)
#location to place at
location = XYZ(63,20,0)

with db.Transaction(doc=doc, name="Place Group"):
    groups = doc.Create.PlaceGroup(location, detail_group_type)
3 Likes

Thank you! thank you! thank you!
so simple… I can’t believe all my searches in the API docs didn’t give me anything… much appreciated! :slight_smile: :+1: