/

/

05-bimpressionist-painter

/

/

05-bimpressionist-painter

Day

05

pyRevit

Challenge

Day

05

pyRevit

Challenge

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

21-Day pyRevit Challenge

Mon

Tue

Wed

Thr

Fri

Sat

Sun

Tool Of The Day:

"BIMpressionist Painter"

Watch Bonus Training:
- Follow pyRevit FastTrack Setup
- Watch P.R.O.C.E.S.S. Masterclass

If you think about it - Revit is like a 3D database containing all our elements with their properties and parameter values.

But it's not the best for visualizing this data. At least, not out of the box… So how about we grab a paint brush and do it Bob Ross Style:

Colorize elements based on their values.

Today We're Practicing:

>>>

Getting Elements In View✨

>>>

Getting Elements In View✨

>>>

Sorting By Properties/Parameters

>>>

Sorting By Properties/Parameters

>>>

Overriding Element Graphics✨

>>>

Overriding Element Graphics✨

>>>

Printing HTML with pyRevit✨

>>>

Printing HTML with pyRevit✨

Let's Create

"BIMpressionist Painter"

Using 7-Step PROCESS

Let's Create

"BIMpressionist Painter"

Using 7-Step PROCESS

.

.

.

.

.

.

.

PLAN

Ready to Paint?🖌️

Imagine inspecting your Revit models in 3D without schedules or creating tens of view filters…

And yes, it's often best to use View Filters, but there are so many use-cases where it's better to quickly use Graphic Overrides based on certain criteria. Especially when you want to keep your list of view filters clean.

So, The Goal for Today's Tool:

Override element graphics in views based on a certain criteria. We'll start with Walls Category and we'll color based on Type.Name values.

And once it works, you can easily create a lot of useful tools for quick coloring based on your own rules.

So let's scroll down and begin the research.

.

.

.

.

.

.

.

PLAN

Ready to Paint?🖌️

Imagine inspecting your Revit models in 3D without schedules or creating tens of view filters…

And yes, it's often best to use View Filters, but there are so many use-cases where it's better to quickly use Graphic Overrides based on certain criteria. Especially when you want to keep your list of view filters clean.

So, The Goal for Today's Tool:

Override element graphics in views based on a certain criteria. We'll start with Walls Category and we'll color based on Type.Name values.

And once it works, you can easily create a lot of useful tools for quick coloring based on your own rules.

So let's scroll down and begin the research.

.

.

.

.

.

.

.

RESEARCH

Coding CheatSheet

Here's everything you might need for today's challenge.

Coding Blocks

Get All Elements (in View)

Color Library (Hardcoded)

Create Override Graphic Settings

Override Element Graphics

Interactive Legend (print_table)

Sort Elements

Color Library (Random)

Get Solid Pattern

print_html color

Get All Elements (in View)

Sort Elements

Color Library (Hardcoded)

Color Library (Random)

Create Override Graphic Settings

Get Solid Pattern

Override Element Graphics

print_html color

Interactive Legend (print_table)

Revit API Docs
  1. FilteredElementCollector Constructor (in view)

  2. Transaction Constructor

  3. OverrideGraphicSettings Class

  4. Element.CanBeHidden Method

  5. View.AreGraphicsOverridesAllowed Method

  6. View.SetElementOverrides Method

  7. View.GetElementOverrides Method

  8. Color Class

  9. FillPatternElement Class

  10. FillPatternElement.GetFillPattern Method


pyRevit Dev Docs
Notes

🔸Why Didn't I Create ViewLegend ?
Honestly, it's best to create a new Legend view to report on colors, but I didn't want to overcomplicate today's tool so we'll just print colors in the console.

🔸GraphicOverrideSettings Confusing?

If settings feel hard - just open Revit UI menu to look at. Right Click -> Override Graphics In View -> By Element.

The settings and the menu is the same thing…

🔸To Reset Overrides…

You can create default OverrideGraphicSettings and apply it to reset all overrides. You can also get overrides from other elements to match it.

🔸Colors Approach

When you need to generate a lot of colors you can begin with random RGB values, but the results won't be great. Instead it's a good idea to create a library of predefined good colors (ask AI…) and then use those RGB values for your needs.

AI Prompt

You can ask AI to help you with the research
but it's NOT 100% perfect solution. Do not rely too much on AI.

AI Research Prompt

AI Prompt

You can ask AI to help you with the research
but it's NOT 100% perfect solution. Do not rely too much on AI.

AI Research Prompt

.

.

.

.

.

.

.

RESEARCH

Coding CheatSheet

Here's everything you might need for today's challenge.

Coding Blocks

Get All Elements (in View)

Sort Elements

Color Library (Hardcoded)

Color Library (Random)

Create Override Graphic Settings

Get Solid Pattern

Override Element Graphics

print_html color

Interactive Legend (print_table)

Revit API Docs
  1. FilteredElementCollector Constructor (in view)

  2. Transaction Constructor

  3. OverrideGraphicSettings Class

  4. Element.CanBeHidden Method

  5. View.AreGraphicsOverridesAllowed Method

  6. View.SetElementOverrides Method

  7. View.GetElementOverrides Method

  8. Color Class

  9. FillPatternElement Class

  10. FillPatternElement.GetFillPattern Method


