Resources
Summary
Intro
Hi pyRevit Hackers,
Welcome to the python introduction module for Revit users.
If you’ve
never coded before,
or you last programming experience was too boring
or you just need to refresh your memory
You are in the right place.
I will cover all the python concepts you need to learn to become pyRevit Hacker. Also, I want to be very clear.
It’s not a full in depth python course, because we will need a lot more time together for that. Instead, In this module I will introduce you to all the programming concepts you need to understand to become pyRevit Hacker.
Once you know about them, you will be able to dive deeper with other courses on YouTube, Coursera, EDX or even my python basics course which I will release later in 2025. But tss, you will hear more about this in my newsletter.
Why python?
So Firstly, let’s ask ourselves: why python?
The reason is - python is the most popular programming language in the world. That doesn’t happen by accident.
Python’s popularity comes from its:
Simplicity,
Readability,
Ease of use
And huge community behind it.
Python is very versatile programming language and its one of the easiest and quickest to get started with. It's more forgiving than others languages.
It’s perfect for a busy AEC expert like you. You already have a lot on your shoulders and we already work on tight schedules with unrealistic deadlines. So choosing a language that is easy and quick to start with - is perfect.
python is very versatile and can be used for a lot of things like:
Web Development, Data Analysis, Machine Learning, AI, IoT…
and of course you’ve guessed it - The Revit API.
Once you know python you will find a way to apply to anything you want.
And if you ever decide to switch to another programming language it will be 80% easier to learn than first one, because the computation logic and concepts stay the same. Only syntax changes and libraries that you use.
So that’s why I recommend you to focus on python first.
How to execute python Code
Alright by now I hope you understand that python is amazing and its a great choice for Revit. But how do we use it?
Usually, if you want to execute python code, you would write a script and save it as a .py file. Then you could execute it using:
Terminal called CLI (Command Line Interface)
Code Editors like pyCharm, VS Code…
Online Python Interpereters
I've even placed an online python interpreter for you at the bottom of this page. We will need to use it quickly soon. But personally, I recommend you to stick to pyCharm.
How to execute python Code in Revit?
Now the most important part: To execute python code in Revit, we need access to Revit Application so it can use Revit API classes.
We can do that by using:
Dynamo Python Nodes
pyRevit
Or some other plugins
AS you've guessed it, we will be using pyRevit during this course. However, for this module about python basics, we will take a step back and simplify it.
We will only focus on python so you can execute it using anything you want (pyCharm, Online Code Editors, Terminal…).
And then I will show you how to use it in Revit in the next module.
Let's begin Your Programming Journey.
Are you ready to write your first python program?
I mean RIGHT NOW.
Every new programmer across all languages always starts their journey with the iconic 'Hello World' Statement. It's like a sacred tradition in programming. And we will also follow this sacred tradition.
The "Hello World" program symbolizes the moment when you make computer speak for the first time with code. And it's also one of the easiest ones to make.
We need to write the following:
You can try it right now using pyCharm or the interpreter below. Just make sure you don't forget any quote symbols or parenthesis. They all have a meaning and I will explain it in the following lessons.
For now just try it out.
P.S.
This python interpreter is taken from another website so you can quickly test python snippets. Unfortunately, there aren't good alternatives, so we have to use this one with the default message.
You can delete everything that is already written there.
Outro
Alright I hope you already had a chance to write Hello World and you got excited for what’s coming next.
Now I want to warn you that there is no way back.
You’ve just began your programming journey and you have to continue. And keep in mind that programming is not just about learning how to write code, it’s about solving problems.
Programmers are problem solvers first, and it just happened that we use code for that as it’s the most efficient way to solve repetitive tasks.
So buckle up, as this module will teach you how to write python code and create logic that solves real problems and you will start thinking like a programmer.
Happy Coding and see you very soon.
HomeWork
Begin your programming journey.
Write your first "Hello World" statement and make computer speak with your own code.
And under no circumstances: "Do not break this sacred tradition". It's simple but very important step for any beginner programmer. Otherwise programming gods might send a wave of bugs to your code later on. 🧙♂️
⌨️ Happy Coding!