Lesson 8.2Lesson 8.2 · Code & Automation
Revit, Dynamo & BIM Scripting
Claude can write the Dynamo, pyRevit and Revit API scripts that automate the dull, repetitive chores of a BIM model - as long as you read them and always test on a copy first.
The most valuable script is the one that does a boring job three hundred times without a single slip - and never on your live model until you have checked it.
Every BIM model hides a layer of pure drudgery. Two hundred sheets need renaming to a new convention. A thousand elements need a parameter filled in. Doors need renumbering room by room. A whole sheet set needs exporting to PDF with consistent names. None of this is design; all of it eats hours and invites human error precisely because it is repetitive. This is exactly the work a script does perfectly - and exactly the work Claude can write for you from a plain-English description, whether as a Dynamo graph, a pyRevit snippet, or Revit API code.
BIM raises the stakes, though, in a way a fresh Rhino sketch does not. A Revit model is your single source of truth, often shared, often deep into a live project. A script that reads and reports is harmless. A script that writes, renames, renumbers or deletes can, if it is subtly wrong, corrupt hundreds of elements in one click - and Revit's undo does not always save you. So this lesson carries one rule above all others, in bold from the start: always test on a copy. Detach a copy, run the script, verify by hand, and only then let it near live work. Claude writes the automation; the copy-first discipline, and the checking, are yours.
A rule in one sentence, applied 300x. Transaction + tight target. Copy first, always.
The BIM chores worth automating
The first skill is spotting the right jobs. A task is a good candidate for a script when it is repetitive, rule-based, and done many times - when you could write down the rule in a sentence and then apply it mechanically. "Rename every sheet so the number comes before the name." "Set the Fire Rating parameter to 60 minutes on every wall of this type." "Renumber doors to match the room they open into." "Export every sheet in this set to PDF, named by sheet number and title." Each of these is a rule plus a lot of tedious repetition, and repetition is where humans slip and scripts do not.
Equally important is knowing what not to hand to a script. Anything that needs judgement on each item - deciding which wall should be fire-rated, or whether a door numbering clash matters - is design thinking, not a chore, and stays with you. The sweet spot is the mechanical part downstream of your decisions: you decide the rule; the script applies it faithfully a few hundred times. The figure opposite lays out six classic candidates, from renaming sheets to auditing which elements are missing data. Notice they share a shape - a clear rule, applied at scale.
There is also a hierarchy of risk hiding in that list, and it should shape how carefully you check. Scripts that only read - auditing missing data, listing every blank field, counting doors - cannot damage anything; the worst case is a wrong report, which you will notice. Scripts that write - setting parameters, renaming, renumbering - change the model, and a subtle error there propagates silently. Sort your candidate jobs into read-only and model-changing from the outset, because the second kind demands the copy-first discipline without exception, and the first kind is a safe place to build your confidence.
One more filter is worth applying before you automate anything: is the rule actually stable, or does it still have judgement baked into it? "Renumber doors to match their room" is stable - the rule holds for every door. "Fix the doors that look wrong" is not - it hides a hundred small decisions a script cannot make. If you cannot write the rule as a sentence a stranger could follow without asking you a question, it is not yet ready to hand to Claude; it is still design work, and it stays with you until the rule is clear.
Good script job = a rule you can write in one sentence, applied hundreds of times.
Dynamo, pyRevit and the Revit API in plain terms
Three routes let code drive Revit, and you can grasp all three quickly. Dynamo is Revit's visual programming tool, much like Grasshopper for Rhino: you wire nodes on a canvas to read and change the model, no typing required, and Dynamo can also run Python inside a node. pyRevit is a free add-in that lets you run Python scripts against Revit with far less boilerplate than the raw API - the friendliest route for a designer. The Revit API is the full programming interface underneath both, usually written in C# or Python; it is the most powerful and the most verbose. You rarely need to choose in advance - describe your task to Claude and ask which route suits it; often pyRevit or Dynamo-Python is the gentlest.
Here is a pyRevit-style script that tags every selected wall as reviewed by writing to its Comments parameter. Read the comments as much as the code:
# pyRevit: set the Comments parameter on every selected wall.
# TEST ON A COPY of the model first. Changes are wrapped
# in a Transaction so Revit can record and undo them.
from pyrevit import revit, DB
with revit.Transaction("Tag walls as reviewed"):
for el in revit.get_selection():
if isinstance(el, DB.Wall):
p = el.LookupParameter("Comments")
if p and not p.IsReadOnly:
p.Set("Reviewed 2026-09")Even unfamiliar, it reads plainly: for each selected element, if it is a wall, find its Comments field, and if that field exists and is editable, set it. The Transaction wrapper matters - in Revit, any change to the model must happen inside one, and it is what lets the change be recorded and undone. When you read a script Claude gives you, checking that model changes sit inside a Transaction is one of your first safety checks. Ask Claude to always include it and to explain what each guard - if p and not p.IsReadOnly - protects against.
Read it, and always test on a copy
Now the rule that this whole lesson is built around. Before a model-changing script ever touches live work, run it on a copy. In Revit that usually means detaching a copy of the central model or duplicating the file, opening that, and running the script there. You verify the result by hand on the copy - open a few of the walls you tagged, check the Comments actually say what you intended, confirm nothing else changed - and only when the copy is clean do you run the same script on the real model. The figure lays out this sequence: copy, run, verify, then and only then apply to live work. Undo is not a strategy; a copy is.
Reading the code is the other half. You are checking three things above all: that changes are wrapped in a Transaction; that the script targets the right elements and nothing more (a filter that is too broad will happily edit the whole model); and that any hard-coded value - a parameter name, a text string, a number - is exactly right, because a typo in a parameter name can silently do nothing or, worse, hit the wrong field. Here is a read-only counterpart in C# that simply counts doors - the safe kind of script, useful for a sanity check before and after a change:
// Revit API (C#): count the doors in the active document.
// Read-only - it changes nothing, so it is safe to run anywhere.
var doors = new FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_Doors)
.WhereElementIsNotElementType()
.ToElements();
TaskDialog.Show("Count", $"Doors in model: {doors.Count}");A neat professional habit: run a read-only count like this before and after a model-changing script. If you renumbered doors and the count changed, something went wrong - the before/after count is a cheap, powerful verification that needs no expertise, only the discipline to do it.
Copy -> run -> verify -> THEN live. Undo is not a plan. A copy is.
From chore to checked result
Put the pieces together into a repeatable, safe workflow and BIM automation stops being scary. You describe the chore to Claude in plain English, naming the exact parameter or naming rule and the elements it should touch. Claude drafts the Dynamo, pyRevit or C#, with comments and a Transaction where needed. You read it, checking the target is precise and the changes are wrapped safely. You save a copy of the model, run the script there, and verify by hand - spot-checking elements and comparing a before/after count. Only then does it run on live work, and even then you glance at the results. Each step is small; together they turn an hour of error-prone clicking into a minute of checked automation.
A few honest cautions keep you out of trouble. Revit, Dynamo, pyRevit and the API all change across versions, and a method that worked last year may have moved - so treat Claude's code as a strong draft to test in your version, not a guarantee. Claude does not know your model's specific families, shared parameters or naming conventions unless you tell it; feed it the exact parameter names and it writes far better code. And never run a script you cannot at least follow in outline - if you genuinely cannot tell what a line does, ask Claude to explain it before you run it, especially anything that deletes or overwrites.
The payoff, handled this way, is substantial and safe. The tedious, repetitive, error-prone layer of BIM production - the renaming, the parameter-filling, the exporting, the auditing - compresses into scripts you direct in plain English and trust because you tested them. That is time returned to design and coordination, which is where your judgement actually earns its keep. Claude supplies the tireless typist who never gets bored on the three-hundredth sheet; you supply the rule, the copy-first discipline, and the checked sign-off. It is your model, and your name on it, so the final verification is always yours.
There is a cultural benefit too, worth naming to a team that is nervous about all this. A studio that scripts its chores well does not become more careless; done properly it becomes more careful, because the tedium that used to breed slips is gone and attention is freed for the things that genuinely need a human. The renaming becomes consistent, the parameters complete, the exports uniform - and the hours saved go back into coordination, into checking the design, into the client. That is the honest promise of BIM automation with Claude: not fewer people, but the same people spending far less of their day on work that never deserved their judgement in the first place.
Dynamo / pyRevit / Revit API
Visual scripting, a Python add-in, and the full programming interface for Revit
Claude writes for all three. Ask which suits your task; pyRevit or Dynamo-Python is usually the gentlest route for a designer.
Transaction
The wrapper every change to a Revit model must sit inside
It lets Revit record and undo changes. Checking that model edits are wrapped in one is a first-line safety read on any script.
Copy-first discipline
Running model-changing scripts on a detached copy before live work
Not a Claude feature - your rule. A before/after count on the copy is a cheap, powerful verification anyone can do.
Workshop — a safe first BIM script
You will practise the copy-first workflow on a read-only script, so there is zero risk while you build the habit. If you do not have Revit, do the reading and verification steps on the code alone - the discipline is the point.
Claude.ai; Revit with pyRevit or Dynamo if available (otherwise do the reading and planning steps).
Goal: run a read-only audit script safely and verify it Inputs: a Revit model you can open (or a sample) + Claude.ai Time: ~30 minutes
- 1Ask Claude: 'Write a pyRevit (or Dynamo Python) script that lists every room missing a value in the Finish parameter, and prints the count.' Tell it your exact parameter name.
- 2Have Claude comment each line and confirm the script is read-only - it should change nothing.
- 3Read it: what elements does it target, what does it check, what does it output? Note any hard-coded parameter name.
- 4Save a COPY of your model and open the copy, even though this script is read-only - it builds the reflex you need for model-changing scripts.
- 5Run it on the copy. Verify: cross-check two of the rooms it flagged against the model by hand.
- 6Now ask Claude to adapt it into a model-changing version that fills a default finish, and write down the extra checks you would do before running that one on live work.
You’ll walk away with
A verified read-only audit script run on a copy, plus a written list of the extra safety checks required before running its model-changing version on a live model.
Three altitudes on the same idea
Read the band that fits you — or all three.
BIM automation is where Claude pays for itself fastest in a delivery-stage practice. Sheet management, parameter population, schedule prep, batch exports - the chores that quietly consume a team's evenings. Standardise on one rule your whole studio follows without exception: model-changing scripts run on a detached copy first, verified with a before/after count. Feed Claude your exact shared-parameter names and conventions so its code fits your template. The risk is real - a bad script scales a mistake instantly - so the copy is non-negotiable.
If you work in Revit for fit-outs, start with the read-only chores. Ask Claude for a script that audits which rooms are missing a finish parameter, lists FF&E items by type, or checks that every door has a fire rating filled in. These report without changing anything, so they are safe to run and immediately useful for a QA pass before issue. When you move to model-changing scripts - renumbering, filling finishes - the copy-first rule applies to you exactly as to anyone else.
Learning to read a Revit script now puts you ahead of graduates who only click. Use Claude to explain what Dynamo nodes or a pyRevit snippet actually do, and always practise on a sample model you can afford to break - never a studio or firm file. Understand the Transaction, understand why targeting the right elements matters, and build the copy-first habit before you ever work on live projects. Studios increasingly expect new hires to automate chores safely; this is how you arrive able to.
“If a Revit script goes wrong, I can just press undo and nothing is lost.”
Do it yourself
These are about safe judgement in BIM, not code trivia.
- 1What three qualities make a BIM chore a good candidate for a script?
- 2Why is a read-only script safe to run anywhere, while a model-changing one is not?
- 3What does a Transaction do, and why should you check for it when reading a Revit script?
- 4Describe the copy-first workflow in order, and say why undo is not a substitute.
- 5How does a before/after count act as a verification, and what expertise does it require?
The one line to carry out
Peer-reviewed journals & authoritative standards
- 01Building information modeling — Wikipedia, 2026.
- 02Autodesk Revit — Wikipedia, 2026.
- 03Python (programming language) — Wikipedia, 2026.
- 04Application programming interface — Wikipedia, 2026.
Not every automation needs Rhino or Revit. Much of a designer's daily maths lives in a humble spreadsheet - and Claude is excellent at formulas. Next we build small, checkable tools in Sheets and Excel, starting with an area and cost sheet.
The author
Amogh N P
Architect, interior designer, and creative polymath. Studio Matrx began in his notebooks — his vision of design made honest, useful, and open to everyone. Its Academy is written and taught in his memory, and free, forever.
More about Amogh →