pyRevit Dev Docs
Notes

🔸Why Didn't I Create ViewLegend ?
Honestly, it's best to create a new Legend view to report on colors, but I didn't want to overcomplicate today's tool so we'll just print colors in the console.

🔸GraphicOverrideSettings Confusing?

If settings feel hard - just open Revit UI menu to look at. Right Click -> Override Graphics In View -> By Element.

The settings and the menu is the same thing…

🔸To Reset Overrides…

You can create default OverrideGraphicSettings and apply it to reset all overrides. You can also get overrides from other elements to match it.

🔸Colors Approach

When you need to generate a lot of colors you can begin with random RGB values, but the results won't be great. Instead it's a good idea to create a library of predefined good colors (ask AI…) and then use those RGB values for your needs.

AI Prompt

You can ask AI to help you with the research
but it's NOT 100% perfect solution. Do not rely too much on AI.

AI Research Prompt

.

.

.

.

.

.

.

.

.

.

.

.

.

.

OUTLINE

Step-by-Step Plan

Break down logic of the tool idea into smaller chunks so it's easier to brainstorm, find hidden steps and code.

OUTLINE

Step-by-Step Plan

Break down logic of the tool idea into smaller chunks so it's easier to brainstorm, find hidden steps and code.

1

Get
Elements

card-background

5.

Override
Elements

card-background

2

Sort
Elements

card-background

6.

Legend Report
(Interactive)

card-background

3

Define
Color Library

card-background

4.

Create
GraphicsSettings

card-background

1

Get
Elements

card-background

3

Define
Color Library

card-background

5.

Override
Elements

card-background

2

Sort
Elements

card-background

4.

Create
GraphicsSettings

card-background

6.

Legend Report
(Interactive)

card-background

.

.

.

.

.

.

.

OUTLINE

Step-by-Step Plan

Break down logic of the tool idea into smaller chunks so it's easier to brainstorm, find hidden steps and code.

1

Get
Elements

card-background

2

Sort
Elements

card-background

3

Define
Color Library

card-background

4.

Create
GraphicsSettings

card-background

5.

Override
Elements

card-background

6.

Legend Report
(Interactive)

card-background

NB!

TRY BUILDING
THIS TOOL YOURSELF
DON'T RUSH TO SOLUTION

Unless… You're a Beginner


According to GENERATION EFFECT

The Harder You Work, The Deeper It'll be Wired in Your Brain

NB!

TRY BUILDING
THIS TOOL YOURSELF
DON'T RUSH TO SOLUTION

Unless… You're a Beginner


According to GENERATION EFFECT

The Harder You Work, The Deeper
It'll be Wired in Your Brain

NB!

TRY BUILDING
THIS TOOL YOURSELF
DON'T RUSH TO SOLUTION

Unless… You're a Beginner


According to GENERATION EFFECT

The Harder You Work, The Deeper It'll be Wired in Your Brain

.

.

.

.

.

.

.

.

.

.

.

.

.

.

CODE

Code Quick-n-Dirty.

The Goal is to create a proof of concept. Don't try to make it perfect. Skip steps if necessary. Keep it ugly. Keep it slow. JUST. MAKE. IT. WORK…

CODE

Code Quick-n-Dirty.

The Goal is to create a proof of concept. Don't try to make it perfect. Skip steps if necessary. Keep it ugly. Keep it slow. JUST. MAKE. IT. WORK…

Proof Of Concept

SCRIPT: PROOF OF CONCEPT

SCRIPT: PROOF OF CONCEPT

.

.

.

.

.

.

.

CODE

Code Quick-n-Dirty

The Goal is to create a proof of concept. Don't try to make it perfect. Skip steps if necessary. Keep it ugly. Keep it slow. JUST. MAKE. IT. WORK…

Proof Of Concept

SCRIPT: PROOF OF CONCEPT

.

.

.

.

.

.

.

.

.

.

.

.

.

.

EDIT

Refactor Everything

Once proof-of-concept works - we can focus on all steps to make everything more structured, optimized and easier to read.

EDIT

Refactor Everything

Once proof-of-concept works - we can focus on all steps to make everything more structured, optimized and easier to read.

REFACTOR CODE

REFACTORED CODE

REFACTORED CODE

.

.

.

.

.

.

.

EDIT

Refactor Everything

Once proof-of-concept works - we can focus on all steps to make everything more structured, optimized and easier to read.

REFACTOR CODE

REFACTORED CODE

.

.

.

.

.

.

.

.

.

.

.

.

.

.

SHIP

Submit Your Code.

Congratulations! Another tool is complete.

Now let's reflect on what we've learnt and submit your code to keep track of your progress.

SHIP

Submit Your Code.

Congratulations! Another tool is complete.

Now let's reflect on what we've learnt and submit your code to keep track of your progress.

.

.

.

.

.

.

.

SHIP

Submit Your Code.

Congratulations! Another tool is complete.

Now let's reflect on what we've learnt and submit your code to keep track of your progress.

Time To Celebrate

Share Your Win On LinkedIn
With #pyRevitChallenge

I'll EmbedThe Best Posts Here!


PS. My post is just a placeholder for now…

© 2023-2026 EF Learn Revit API

© 2023-2026 EF Learn Revit API

© 2023-2026 EF Learn Revit API