Pan-Chera/Multi-Agent-CAD
MAC (Multi-Agent CAD): A decoupled multi-agent framework for text-to-CAD generation via constrained test-time compute
Multi‑Agent CAD (MAC)
What it does – MAC turns a plain English (or Chinese) design brief into real, editable CAD geometry. It can:
- Create a single printable part from a prompt.
- Decompose a description of a mechanism into multiple components, generate each part, mate them together, and export a complete assembly.
- Verify the generated geometry automatically and, if needed, repair it using an LLM‑driven code‑fix loop.
- Export the results as standard engineering files (STEP, STL, GLB) and, for assemblies, as a URDF that can be dropped into robotics simulators.
Why it matters – Traditional CAD requires a skilled user to write code or manually model shapes. MAC lets engineers or hobbyists describe what they want in natural language and receive a fully parametric model that can be edited, 3‑D printed, or simulated. The project also showcases how multi‑agent pipelines (planning, code generation, verification, repair) can dramatically cut the amount of LLM tokens needed compared with a baseline “CAD‑Skills” approach.
Key components
- Multi‑agent workflow – Uses LangGraph to orchestrate separate LLM stages: a planner that decides the part hierarchy, a geometry generator that writes Python code for the
build123dkernel, a visual verifier, and a “Judge” that decides whether the output passes geometric checks. - Aider‑driven repair – If the generated script fails to run or the geometry is invalid, the Aider tool runs an LLM‑guided edit loop until the model is fixed.
- Web UI – A lightweight FastAPI/React interface lets users type a prompt, watch a 3‑D preview, and download the exported files. Security measures (CSRF header, host allow‑list, optional destination‑path control) are built‑in.
- Assembly pipeline – An experimental extension (MAC v2) that splits a description into sub‑parts, defines joint interfaces, re‑uses mirrored components, and produces a URDF for downstream robotics simulation.
- Benchmarks – The README reports a single‑part benchmark on two Qwen models, showing >99 % feature‑pass rates while using 60‑100× fewer tokens and 6‑13× lower estimated cost than a reproduced baseline.
How to get started
- Clone the repo and create the conda environment from
environment.yml. - Install the helper
aider-chat(pinning NumPy as described) and set your DashScope (or other OpenAI‑compatible) API key. - Edit
multi_agent_cad/config.pyto setUSER_REQUEST(e.g., “a 30 mm cube”). - Run
python -m multi_agent_cad.graphfor a command‑line generation, or install the web extras (pip install -e "[web]") and launchpython -m multi_agent_cad.webto use the browser UI. - For assemblies, set
MAC_ASSEMBLY_REQUEST(or use one of the provided markdown prompts) and runpython -m mac_assembly.
Typical use‑cases
- Rapid prototyping of custom 3‑D‑printable parts.
- Generating mechanical sub‑assemblies for robotics research (e.g., a gripper or gantry) and immediately feeding them into a physics simulator via URDF.
- Educational demos that illustrate how LLMs can drive parametric CAD without manual scripting.
Limitations
- The assembly generation is still a “technology preview”; success rates are not quantified, and users must manually validate joints and clearances before manufacturing.
- The pipeline depends on specific model providers (DashScope, OpenRouter) and on the
build123dkernel version < 0.13 due to a STEP runtime constraint. - Running the generated Python code executes with the user’s permissions, so the web UI should stay on a trusted local machine.
License – MIT (see LICENSE).
All information above is taken directly from the repository’s README; no external assumptions have been added.
Related
- Dispatch
- Project
- Dispatch
- Project
- Project