LearnRevitAPI
Oct 19, 2023
My Programming Journey
Many people think that Learning Revit API is impossible! And so did I. But like any other skill: we have to start small and build it step by step.
"The journey of a thousand miles begins with a single step." - Lao Tzu
💡 Let me tell you my journey with programming in AEC.
The Project
5 years ago I discovered Dynamo.
I saw the potential right away and so I started learning basics. However, I didn't use it in the real setting for a while.
Until one day, we decided to redesign a facade on a High-Rise project.
👇The tower on the left.
💡Q Tower, Wien - Awesome project by RLP.
The initial design was clear and it needed computational design.
💡 The goal was to create a Facade with 2 vertical panel sizes and a variable horizontal panel between them.
The Larger panels should follow a curve and smaller panels fill the space between them.
🤐 Sounded too complicated for a Dynamo beginner but we wanted to try.
⚠️ I would often break my scripts while trying,
And once, I accidentally made a Piano Tower.😂
🐛 Not all bugs created equal.
Somehow within the next 2 weeks I made a spaghetti monster as a proof of concept.
It wasn't perfect but it clearly showed that it's possible to place panels along the curve and fill the space between.
💪 So now it was about optimizing the script.
Python Nodes
At first I was trying to do everything with nodes, but then the size of the script became an issue.
So I started to look for a way to combine multiple nodes together. And python seemed like a good alternative to try.
Python was great for doing simple math.
I managed to calculate all sizes and distances to place panels and even had hardcoded controls.
At the time, I was an absolute python beginner.
I didn't even know about 'for loops'.
I used 'while loop' and counted items.
😂👉
After a lot of trials and errors I had an even bigger spaghettis monster that did exactly what we wanted.
⚠️ But it took 40 minutes to place 15 000 panels.
It sounded reasonable for a beginner Dynamo user.
There was an issue
🍀 Luckily, I noticed that one Dynamo node was slowing the whole process. So I tried to fix it, and the only solution was a custom python node with Revit API. Scary...
It was a simple task so I managed to do it thanks to many forums and tutorials.
and Result?
🔥 The script took 40 seconds! I tried it again, 40 seconds again.
I was beyond overwhelmed.
🤯 By fixing a single node I improved the script runtime by 6000%.
🔎Once you get a result like this you start to pay attention. I broke my previous belief that Revit API was hard, because I saw what kind of return it can give me.
And so my Revit API journey began.
💡It's worth noting that it was a really bad Dynamo Node.
I didn't become genius over-night (unfortunately 😔)
What's Next?
I picked up Revit API basics from everywhere I could and I started to make more python nodes in Dynamo. I still had lots of gaps in my knowledge but that didn't stop me.
💡Then I discovered pyRevit (thanks to Jakob Steiner).
At first I was skeptical but then it blew me away.
✅ It includes a lot of tools by default.
✅ Everything is Open-Source (We can read source code)
✅ Simple folder structure is enough to create custom Revit extension
✅It has pre-written functions that can be used by beginners.
✅Absolutely Free.
Too good to be true... But it is!
📢 Huge shout-out to Ehsan Iran-Nejad(pyRevit Dad) and other developers who helped him create this gem. (Gui Tallarico, Jean-Marc Couffin and others)
Practice makes it perfect.
I moved to pyRevit from Dynamo and since that moment, I always looked for a way to create a script to help me.
⌚ If a task would take around 5 hrs manually but coding could take 5-10 hours, I would always try to code.
1️⃣First of all I improved my programming skill.
2️⃣And secondly, If I succeeded, the next time I encounter the same task it would take me minutes instead of hours.
❌ I'm not going to lie, I failed to create a lot of scripts.
💡 But I always learnt something new.
And over long enough, I learnt a lot about Revit API!
The Outcome
👉 Fast forward to today - and I help other Revit Users to learn Revit API.
Once you learn basics, you realize that it's not as complicated if you know where to look. And my goal is to make it as simple for you as possible.
💡 And it all is possible because I started small and kept making tools and learning new things from that.
If you are in the beginning of your programming journey, the one thing you should focus the most is - Practice.
Start small and step by step you will learn more and create better tools.
"The journey of a thousand miles begins with a single step." - Lao Tzu
📩 I'd love to hear about your programming journey in AEC.
What challenges have you faced and how did you overcome them?"
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 7400+ people!