ETA: Figured it out. The detail item cannot be in a group if you want to “bring to front” or “send to back”.
Simplified it a bit and upgraded to Dynamo 2.0 but now getting error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 31, in
Exception: The element detailElementId is not a detail element.
Parameter name: detailElementId
Revised Python script:
import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *clr.AddReference(‘System’)
from System.Collections.Generic import Listclr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManagerdoc = DocumentManager.Instance.CurrentDBDocument
#Converting input from Dynamo to Revit
mylist = UnwrapElement(IN[0])#Send detail item to back in a transaction
TransactionManager.Instance.EnsureInTransaction(doc)for i in range(0,len(mylist)):
viewmatch = mylist[i]
v = viewmatch[1]
elem = viewmatch[0]
btf = DetailElementOrderUtils.BringToFront(doc,v,elem.Id)TransactionManager.Instance.TransactionTaskDone()
OUT = btf