SIGN UP

Vibe Coding Tutorial - Revit + ChatGPT

automation dynamo revit 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.

 

 

1- Use Python to Vibe-Code

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

 

2- Prepare a Custom GPT

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.

 

3- Clearly Define the Task you Want to Automate

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.

 

4- Mention the Revit release and Python version

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.

 

5- Tell ChatGPT to Ask You Questions

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?

 

6- Try the Script, Take Screenshots of the Warnings

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.

 

 

7- Repeat Until the Script Works

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.

 

Limitations and Warnings

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.

Get our "Develop a Custom Revit Toolbar" mini-course

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.

Join the Course

 

 

Comments

36 Free Revit PDF Guides

Get our collections of pamphlets, our series of guide about Revit complex topics.

Courses
Template
Doors
Masters

Recent Posts

Vibe Coding in Revit: Python Shell + ChatGPT

Jun 02, 2025

Vibe Coding Tutorial - Revit + ChatGPT

May 26, 2025

See All Blog Posts →