CadQuery
CadQuery is an open-source Python library for creating parametric CAD geometry programmatically. In AI-driven engineering workflows, it serves as the code generation target for CAD generation agents: the model writes CadQuery Python code, and a deterministic controller executes it to produce a STEP artifact.
Why CadQuery for agent pipelines
- Scriptable — AI models generate Python code rather than binary CAD files, making generation tractable
- Parametric — geometry is defined by parameters that can be systematically modified during repair loops
- STEP export — produces standard STEP files that can be ingested by FEA solvers, PLM systems, and downstream CAD tools
- Inspectable — the code is readable, so errors in the generated geometry can be traced back to specific lines
Role in the FEA feedback pipeline
Engineering Brief → Model generates CadQuery code
→ Controller executes code → STEP artifact
→ FEA validation → typed feedback
→ Model repairs CadQuery code → repeat
CadQuery is where the model’s reasoning becomes physical geometry. The controller handles everything after: execution, rendering, meshing, and validation. This separation keeps the model focused on design decisions and the controller focused on measurement.
Limitations for production use
- Generated CadQuery code may fail to execute (syntax errors, invalid geometry, assembly constraint violations)
- Even valid geometry may fail engineering constraints — visual plausibility ≠ engineering validity
- The Hephaestus-CCX benchmark found that frontier models rarely produce strict-passing artifacts on the first attempt
- CadQuery has its own API versioning; generated code may reference removed or changed methods
Related
- FEAFeedbackLoop — the agent pattern CadQuery enables
- ManufacturingAIAdoption — where CAD generation agents sit in the adoption landscape