from Autodesk.Revit.DB import *
from pyrevit import revit, forms
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
app = __revit__.Application
with forms.WarningBar(title='Pick Main Element:'):
main_elem = revit.pick_element()
if not main_elem:
forms.alert("No element was selected. Please Try Again.", title=__title__, exitscript=True)
graphics = doc.ActiveView.GetElementOverrides(main_elem.Id)
with forms.WarningBar(title='Pick Elements to match Graphics:', handle_esc=True):
while True:
elem = None
try:
elem = revit.pick_element()
except:
break
if not elem: break
t = Transaction(doc, __title__)
t.Start()
doc.ActiveView.SetElementOverrides(elem.Id, graphics)
t.Commit()