
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✨
>>>
Sorting By Properties/Parameters
>>>
Overriding Element Graphics✨
>>>
Printing HTML with pyRevit✨


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.

STRESS-TEST
Time To Break It!
Don't rush sharing your tools.
Try breaking it before your team does it… You don't want to hear how your tools fails at the cost of your reputation.

Test #1 - Check ViewType
Let's ensure that users have correct ViewType open so we can get elements and set graphic overrides correctly.
SOLUTION #1 - Check ViewType


Test #2 - Ensure you get elements
This one is simple, we just need to verify that we got some elements after we sorted them inside of dictionary.
SOLUTION #12


Test #3 - Ensure enough colors
If you decided to pre-define your library of colors, then make sure that you have enough to match all possible options.
There are different ways to fix it, I'll just double the list until there's more than enough elements because I have 50 by default which should be enough.
SOLUTION #3


Test #4 - Check if can be overriden
This one is kind of optional. It's just an extra safety check for very unique situations where you might get elements that can no be modified for some reason…
Also note, there's no direct method to check for overriding graphics, but we can use CanBeHidden since it usually should work the same.
SOLUTION #4


AI - Ask for API Changes
Lastly, let's make sure that we don't have any changes in different Revit versions due to API changes.
AI makes it so easy, that you should always try to run it in the end to double check if you forgot anything or not..
PROMPT:

Time To Celebrate
Share Your Wins On LinkedIn
With #pyRevitChallenge
I'll Embed Them Here!







