Oct 25, 2022

Get Solid Fill Pattern in Revit API

Learn how to get Solid Fill Pattern. It can be useful in creating Graphics Override Settings.

👉 Get Solid Fill Pattern

If you are trying to override your graphic settings then you will most likely want to get SolidFillPattern at some point.

There are different ways to get it, but I prefer to get all fill patterns and use list comprehension to filter out patterns with .IsSolidFill property. If you want to learn more about how to Overriding Graphics, read more in another blog post I wrote.

And Finally, Here is the Snippet to get Solid Fill Pattern!

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

#⬇️ IMPORTS
from Autodesk.Revit.DB import *

#📦 VARIABLES
doc   = __revit__.ActiveUIDocument.Document


#🟦 Get All Fill Patterns
all_patterns = FilteredElementCollector(doc)\
                    .OfClass(FillPatternElement)\
                    .ToElements()

#🔎 Filter Solid Fill Pattern
solid_pattern = [i for i in all_patterns 
                    if i.GetFillPattern().IsSolidFill][0]

__author__ = '🙋‍♂️ Erik Frits'

Join Newsletter

📩 You will be added to Revit API Newsletter

Join Us!

which is already read by 7400+ people!

Ready to become Revit Hero for your office? Learn Revit API!

Join this comprehensive course that will guide you step by step on how to create your dream tools for Revit that save time.