Overview
This section provides complete, real-world examples of prompts paired with full Python scripts generated by Maestro AI. Each example is followed by commentary explaining how and why the script works, what to look for when reviewing AI-generated code, and what refinements users commonly make before moving a script into production.
These examples are ideal for:
- New users learning how to write effective prompts
- BIM managers building a standard internal automation library
- Anyone evaluating the repeatability and reliability of Maestro AI outputs
5.4.1 Batch Parameter Modifier
Use Case
Bulk‑updating parameters across a selection of elements — one of the most common and reliable AI-assisted workflows.
Example Prompt
Write a Python script for Revit using the Revit API.
Take the user’s current selection and filter it to only Doors.
Set the parameter “Comments” to “Needs Review”.
If the parameter is missing or read-only, skip the element.
Wrap all changes in a transaction and print how many elements were updated.
Example Script (AI Output)
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
from Autodesk.Revit.UI.Selection import ObjectType
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
selection_ids = uidoc.Selection.GetElementIds()
elements = [doc.GetElement(id) for id in selection_ids]
doors = [el for el in elements if isinstance(el, FamilyInstance) and el.Category.Name == "Doors"]
t = Transaction(doc, "Update Door Comments")
t.Start()
count = 0
for door in doors:
param = door.LookupParameter("Comments")
if param and not param.IsReadOnly:
param.Set("Needs Review")
count += 1
t.Commit()
print("Updated {} door(s).".format(count))
Review Notes
- Good: Clean, safe filtering of user selection
- Good: Checks for missing or read-only parameters
- Refinements often added:
- Additional conditional logic
- MVAR for custom comment text
- Logging for skipped elements
5.4.2 View Crop Box Controller
Use Case
Standardizing view crop regions across a set of views.
Example Prompt
Write a Python script for Revit that adjusts the crop box size of all selected views.
Set the crop height to 50 feet and width to 80 feet.
Leave the crop box center unchanged.
Skip any view that does not support crop regions.
Example Script (AI Output)
from Autodesk.Revit.DB import *
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
views = [doc.GetElement(id) for id in uidoc.Selection.GetElementIds()]
t = Transaction(doc, "Standardize Crop Boxes")
t.Start()
updated = 0
for v in views:
if not hasattr(v, "CropBox"):
continue
try:
crop = v.CropBox
min_pt = crop.Min
max_pt = crop.Max
center_x = (min_pt.X + max_pt.X) / 2
center_y = (min_pt.Y + max_pt.Y) / 2
new_half_width = 80 / 2.0
new_half_height = 50 / 2.0
crop.Min = XYZ(center_x - new_half_width, center_y - new_half_height, min_pt.Z)
crop.Max = XYZ(center_x + new_half_width, center_y + new_half_height, max_pt.Z)
v.CropBox = crop
updated += 1
except:
continue
t.Commit()
print("Updated {} crop boxes.".format(updated))
Review Notes
- Good: Clean math for centering crop region
- Good: Safely wrapped in try/except
- Refinements often added:
- MVARs for width and height
- Handling views with annotation crop
5.4.3 Duplicate and Rename Views
Use Case
Creating new design views based on existing plan or section views.
Example Prompt
Duplicate all selected views using the “WithDetailing” option.
Rename each duplicated view so that “(FLS)” is appended to the end of its name.
Skip views that cannot be duplicated.
Example Script (AI Output)
from Autodesk.Revit.DB import *
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
original_views = [doc.GetElement(id) for id in uidoc.Selection.GetElementIds()]
t = Transaction(doc, "Duplicate Views FLS")
t.Start()
duplicated = 0
for v in original_views:
try:
new_id = v.Duplicate(ViewDuplicateOption.WithDetailing)
new_view = doc.GetElement(new_id)
new_name = v.Name + " (FLS)"
new_view.Name = new_name
duplicated += 1
except:
continue
t.Commit()
print("Duplicated and renamed {} views.".format(duplicated))
Review Notes
- Good: Uses correct Duplicate method
- Good: Safe for most view types
- Refinements often added:
- More complex naming logic
- Avoiding duplicate name conflicts
5.4.4 Room/Space Data Fixer
Use Case
Quality control for room data across large projects.
Example Prompt
Find all rooms missing the “Occupancy” parameter.
Report them by element ID and room name.
Do not modify the model.
Example Script (AI Output)
from Autodesk.Revit.DB import *
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms)
rooms = collector.WhereElementIsNotElementType().ToElements()
missing = []
for r in rooms:
p = r.LookupParameter("Occupancy")
if not p or not p.AsString():
missing.append((r.Id.IntegerValue, r.Name))
print("Rooms missing Occupancy:")
for rid, name in missing:
print("ID: {}, Name: {}".format(rid, name))
print("Total:", len(missing))
Review Notes
- Good: Non-destructive QA script
- Good: Works well for audits and reporting
- Refinements often added:
- Export to CSV
- Highlight rooms in Revit UI
5.4.5 Batch Sheet Creator
Use Case
Quick creation of large sheet sets based on naming conventions.
Example Prompt
Create new sheets in Revit from this list:
A101 - Level 1 Plan
A102 - Level 2 Plan
A103 - Level 3 Plan
Use the 30x42 title block.
Print summary of created sheets.
Example Script (AI Output)
from Autodesk.Revit.DB import *
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
sheet_data = [
("A101", "Level 1 Plan"),
("A102", "Level 2 Plan"),
("A103", "Level 3 Plan")
]
titleblocks = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_TitleBlocks)
tb_type = titleblocks.FirstElement().GetTypeId()
t = Transaction(doc, "Batch Sheet Creation")
t.Start()
created = []
for number, name in sheet_data:
sheet = ViewSheet.Create(doc, tb_type)
sheet.SheetNumber = number
sheet.Name = name
created.append(sheet)
t.Commit()
print("Created {} sheets:".format(len(created)))
for s in created:
print("{} - {}".format(s.SheetNumber, s.Name))
Review Notes
- Good: Straightforward sheet creation
- Refinements often added:
- Title block selection via MVAR
- Detecting existing sheet number conflicts
5.4.6 Export Manager (PDF)
Use Case
Standardized sheet exports for coordination or submission.
Example Prompt
Export all sheets to PDF.
Use the sheet number as the filename.
Create the output folder if needed.
Print how many sheets were exported.
Example Script (AI Output)
from Autodesk.Revit.DB import *
import os
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
output_folder = r"C:\RevitExports\PDF"
if not os.path.exists(output_folder):
os.makedirs(output_folder)
collector = FilteredElementCollector(doc).OfClass(ViewSheet)
sheets = list(collector)
pm = doc.PrintManager
pm.PrintRange = PrintRange.Select
vset = pm.ViewSheetSetting
view_ids = List[ElementId]([s.Id for s in sheets])
vset.CurrentViewSheetSet.Views = view_ids
pm.PrintToFileName = output_folder
pm.SubmitPrint()
print("Exported {} sheets.".format(len(sheets)))
Review Notes
- Good: Clear export workflow
- Caution: PDF export mechanics differ across Revit versions
- Refinements often added:
- MVAR for export path
- Filtering by sheet set
Summary
This prompt library gives users concrete examples of how Maestro AI responds to structured prompts and how to evaluate AI-generated results.
These examples are the cornerstone of onboarding: users learn what good prompts look like and how to refine scripts before deploying them across a team or firm.