Vibe Coding Tutorial - Revit + ChatGPT
May 26, 2025
Vibe-coding is a new slang expression for using AI to generate code quickly, even for people who aren't programmers... such as myself.
In this video, I explore vibe-coding with Revit. I try to automate a task, and ask ChatGPT to do all the work for me. In this example, we'll try to renumber doors based on the rooms they are placed in.
When using the Python language, you have 3 potential tools to vibe-code:
a) Python Script Node inside Dynamo
If you have rudimentary knowledge about Dynamo, this is the easiest one to get started. We'll be using this technique in this tutorial.
b) Custom pyRevit tool
This option requires basic knowledge of creating a pyRevit tool in the ribbon. Our mini-course with Erik Frits covers these steps.
c) Revit Python Shell
This is a free plugin where you can run Python code directly. Download here
ChatGPT's knowledge about the Revit API is limited. You have to nudge it a bit. The best way is to create a custom GPT and provide extra guidance and information.
You can use the BIM Pure GPT.
If you want to create your own, it's quite simple. You need to provide:
- Links to the Revit API Docs.
- Examples of scripts using Python.
- Guidance on how to interact with the users.
- Instructions to ensure ChatGPT triple-check everything to avoid hallucinations.
Think of your task as a cake recipe. The more information you give about each step, the more likely vibe-coding will be successful. You should also include what the script should do in case some information can't be found. In this example, we want to renumber doors based on the rooms they are placed in.
1- Get all doors in the project on the "New Construction" phase.
2- Find the "ToRoom" information for each door. Use the rooms in the "New Construction" phase.
3- Update the mark value to be: [ToRoom]-[DoorIndex]. Door Index is the number of doors for each room, starting with number 1.
4- If the ToRoom value is empty, use FromRoom instead.
If you are using Revit 2025, you need to be clear with ChatGPT about it. When using a Python script node inside Dynamo, you must mention which Python version—either CPython3 or IronPython.
The most common mistake people make is to jump too fast to the code.
Ask ChatGPT if it has all the necessary information, and ask follow-up questions.
Here is the final prompt:
I want to build a Python script to use inside of Dynamo. Revit 2026, CPython3. Here is what I want the script to do:
1- Find all the doors in the project. In the new phase “New Construction”.
2- Find the “ToRoom” information value for each of these doors. Use the rooms in the New Construction phase as well.
3- Update the mark values of the doors to be [ToRoom]-[DoorIndex]. Door Index is the door number for this specific to Room.
4- If the ToRoom value is empty, use the FromRoom instead.
Is there anything missing, or anything else you need to complete the script?
Create a new script in Dynamo. Set the run mode to Manual.
Add a Python Script node. Right-click the node, and click on Edit.
Click on Save and Run.
It is very likely the script won't immediately work, and that you'll receive a yellow warning sign. Hover your cursor over the warning to see more details.
Take a screenshot of that warning and paste it back into ChatGPT. No further explanation is needed; the AI should figure it out by itself and provide the full code again.
You might play ping-pong with ChatGPT a bit. Send all warnings back to ChatGPT as screenshots. Put back the generated code into Dynamo. Eventually, you won't see any more warnings, and the script should work.
Of course, try this on a sample model first to avoid causing damage.
As you see, this is a guerrilla-style way of coding. It's suitable for quick and dirty code, but you might quickly encounter limitations. Having good knowledge of the Revit API is a huge asset here.
Join Erik Frits in a mini-course about the Revit API. You'll learn how to develop your custom toolbar using pyRevit. And you can easily use some of these "vibe-coding" principles inside this toolbar. But at least you'll grow a foundation with a rough idea of what's happening.
Enter your details below to get this free guide.