How to create a Detail Group in specific View?

Hey Robert,

From your second image I understand that you are trying to place a Group, that contains view specific items (Detail Items, Filled Regions, Detail Lines etc.), hence making that Group view specific. Groups are kind of its own animal. There is an API method for placing Groups (https://apidocs.co/apps/revit/2017/586d4f2e-0985-2d0b-dbb7-ea6d2f704336.htm), but it only accepts two inputs - location, and type. I tested it on Detail Groups, and it seems that Revit doesn’t fail on creating Detail Groups for a 3D View for example. I know that’s a little strange. Also, since there is no specific View input for PlaceGroup() method, it seems that its using currently ActiveView to place them. Just keep in mind that even though, it places the group, and new Id is created, 2D elements will not be visible in 3D Views. Here’s a dead simple sample file:

image

Python code:

# Copyright(c) 2018, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

TransactionManager.Instance.EnsureInTransaction(doc)

try:
    errorReport = None

    t = UnwrapElement(IN[0])
    l = XYZ(0,0,0)
    groups = doc.Create.PlaceGroup(l, t)
except:
    import traceback
    errorReport = traceback.format_exc()

TransactionManager.Instance.TransactionTaskDone()

if None == errorReport:
    OUT = groups
else:
    OUT = errorReport

Also note that I am running this in MANUAL mode:

image

Manual mode is important since I am using the AllElementsOfType node. It will cause an infinite loop and crash Revit if you use it with Automatic mode.

Hope this helps.

Basically, I think to automate your routine for placing Detail Groups in multiple views, you would have to come up with a routine that opens/activates a view, you want that group to be placed, and then places it. That’s a different question though in my opinion so start a new post.

3 Likes