pyRevit Dev Docs

As a pyRevit developer you should be familiar with pyRevit Dev Docs. There is a lot of useful information and reusable code snippets. So let's dive in together, and see how pyRevit can make your life even simpler.

pyRevit Dev Docs

As a pyRevit developer you should be familiar with pyRevit Dev Docs. There is a lot of useful information and reusable code snippets. So let's dive in together, and see how pyRevit can make your life even simpler.

Summary

More Docs

Revit API Docs is not the only resource you will be referencing while creating your tools.

Since we will be working with pyRevit, you will also get familiar with pyRevit documentation. This resource is amazing, not only you get to see how to use pyRevit but it's also full of code samples that you can copy-paste and use in your own scripts.

Let's explore what's inside.

Where to find the Docs?

The easiest way to get the docs is to go to pyRevitLabs homepage.

You will find icon with links to all relevant resources under the big icon.

pyRevit Forum

Firstly, I want you to know about pyRevit Forum.

It's a great place to share your cool tools, ask for feedback and in general ask for help related to pyRevit.

It's very active in my opinion, and you will often hear back from Jean-Marc Couffin, who is very active in development and pushing pyRevit to the next level.

pyRevit Wiki

Then you can find pyRevit Wiki.

This one is not only for developers, but for all pyRevit users. It explain how to get started, how to install, how to use various tools and a few other topics.

You can check it, but I won't talk more about it.

pyRevit Dev Docs (Notion page)

And now we are getting to the best parts.

Firstly, let's have a look at pyRevit Dev Docs, which are hosted in notion.

This Dev Docs contains a lot of pages and even a few video tutorials from pyRevit's Dad - Ehsan Iran-Nejad.

Don't worry, you don't need everything from this documentation, but there are certainly a few very useful resources that you can put to use right away

💡 You already know about some of these resources from previous module.

pyRevit Button Clicks

For example, let's have a look at Button Click Modes together.


This page contains a bunch of information about how to make your tools execute different code if you:

  • Click regularly

  • SHIFT + Click

  • CTRL + Click

This is actually really useful and very simple to implement.

Imagine that you have a tool where you will grab all apartments in your project and generate apartment plans. You would do that with regular click.

But you can also add a feature to select which apartment plans to generate if you use Shift + Click. And it's just one of the examples.

in pyRevit Minify button, you will notice that Shift + Click will give you config menu where you can choose what to hide.

Here is simple code snippet combining these 3 button modes

from pyrevit import EXEC_PARAMS

#Shift Click
if EXEC_PARAMS.config_mode:
    print('Executing code with SHIFT + CLICK')

# CTRL Click
elif EXEC_PARAMS.debug_mode:
    print('Executing code with CTRL + CLICK')

else:
    print('Executing code with Normal CLICK')
Effective Inputs

Another very useful page is Effective Inputs.

I love it because you have a bunch of code snippets on the left and screenshot of the forms that you will get on the right. And you can just copy-paste the code and adjust it to your needs.

That's the easiest way to create forms with pyRevit. And there are a lot of them too.

I recommend you to have a look around and even copy a few snippets in your own code and see what you get.

Effective Outputs

Then there is also Effective Outputs.

In here you will find unique ways to display information to your users. You can create linkable buttons, tables, graphs and even print Markdown or HTML.

This can help you make your printstatements look like proper reports without spending time building your own custom UI

pyRevit API

Lastly, I want to talk about pyRevit API.

pyRevit is open-source, and it includes a lot of reusable functions. And you can learn more about them inside of pyRevit API documentation.

Not everything here is made for beginners. Majority is here for developers who make pyRevit work the way it works.

But there are also certain places where you can find reusable functions.

You can with forms, because you can also relate these functions to Effective Inputs page in pyRevit Dev Docs. But in here not only you can see a few code examples, you can also see all possible arguments and what they need along side other explanations.

This is where you can really understand about all the moving pieces of functions that you can use.

I recommend you to check functions from the following modules:

As I've shown you during the lesson, there are a few very simple functions that will allow you to make forms, ask user for selection and get certain Revit API variables.

You can explore the API Docs, but I know that it can be confusing because of all internal functions and classes inside of it too.

Summary

I hope you now see the value in the pyRevit Dev Docs and how easy it is to use them. it might be confusing at first, but hopefully you know where to focus your attention to get the most out of it.

These reusable functions should speed up your development process and provide you certain functionality which you can access with just a few lines of code.

HomeWork

Explore pyRevit Dev Docs and pyRevit API Docs and see what can be useful to you.

Try to use:

⌨️ Happy Coding!

Questions:

Why there are so many modules in pyRevit?

Why there are so many modules in pyRevit?

Can I look at source code in pyCharm?

Can I look at source code in pyCharm?

Discuss the lesson:

P.S. Sometimes this chat might experience connection issues.
Please be patient or join via Discord app so you can get the most out of this community and get access to even more chats.

P.S. Sometimes this chat might experience connection issues.
Please be patient or join via Discord app so you can get the most out of this community and get access to even more chats.

© 2023-2024 EF Learn Revit API

© 2023-2024 EF Learn Revit API

© 2023-2024 EF Learn Revit API