/

/

10-lazy-sheets

/

/

10-lazy-sheets

Day

10

pyRevit

Challenge

Day

10

pyRevit

Challenge

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

21-Day pyRevit Challenge

Mon

Tue

Wed

Thr

Fri

Sat

Sun

Tool Of The Day:

"Lazy Sheets"

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

If you ever had to create a lot of sheets manually then you know that it's a 'sheety' job💩.
It's repetitive, boring and takes a long time…

So it's the perfect task to automate so we can click the button, grab a cup of tea/coffee🍵 and comeback to hundreds of new sheets with views.

Today We're Practicing:

>>>

Filterfunc for pyRevit forms✨

>>>

Create New Sheets✨

>>>

Place Views on Sheets✨

>>>

pyRevit ProgressBar✨

>>>

BoundingBox Centroid

>>>

pyrevit print_table

Let's Create

"Lazy Sheets"

Using 7-Step PROCESS

Let's Create

"Lazy Sheets"

Using 7-Step PROCESS

.

.

.

.

.

.

.

PLAN

Enough of this SHEET 💩!

Creating sheets is boring, repetitive and it takes quite a lot of time. We don't want that…

Instead we want to click a button and create hundreds of new sheets. And it's one of the most satisfying scripts you can create.

The Goal for Today:

Create a tool to ask users to select unplaced views and TitleBlock to place them on new sheets.

Plus, don't forget an interactive report so users can easily navigate across all new sheets.

.

.

.

.

.

.

.

RESEARCH

Coding CheatSheet

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

Coding Blocks

Get Views (+filterfunc)

Place View On Sheets

Calculate BoundingBox Centroid

pyRevit Sample: ProgressBar

Get ViewTemplate Name from View

Select Titleblock

Create ViewSheet

pyRevit - print_table (Simplified)

Add ProgressBar

pyRevit Print Table

Get Views (+filterfunc)

Select Titleblock

Place View On Sheets

Create ViewSheet

Calculate BoundingBox Centroid

pyRevit - print_table (Simplified)

pyRevit Sample: ProgressBar

Add ProgressBar

Get ViewTemplate Name from View

pyRevit Print Table

Revit API Docs
  1. ViewSheet Class

  2. Viewport Class

  3. Transaction Class

pyRevit Dev Docs
Notes

🔸pyRevit Forms filterfunc argument

When you use default pyrevit forms to select something you have an option to provide filterfunc argument which takes function or lambda-function as argument. It just have to return True to allow elements.

🔸Get Elements In View

Whenever you use FilteredElementCollector to get elements visible in specific view it will drastically affect the performance because it needs to load up the view and element geometry to verify what's visible…

🔸Show ProgressBar

When your scripts can take a while you don't want your users to wonder if Revit is about to break or it works… So it's a good idea to show them a ProgressBar so they know how much is already done.

.

.

.

.

.

.

.

RESEARCH

Coding CheatSheet

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

Coding Blocks

Get Views (+filterfunc)

Select Titleblock

Place View On Sheets

Create ViewSheet

Calculate BoundingBox Centroid

pyRevit - print_table (Simplified)

pyRevit Sample: ProgressBar

Add ProgressBar

Get ViewTemplate Name from View

pyRevit Print Table

Revit API Docs
  1. ViewSheet Class

  2. Viewport Class

  3. Transaction Class

pyRevit Dev Docs
Notes

🔸pyRevit Forms filterfunc argument

When you use default pyrevit forms to select something you have an option to provide filterfunc argument which takes function or lambda-function as argument. It just have to return True to allow elements.

🔸Get Elements In View

Whenever you use FilteredElementCollector to get elements visible in specific view it will drastically affect the performance because it needs to load up the view and element geometry to verify what's visible…

🔸Show ProgressBar

When your scripts can take a while you don't want your users to wonder if Revit is about to break or it works… So it's a good idea to show them a ProgressBar so they know how much is already done.

.

.

.

.

.

.

.

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

Select Views
(Unplaced)

card-background

5

Generate
Interactive Report

card-background

2

Select
TItleBlock

card-background

*

Optionally:
Add ProgressBar

card-background

3

Create New
ViewSheet

card-background

4

Place Views
(Viewport.Create)

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

Select Views
(Unplaced)

card-background

5

Generate
Interactive Report

card-background

2

Select
TItleBlock

card-background

*

Optionally:
Add ProgressBar

card-background

3

Create New
ViewSheet

card-background

4

Place Views
(Viewport.Create)

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

.

.

.

.

.

.

.

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

.

.

.

.

.

.

.

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.

REFACTOR 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

.

.

.

.

.

.

.

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.

https://www.loom.com/share/d9a77a1949f54c95a90ec1778062c575

Ensure Views Selected

Ensure TitleBlock Selected

Improve Perfomance for Finding Centroid

Ensure ViewTemplate Set To Get its name

Ensure Viewports & Sheets in project

AI Prompt - Stress Test

.

.

.

.

.

.

.

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 Embed You Here!


Below it's just a placeholder for now…

© 2023-2026 EF Learn Revit API

© 2023-2026 EF Learn Revit API

© 2023-2026 EF Learn Revit API