LearnRevitAPI

Nov 20, 2022

Create Your Own Revit Extension!

"You don't have to be great to start but you have to start to be great " Zig Ziglar

I encourage you to create your own pyRevit extension for Revit!
It's much easier that you think, thanks to the simplicity that pyRevit offers. Let's have a look how to create one.

📂 Folder Structure

It's super beginner friendly to make an extension with pyRevit. You need to create a folder structure with the right suffixes, and pyRevit will do the rest!

Here is a folder structure example

👇

Download example folder structure of my existing extension (EF-Tutor) and have a look. It will be much easier to understand and you can make some changes so it's named and looks like you want it to!

📁👉 GitHub Link (EF-Tutor)

P.S. There are files in the repository that necessary for GitHub. Such as readme, license, gitignore, gitattribures

👀 Let's have a closer look

.extension

This is the root folder of your whole extension, that's where it get started! You can create many tabs and place extra folders such as lib and hook.

.tab

This is what you actually see as an Add-In tab in Revit. We can have a single .extension but we can display multiple .tabs in Revit. It helps us organize our tools better especially if they have different purpose.

.panel

Once you open any tab in Revit, you will notice that toolbar consist of multiple panels. It can help us group certain tools together to provide better UX(user experience)

⏺️ After a while you will need to be more resourceful with the space you have in your toolbar. And there are certain structures that can help us do that.

.pulldown

Pulldown menus are great because we can place a lot of tools inside of them. As you can see in the image, I have created a Rooms.pulldown folder and placed 3 pushbuttons inside of it. You can place as many buttons as it can display on the screen. 

.stack

Stacks allows us to place 3 buttons instead of 1 in the same space. And the best part is that we can start stacking .pulldown menus as well. In the image you can see that I have placed 2 .pulldown menus and 1 .pushbutton

.pushbutton

This is the most common way to create a button in pyRevit. We just need to place script.py and icon.png (96x96px max) inside and pyRevit will display this button inside your Revit UI. Simple, isn't it?

lib (Reuse Your Code)

You should know that good coders code, but great coders reuse. And pyRevit got you covered again. We can easily create a library of code snippets that we can use across all our scripts. Have a look at the example folder structure I provided

🔎 Lastly, tell pyRevit where to look

1️⃣ pyRevit Settings

Go to pyRevit tab and look for Settings button. You can see where it is located in the screenshot.

2️⃣ Add path to you .extension

Once you open Settings nenu, in 'Custom Extensions Directories' add a path where your .extension folder is located. You won't even need to restart Revit, pyRevit will reload and display your new extension. 

🥳 Congratulations

Extra Resources

📚 pyRevit Dev Documentation

pyRevit has a great documentation, with lots of examples. Personally I skipped that step when I started, but if I would spend a day reading what's inside, I would save myself so much time by using existing functions... So take advantage of that!

📁pyRevit Dev Docs

❇️ icons8.com

There are many websites to get your free icons but I use this one. It's easy to use and has huge library to choose from. All my icons for EF-Tools and EF-Tutor came from here. You don't need icons bigger than 96x96px for pyRevit!

👉Get Icons

Video Tutorial

Check out a tutorial video where I explain Folder Structure of pyRevit
👇

Create your first Extension for Revit

I explain pyRevit folder structure so you can create and orginize your extension. I will also show you how to work with lib folder so you can start reusing your code as soon as possible!
👀 Watch it

Enjoyed Newsletter?

Leave a Testimonial Here.

⌨️ Happy Coding!
Erik Frits

Join Newsletter

📩 You will be added to Revit API Newsletter

Join Us!

which is already read by 7400+ people!