Match Graphic Overrides

# -*- coding: utf-8 -*-

# ╦╔╦╗╔═╗╔═╗╦═╗╔╦╗╔═╗
# ║║║║╠═╝║ ║╠╦╝ ║ ╚═╗
# ╩╩ ╩╩  ╚═╝╩╚═ ╩ ╚═╝ IMPORTS
# ==================================================
from Autodesk.Revit.DB import *    # Import everything from DB (Very good for beginners)

# pyRevit
from pyrevit import revit, forms   # import pyRevit modules. (Lots of useful features)


# ╦  ╦╔═╗╦═╗╦╔═╗╔╗ ╦  ╔═╗╔═╗
# ╚╗╔╝╠═╣╠╦╝║╠═╣╠╩╗║  ║╣ ╚═╗
#  ╚╝ ╩ ╩╩╚═╩╩ ╩╚═╝╩═╝╚═╝╚═╝ VARIABLES
# ==================================================
doc     = __revit__.ActiveUIDocument.Document   # Document   class from RevitAPI that represents project. Used to Create, Delete, Modify and Query elements from the project.
uidoc   = __revit__.ActiveUIDocument            # UIDocument class from RevitAPI that represents Revit project opened in the Revit UI.
app     = __revit__.Application                 # Represents the Autodesk Revit Application, providing access to documents, options and other application wide data and settings.


# ╔╦╗╔═╗╦╔╗╔
# ║║║╠═╣║║║║
# ╩ ╩╩ ╩╩╝╚╝ MAIN
# ==================================================

# Pick Main Element
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)

# Get Main GraphicsOverrides
graphics = doc.ActiveView.GetElementOverrides(main_elem.Id)

# Loop keep selecting elements to match
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

        # Set GraphicsOverrides
        t = Transaction(doc, __title__)
        t.Start()
        doc.ActiveView.SetElementOverrides(elem.Id, graphics)
        t.Commit()

⌨️ Happy Coding!
Erik Frits