DEV Community

Cover image for Why AI Code Generation Breaks on CAD Automation - and What Actually Works
Alona Potapova
Alona Potapova

Posted on

Why AI Code Generation Breaks on CAD Automation - and What Actually Works

A field report from CAD/BIM projects where ChatGPT, Copilot, and Cursor consistently fail - and the engineering patterns that succeed.

Every CTO running a construction, EPC, or oil & gas engineering team has had this conversation in 2025:
"Can't we just use AI to automate our Revit/AutoCAD workflows? Copilot writes Python, right?"
The honest answer is: partially, and only for the easy 20%. The other 80% - the part that actually saves money - is where LLM-generated code breaks silently, produces wrong geometry, or compiles fine and corrupts your model file the moment a user runs it.
This is not a takedown of AI tools. We use them daily. This is a working note on where they reliably fail in CAD/BIM automation, written from five years of building production tools for AutoCAD, Revit, AVEVA E3D, and Plant 3D.

The Three Layers Where LLM-Generated CAD Code Breaks

  1. Geometric kernels do not forgive approximate code Ask Copilot to "write a Python script that calculates optimal formwork panel placement for an irregular concrete slab outline." You will get plausible-looking code. It will run. It will produce a panel layout.

It will also be wrong, because:

  • It treats the outline as a 2D polygon when real concrete pours have re-entrant corners, embedded pipe penetrations, and stage joints
  • It cannot reason about which combinatorial reuse pattern minimizes panel inventory across pour stages - this is an NP-hard optimization problem, not a templating task
  • It does not know the actual panel sizes, connection hardware, or load ratings of the specific formwork system (DOKA, PERI, or proprietary) We built POSforAFS, a custom AutoCAD-integrated tool that solves exactly this problem for a contractor. The result: 70% reduction in calculation cost, 85% faster turnaround. What previously took a structural engineer days now takes hours. [Full case study]

The reason an LLM cannot generate this tool is not "the AI is not smart enough yet." It is that the problem requires:

  • A formal optimization algorithm tuned to the contractor's specific formwork system
  • AutoCAD API integration at the geometric kernel level (not the document-export level)
  • Validation logic against real-world panel inventories and load ratings These are not retrieval problems. They are engineering problems with thin training data.
  1. CAD APIs are legacy, undocumented, and version-fragile The AutoCAD .NET API, Revit API, and AVEVA PML have decades of accumulated edge cases. The official docs cover the happy path. Production code lives in the 30% that the docs do not cover:
  2. The Revit API method that worked in 2022 and threw InvalidOperationException in 2024 because Autodesk changed transaction handling
  3. The Plant 3D SDK behavior that depends on whether the project is in "Project Manager" mode versus "drawing-only" mode
  4. The Smart 3D tool that only works inside a using block with a specific COM lifetime

LLMs trained on public code repositories do not see this. They generate code that looks correct, matches the documentation pattern, and crashes on the third user action because of a known undocumented behavior. We rewrite about 60% of any LLM-generated CAD code before it touches a production model.

  1. Enterprise integration is where data goes to die The most expensive CAD automation problems in EPC are not "draw faster." They are: how does the BoM in my Plant 3D model get into SAP without three engineers re-entering it for six weeks.

We built a CAD–SAP integration platform for a midstream gas processing plant. The numbers, before automation:

  • 15% error rate on Bills of Materials transferred from Plant 3D to SAP
  • 6+ weeks of delay on every asset handover from engineering to procurement
  • ~4 hours of engineer time per BoM package on data re-entry

After:

  • <2% error rate(the remaining errors are edge cases flagged for review, not silent failures)
  • 1 week engineering-to-procurement handover
  • ~15 minutes per BoM package

This required:

  • A bi-directional sync between AutoCAD Plant 3D and SAP S/4HANA
  • A rules-based mapping engine handling SAP master data conventions, procurement codes, cost centers, and edge cases
  • An automated validation pipeline that catches formatting and classification errors before data enters SAP

Could an LLM generate this? It could generate the boilerplate. It cannot understand SAP's material master schema, your company's naming conventions, or the project-specific compliance rules. Those are not in any training set. [Full integration case study]

What Actually Works

Three patterns we use on every CAD automation engagement:

  1. Integration at the API level, not the file-export level. Tools that read DWG/RVT exports always lag the current model state. Tools built on AutoCAD API, Revit API, or AVEVA PML always reflect the live drawing.

  2. Validation layers between systems, not after them. Catch SAP-formatting errors before they enter SAP. Catch LOD violations before they enter your federated Revit model. Cleaning up bad data downstream is 10× more expensive than blocking it upstream.

  3. Project-specific logic encoded explicitly, not learned implicitly. The reason custom CAD automation works is that we encode your formwork system, your SAP material classifications, your clash ownership rules. Generic tools, AI-generated or otherwise, cannot do this.

When to Hire Engineers vs. When to Use AI

Use AI tools (Copilot, Cursor, ChatGPT) for:

  • Boilerplate UI code in your plugin
  • Quick prototypes of standalone calculators
  • Documentation drafts and unit test scaffolding

Hire CAD automation engineers for:

  • Anything touching the geometric kernel of AutoCAD, Revit, Plant 3D, or Smart 3D
  • CAD-to-ERP/PLM integration (SAP, Oracle, Teamcenter)
  • Multi-discipline clash management, COBie pipelines, regulatory compliance tools
  • Anything where a wrong output costs more than the engineer's time to write it

We've published the full case studies referenced above. If you're scoping a CAD automation project and want to pressure-test the approach, [book a 30-minute call with our engineering team](https://instandart.com).

InStandart builds CAD/BIM automation, custom plugins, and CAD–ERP integration for EPC, construction, and oil & gas engineering teams. 140+ organizations served across the US, EU, and Israel. Where AI generation breaks, we solve.

Top comments (0)