Day

01

pyRevit

Challenge

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

21-Day pyRevit Challenge

Mon

Tue

Wed

Thr

Fri

Sat

Sun

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

Tool Of The Day:

"The Warnings Snitch"

Today we're looking into Revit warnings so we can solve them faster and easier.
Let's jump in.


You're About To Learn:

>>>

How To Read Warnings

>>>

Simple pyRevit Forms

>>>

pyRevit Linkify

Absolute Beginner?
1) Download pyRevit StarterKit
2) Follow pyRevit FastTrack System
3) Watch P.R.O.C.E.S.S. Method Masterclass

Let's Create

"The Warnings Snitch"

Using 7-Step P.R.O.C.E.S.S. Method

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

PLAN

The Warnings Issue in Revit…

Warnings suck in Revit…

Autodesk gave us a menu with barely any functionality. We can't even select anything…

It's very inefficient.
And frankly, we deserve better!

So, The Goal for Today's Tool:

Create a tool that can help us quickly find and select warning elements.

It's best if we can create an interactive report with warnings sorted by description and ability to select warning elements.


It might sound like a small tool, but it can save a lot of hours in the long run.

So let's build it together.

Today's Tool Demo:

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

RESEARCH

Coding CheatSheet

Here's everything you might need for today's challenge.
Use as much as necessary.

Coding Blocks

1. Get Warnings

1. Get Warnings

3. Sort Warnings by Description

3. Sort Warnings by Description

5. Create Linkify Object

5. Create Linkify Object

2. Read Warnings Info

2. Read Warnings Info

4. Get Failing + Additional Elements

4. Get Failing + Additional Elements

6. pyrevit SelectFromList

6. pyrevit SelectFromList

1. Get Warnings

2. Read Warnings Info

3. Sort Warnings by Description

4. Get Failing + Additional Elements

5. Create Linkify Object

6. pyrevit SelectFromList

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 Research Prompt

AI Research Prompt

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

OUTLINE

Step-by-Step Plan

Don't overthink it!
I usually draw ugly boxes on a paper until it makes sense.
The goal is to brainstorm and discover hidden steps in between.

1

Get
Warnings

card-background

1

Get
Warnings

card-background

2

Sort Elements
By Warnings Type

card-background

2

Sort Elements
By Warnings Type

card-background

3

UI Form:
Select W.Type

card-background

3

UI Form:
Select W.Type

card-background

4

Create Interactive Report (Linkify)

card-background

4

Create Interactive Report (Linkify)

card-background

1

Get
Warnings

card-background

3

UI Form:
Select W.Type

card-background

2

Sort Elements
By Warnings Type

card-background

4

Create Interactive Report (Linkify)

card-background

👆Select Step Above.

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 YOURSELF
DON'T RUSH TO SOLUTION







NB!

TRY BUILDING YOURSELF
DON'T RUSH TO SOLUTION







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

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

CODE

Proof Of Concept

Remember: The goal is to code quick-n-dirty 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…

Create Proof Of Concept

To create proof of concept we can skip a few steps. We only need to focus on absolute minimum to see the desired result.

In this case:

  • Get Warnings

  • Iterate over them (for-loop)

  • Read Warning Description

  • Get Warning Elements

  • Create Simple Report (Linkify)

As you can see we're skipping big steps (Sorting, UI-Form) so we can focus on the basics until we can see partial result. Only then we want to focus on all steps.

The goal is to verify:

a) You can do it
b) It's actually useful

The rest we can fix during refactoring.

Proof Of Concept Demo

SCRIPT: PROOF OF CONCEPT

SCRIPT: PROOF OF CONCEPT

SCRIPT: PROOF OF CONCEPT

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

EDIT

Refactor Everything

Only once you have a proof-of-concept you can focus on refactoring your code and complete all steps. This is when you make your code more structured, optimized and easier to read.

REFACTOR CODE

Once your proof of concept works you can refactor your code.

We can complete all steps and during the process also structure, optimize and simplify our code.

So for this tool we want:

  • Get All Warnings

  • Sort Warnings by Type (description)

  • Create UI Form to select warning types

  • Create Interactive Reports

We already have a good chunk of code from POC. Now we just need to ensure we have a complete and smooth user experience with better structured code.

So let's do that.

REFACTORED CODE

REFACTORED CODE

REFACTORED CODE

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

STRESS-TEST

Time To Break Your Tool!

Many often rush sharing their tools too early and then hear others break it in different ways. You don't want that.

So it's best that you try to break it before anyone else can so you can fix it and save your reputation.

Follow the pyRevit Testing Protocol.

Error #1 - UI Form Results

Every time you ask user for an input they can break your tool. Therefore you need to test your UI forms throughout.

Check

  • Selection Works

  • What if you select nothing?

  • What if you close UI Form?

This can lead to issues if you didn't think about it in your code.
And it's actually very easy to solve.

Error When You Cancel UI Form

SOLUTION #1

SOLUTION #1

SOLUTION #1

Error #2 - Project Type / No Warnings

We can also check if we're in Project/Family Revit file.

In this case, it's very minor because you'll just get an empty list. But we can still add this simple check to inform users it's not meant for families. Or that there are no warnings in the currently open file.

SOLUTION #2

SOLUTION #2

SOLUTION #2

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

P

.

R

.

O

.

C

.

E

.

S

.

S

.

SHIP

Submit Your Code

Only once you have a proof-of-concept you can focus on
refactoring your code to complete all steps and make it
more structured, optimized and easier to read.

Time To Celebrate

Share Your Win On LinkedIn
With #pyRevitChallenge

I'll Add The Best Ones Here!

P.S. Please Like this post
to help me reach more people.
100% Appreciated, 0% Expected.

© 2023-2025 EF Learn Revit API

© 2023-2025 EF Learn Revit API

© 2023-2025 EF Learn Revit API