Briefly about me and this blog's intention.
My name is Erik Frits. I am an architectural technologist living in Vienna, Austria. I had opened Revit for the first time in 2014 and I was using it ever since. Everyone who used it for quite some time knows, that it misses many tools and requires multiple workarounds for certain tasks to be done. Eventually, it leads some people to explore the world of visual programming in Dynamo to create their own tools and automate repetitive tasks. When I used Dynamo for the first time I realized that this is the way to work in the 21st century! But then I discovered an even better tool - pyRevit made by Ehsan Iran-Nejad.
This blog will mostly focus on programming in the AEC industry within Autodesk Revit. I hope I can teach more people how to program in Python by sharing my workflows, snippets, and full tutorials on how to create your own tools with python and RevitAPI. I will cover a few other BIM-related topics that might be useful to others. I still google a lot of things about RevitAPI and use other people's snippets, so I would want to contribute back to the community as well.
My first steps in programming - 'Hello World'.
Like many others in the AEC, I have started my programming journey in Dynamo. One of my first big projects in dynamo was the redesign of paneling on a 114m high-rise residential building. The goal was to decrease panel typology and make the design more parametric. I had learnt how to use dynamo fairly quickly but I ended up with a huge spaghetti monster in Dynamo, which was hard to tame.
It was hard to work on my script after coming back to it after a few days. However, soon I realized that I could combine multiple nodes into a single Python Node but I didn't know how much Python I needed to know for it to happen. First I was using Python for just basic math operations where I created an algorithm for calculating distances between panels. It was not a very elegant script, but it did get the job done, and it combined a lot of nodes together. Here is the final result:
Not so bad for a first big project in Dynamo, huh?
How the heck did I end up coding my own add-ins?
After my first success with dynamo I kept on creating more scripts, but it was hard to make them accessible to my colleagues because dynamo can be intimidating and confusing and it has its flaws. We have encountered a few issues with the management of Dynamo packages across different computers, and it was not always under our control.
Eventually, I decided to givepyRevit a try. It was very promising, the creator - Ehsan Iran-Nejad is truly a hero in the AEC industry. He has created the whole work-frame to allow people to use python within Revit and also he produced multiple tools that go along with pyRevit. The best part about pyRevit is that you can access the code of any tool and learn from others how they write their scripts. If you hold [alt] and click on the button it will open the folder where the script is stored and you can see its code. This is absolutely essential for new programmers to see how other people code.
The AEC industry is moving forward slow.
Look at how fast the IT industry is growing. One of my personal beliefs is that this exponential growth is related to how much code is shared for free. Lots of different libraries and open source projects are available for anyone to download and use for their own purposes, with a few limitations for copyrights of course. For any program you would want to create, there are already multiple libraries and packages available for you to use and it drastically reduces the work.
There are quite many people sharing their workflows, plugins, and teaching others to leverage programming so others could automate and optimize their workflows. But there can be even more, So I have decided to join the mainstream of sharing information and tools so others can save their time on boring tasks and move on to more exciting ones.
Learning Python and RevitAPI.
I have stepped on a journey of learning python in the end of 2018 and I clearly remember my struggles when I could not find enough information on using RevitAPI with python. Along the way, I learnt how to translate C# code snippets to reuse them in my own scripts, but the most satisfying moments were when I was finding snippets with explanation already in Python. I think it's time for me to pay back and contribute my knowledge to the AEC community by sharing my snippets and teach you how to create your own Revit add-ins to increase your productivity and automate your boring tasks.