workflowcad/Workflow-CAD
Über uns
Official implementation of Workflow-CAD paper and upcoming add-in.
Wissenschaft und TechnikGemessener Sternzuwachs
- in 24h
- +3
- in 7 days
- Verlauf wird gesammelt
- in 15 days
- Verlauf wird gesammelt
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
OriginalWorkflow-CAD & Workflow-CAD-Bench
Paper: Mining and Simulating Engineer Workflows for Agentic CAD Modeling · arXiv · Hugging Face Daily Paper · Dataset
Workflow-CAD is a closed-loop agentic CAD modeling system that drives native SolidWorks. Its action space is not atomic API calls but engineer-level workflows mined from large collections of feature trees and assembly relations. Each workflow resolves semantic geometric references, maps a canonical sketch frame to the native one, pre-checks profiles, verifies its geometric effect and rolls back on failure. After every action the agent observes the real model state (and, optionally, native rendered views) before deciding what to do next.
Workflow-CAD-Bench is a 200-task benchmark for agentic CAD modeling:
| Track | Tasks | Input | Scoring |
|---|---|---|---|
| Text-to-part | 100 (50 easy / 30 medium / 20 hard) | natural-language design brief | per-task deterministic geometric rubric on the delivered STEP |
| Three-view-to-part | 50 | third-angle engineering drawing (PNG) + one neutral sentence | drawing-grounded rubric + projection image score |
| Motion-aware assembly | 50 mechanisms, 629 component roles | functional assembly brief | assembly-structure rubric + motion check (driven by the evaluator) |
This repository contains everything needed to build the agent on one Windows PC and run the full benchmark protocol used in the paper.
Workflow-CAD/
├── build_service.bat / run_service.bat build / start the SolidWorks HTTP service
├── sw_service/ C# SolidWorks service (.NET Framework 4.7.2, Xarial.XCad + COM), port 5100
├── workflow_cad/ Python side
│ ├── server.py HTTP backend of the part agent (/api/run), port 5000
│ ├── planner/workflow/ part agent: tools, canonical (u,v) frames, semantic refs, profile pre-checks,
│ │ post-check & rollback, compact context
│ ├── planner/assembly_workflow/ assembly agent: joints, gear/screw couplings, DOF / pose / motion checks
│ ├── planner/skills/recipes/ the five mined assembly strategies given to the assembly agent
│ ├── geomcheck/ evaluator (OpenCASCADE): rubrics, projection score, assembly & motion scoring, tests
│ └── eval/ benchmark runners, SolidWorks watchdog, report script, assembly reference tools
└── benchmark/ Workflow-CAD-Bench (prompts, rubrics, drawings, reference STEP files, assembly specs)
Large binary benchmark files (reference parts and reference assemblies for the assembly track, reference STEP files of the text track) are distributed on Hugging Face, see Benchmark data.
1. Requirements
| Tested with | Notes | |
|---|---|---|
| OS | Windows 11 x64 | SolidWorks COM automation only runs on Windows |
| SolidWorks | SolidWorks 2025 (Chinese UI), activated | must be able to create a new part from the default part template. 2024/2026 should work (see §2.2) |
| Visual Studio 2022 or newer, or Build Tools for Visual Studio | VS 2026 Community | workload .NET desktop development with the .NET Framework 4.7.2 targeting pack |
| Python | 3.14.3 (python.org installer, includes the py launcher) |
cadquery-ocp==8.0.1.0.0 needs a wheel for your Python version; 3.14 is simplest |
| Git | any | |
| LLM | any OpenAI-compatible Chat Completions endpoint | must support tool / function calling. The three-view track and the default view_model / view_assembly tools also need image input |
In the paper all systems use Qwen3.8-Flash-Next (self-served FP8, 73,728-token context) as the backbone. Any OpenAI-compatible endpoint works: the OpenAI API, a gateway, or a self-hosted vLLM / SGLang server (enable automatic tool choice and the tool-call parser of your model).
Grading STEP files only (text and three-view tracks) needs neither SolidWorks nor Visual Studio, only Python; see §5.
2. Setup
All commands below are run in PowerShell or cmd on the Windows machine. <repo> is the clone directory.
2.1 Get the code (and optionally the large benchmark files)
git clone https://github.com/workflowcad/Workflow-CAD.git
cd Workflow-CAD
The text and three-view tracks run directly from benchmark/. For the gold assembly condition and the
assembly positive controls, download the full dataset into benchmark/ (see Benchmark data), or point
WORKFLOW_CAD_BENCH at a separate download.
2.2 Build the SolidWorks service
build_service.bat
The script finds MSBuild with vswhere, restores the NuGet packages (Xarial.XCad 0.8.3, which ships the
SolidWorks interop assemblies) into sw_service\packages (downloading nuget.exe if it is not on PATH),
and builds sw_service\bin\Debug\Chapter1.ConnectToSw.exe.
- The project also references
api\redist\SolidWorks.Interop.swmotionstudy.dllfrom the SolidWorks install folder, which is read from the registry for SOLIDWORKS 2024–2026. If that fails, pass the folder explicitly:build_service.bat "D:\Apps\SOLIDWORKS Corp\SOLIDWORKS\". - The other interop references are pinned to version
34.1.1.11(SolidWorks 2025). If another SolidWorks version reports a reference/version mismatch, change these three versions insw_service\Chapter1.ConnectToSw.csproj, or point theirHintPathat the DLLs in yourapi\redist. - Close a running service before rebuilding (the exe is locked while it runs).
2.3 Python environments
Two separate virtual environments are used: venv for the agent and the runners, venv-occ for the
OpenCASCADE evaluator (also used by the agent's render_views tool and for grading assembly parts).
cd <repo>\workflow_cad
py -3.14 -m venv venv
venv\Scripts\python.exe -m pip install -r requirements.txt
py -3.14 -m venv venv-occ
venv-occ\Scripts\python.exe -m pip install -r geomcheck\requirements.txt
Check:
venv\Scripts\python.exe -c "import openai, flask, pydantic, requests, shapely; print('main ok')"
venv-occ\Scripts\python.exe -c "import OCP, numpy, yaml; print('occ ok')"
Optionally run the evaluator self-test (no SolidWorks needed, about 20 minutes). It rebuilds every reference
solid and every targeted mutant of the three part tracks and the assembly part rubrics and checks that the
references score 100 and each mutant fails exactly its intended items (expected: 1117 passed):
venv-occ\Scripts\python.exe -X utf8 -m pytest geomcheck/tests -q -p no:cacheprovider
2.4 Configure the LLM
copy .env.example .env # in workflow_cad\
Edit workflow_cad\.env (it is git-ignored; never commit it):
OPENAI_API_KEY=sk-...
OPENAI_BASE_URL=https://api.openai.com/v1 # or http://<host>:8000/v1 for a self-hosted server
WORKFLOW_CAD_MODEL=<model-id>
OPENAI_BASE_URL is the root of the OpenAI-compatible API (usually ending in /v1, without
/chat/completions). Values set in the shell take precedence over .env. For a self-hosted model whose
context window is not built into planner/workflow/agent.py, set WORKFLOW_CAD_CONTEXT_LIMIT to its total
window (input + reasoning + output) so that the agent can shrink its output budget near the limit.
3. Start the system
Start SolidWorks as a normal user (not Run as administrator; otherwise the COM connection fails).
Start the SolidWorks service (keep the window open):
run_service.batIt connects to the running SolidWorks and listens on
http://localhost:5100/. Check withcurl http://localhost:5100/api/ping.Start the Workflow-CAD backend (needed for the part tracks and for interactive use):
cd <repo>\workflow_cad venv\Scripts\python.exe -X utf8 -u -m server # http://localhost:5000Try one design brief:
venv\Scripts\python.exe -c "import requests; r = requests.post('http://localhost:5000/api/run', json={'instruction': 'Create an 80 x 60 x 10 mm mounting plate with R8 rounded corners and four through holes of diameter 7 mm, each 12 mm from both adjacent edges.'}, timeout=3600).json(); print(r['summary'])"SolidWorks builds the part with a native feature tree; it stays open. Save or export it through the service (
POST /api/save-part-as {"savePath": ...},POST /api/export-step {"stepPath": ...}) and close it withPOST /api/close-all-documents.
4. Evaluation protocol (Workflow-CAD-Bench)
This is the protocol behind the paper's Workflow-CAD results: on all three tracks the latest workflow version with compact context is used. Only the model may change between compared runs; keep every other setting fixed.
4.1 Fixed settings
| Setting | Text-to-part | Three-view-to-part | Assembly |
|---|---|---|---|
| Agent | part workflow L1_v2 + compact context |
same, drawing sent to the model | parts: L1_v2 + compact; assembly: workflow v3 + compact context + speed optimizations |
| Prompt language | English (prompt_en) |
Chinese neutral sentence (prompt) + drawing |
Chinese (prompt) |
reasoning_effort |
medium |
medium |
medium |
| LLM call budget | 40 per task | 40 per task | 40 per part, 100 for the assembly |
| Output budget | 32k per turn (4k for the compact verifier), recovered on truncation | same | 16k per assembly turn |
| Visual tools | view_model |
view_model + render_views |
view_model (parts), view_assembly |
| Runs per task | 1 | 1 | 1 |
| Temperature / cache | 0 / no LLM response cache | same | same |
| Watchdog | --sw-restarts 2 --sw-max-private-gb 12 |
--sw-restarts 3 --sw-max-private-gb 12 |
1 infrastructure retry |
These are the defaults of the runners; the commands below only name the model and the run.
Rules:
- One SolidWorks instance serves one evaluation process at a time. Never run two runners concurrently.
- Use a new
--namefor every model / configuration.--resumerefuses to continue a run with different settings. - Interrupted runs are resumed with the same command plus
--resume: external failures (llm_error, lost SolidWorks, failed checkpoint replay) are rerun from the saved checkpoint, finished runs are kept. Never rerun a task because its score was low. - If the provider rejects
reasoning_effort, pass--no-reasoning-effort(do not substitute another value) and report it. For a text-only model add--no-view-toolon the text and assembly tracks and report it; the three-view track requires image input. - Report the code commit, SolidWorks version, model id, provider/serving setup and context window.
4.2 Smoke test (one task per track)
With SolidWorks, the service and the backend running (in workflow_cad\):
venv\Scripts\python.exe -X utf8 -u eval\run_part_bench.py --track text --ids stool --name smoke_text
venv-occ\Scripts\python.exe -X utf8 -m geomcheck.rubric --track text --artifacts runs\smoke_text --output runs\smoke_text\scores.json
venv\Scripts\python.exe -X utf8 -u eval\run_part_bench.py --track three_view --ids b01_l_bracket --name smoke_tv
venv-occ\Scripts\python.exe -X utf8 -m geomcheck.three_view --artifacts runs\smoke_tv --output runs\smoke_tv\scores.json
venv\Scripts\python.exe -X utf8 -u eval\run_assembly_bench.py --cases lead_screw_stage --name smoke_asm
Expected: SolidWorks builds a four-legged stool and an L-bracket. runs\smoke_text\ contains
stool_r1.step, .SLDPRT, .trace.json, .checkpoint.json and runs.json, and grading prints a line like
stool_r1.step: score=100.0 ... accepted=True. The assembly smoke test generates the 6 parts of a lead-screw
stage, assembles them and prints parts=... assembly=... motion=... e2e=.... If a step fails, see
§6.
4.3 Track 1: text-to-part (100 tasks)
# 1) model the 100 tasks (easy 50 + medium 30 + hard 20); one STEP per task in runs\text_<tag>\
venv\Scripts\python.exe -X utf8 -u eval\run_part_bench.py --track text --model <model-id> --name text_<tag>
# 2) grade offline from the STEP files (no SolidWorks / LLM needed)
venv-occ\Scripts\python.exe -X utf8 -m geomcheck.rubric --track text --artifacts runs\text_<tag> --output runs\text_<tag>\scores.json
# 3) optional breakdown: mean score with bootstrap 95% CI, pass@1, core-form rate, per part category
venv-occ\Scripts\python.exe -X utf8 -m geomcheck.bench --track text summary runs\text_<tag>\scores.json --repeats 1
--track easy|medium|hard runs or grades one split only. A task whose STEP is missing counts as score 0.
4.4 Track 2: three-view-to-part (50 tasks)
venv\Scripts\python.exe -X utf8 -u eval\run_part_bench.py --track three_view --model <multimodal-model-id> --name tv_<tag>
venv-occ\Scripts\python.exe -X utf8 -m geomcheck.three_view --artifacts runs\tv_<tag> --output runs\tv_<tag>\scores.json
venv-occ\Scripts\python.exe -X utf8 -m geomcheck.bench --track three_view summary runs\tv_<tag>\scores.json --repeats 1
The drawing goes directly to the model (no separate OCR / vision stage). geomcheck.three_view adds the
projection image score to every rubric result; --diff-dir <dir> writes per-task difference images.
c3_gear_pair and d17_pipe_clamp require exactly two bodies; the runner passes this to the agent.
4.5 Track 3: motion-aware assembly (50 mechanisms)
The assembly runner drives both agents itself, so server.py is not needed (SolidWorks and the service are).
venv\Scripts\python.exe -X utf8 -u eval\run_assembly_bench.py --model <model-id> --name asm_<tag>
For each case the part agent builds every component from its prompt; each part is graded immediately by its
interface rubric (benchmark/assembly/part_rubrics). The assembly agent then receives the assembly brief, the
five mined strategies and the part paths. When it finishes, the evaluator saves the assembly, reads its
components and mates and scores the assembly-structure rubric (rigid groups, semantic joints, mobility,
grounding, mate validity, couplings), then independently drives the mechanism (33 motor cases) or imposes the
prescribed poses (17 pose cases) for the motion score. Results go to runs\asm_<tag>.json, assemblies and
parts to runs\asm_<tag>\. A case is a success (e2e) when all its parts pass and the motion check passes.
Rows hit by SolidWorks crashes are retried once and, if still affected, flagged infra_contaminated and
excluded from the summary; rerun them with --resume.
Other conditions: --condition gold assembles the reference parts (needs benchmark/assembly/gold_parts)
to isolate assembly planning; --condition e2e stops a case as soon as one part fails.
--cases gearbox,engine,... selects cases (bench / bench2 expand to the 20 / 23 extension cases).
Every task of all three tracks also has an English (or Chinese) translation of its prompts: --lang en on
run_assembly_bench.py and --lang zh|en on run_part_bench.py switch the prompt language. The defaults are
the paper's protocol; results in different languages are not directly comparable, so report the language. The
English assembly prompts are maintained in eval/assembly/prompts_en.yaml, and
python -m eval.assembly.prompts_en check verifies that every translation keeps all numbers and identifiers.
4.6 Report
venv-occ\Scripts\python.exe -X utf8 -m eval.report --text runs\text_<tag> --three-view runs\tv_<tag> --assembly runs\asm_<tag>.json
prints the metrics of the paper's main table:
| Track | pass@1 | Score | Aux. | Tokens |
|---|---|---|---|---|
| Text-to-part | accepted rate (all items pass) | mean rubric score | Form: core-form rate | mean total tokens per task |
| Three-view-to-part | accepted rate | mean rubric score | Image: mean projection score | mean total tokens per task |
| Assembly | mean e2e |
mean assembly-structure score | Motion: mean motion score | parts + assembly tokens per task |
| Overall | task-weighted over 100 / 50 / 50 | task-weighted | task-weighted |
Tokens include input, reasoning and output tokens. For reference, the paper reports for Workflow-CAD with
Qwen3.8-Flash-Next: text-to-part 0.88 / 96.5 / 0.98 / 170.1k, three-view 0.84 / 96.4 / 97.6 / 136.7k,
assembly 0.50 / 91.1 / 68.3 / 2691.0k, overall 0.78 / 95.1 / 792.0k. Single runs per task include sampling
noise; use --repeats k on every compared system to estimate variance.
4.7 Ablations (paper, Table 4)
The workflow components of the three-view ablation can be switched off one at a time on the part tracks:
--no-canonical-uv-frames, --no-semantic-face-refs, --no-profile-precheck, --no-post-check-rollback,
and --no-view-tool (native visual inspection).
4.8 Positive controls of the assembly evaluator
With the full dataset in place, every reference assembly should score 100 / 100:
venv\Scripts\python.exe -X utf8 eval\assembly\rescore_assemblies.py --reference --out runs\reference_rescore.json
27 cases use independently constructed reference assemblies (gold_parts/reference_<case>.SLDASM); the
23 second-batch cases use oracle assemblies built only with the public v3 workflows (gold_parts/<case>/oracle_assembly.SLDASM,
with the tool-call trajectory in oracle_trajectory.json). The reference parts themselves can be rebuilt in
SolidWorks with eval\assembly\build_standard_parts.py all, and the specs and rubrics of the extension cases
are generated by python -m eval.assembly.bench_cases write / bench_cases2 write.
5. Evaluating another CAD system
Text and three-view grading only reads the geometry of the delivered STEP file, so any modeler, CAD kernel or code generator can be evaluated without SolidWorks:
cd <repo>\workflow_cad
venv-occ\Scripts\python.exe -X utf8 -m geomcheck.bench --track text tasks --output tasks_text.jsonl
venv-occ\Scripts\python.exe -X utf8 -m geomcheck.bench --track three_view tasks --output tasks_three_view.jsonl
Each line is {"case", "kind", "prompt"} (three-view tasks also have "image", the absolute path of the
drawing). Produce one STEP per task named <case>_r1.step (millimetres; any position and orientation) in one
folder and grade it with the commands of §4.3 / §4.4. The assembly track evaluates mates and motion inside
SolidWorks and therefore requires a SolidWorks assembly.
6. Troubleshooting
- The service cannot connect to SolidWorks: start SolidWorks first, with the same (non-administrator) privilege level as the service.
- Build fails with missing references / version mismatch: see §2.2; check the SolidWorks install folder
and the interop versions in the
.csproj. - New parts cannot be created: check Tools > Options > Default Templates in SolidWorks; the default part template must exist. Units of the template do not matter (the service works in SI units, STEP carries units).
- LLM errors / timeouts: check
OPENAI_BASE_URLand the model id; the model must support tool calls. For400errors aboutreasoning_effort, use--no-reasoning-effort. render_viewsfails: the agent callsworkflow_cad\venv-occ\Scripts\python.exe; create that environment or setGEOMCHECK_PYTHON.- SolidWorks becomes slow over a long run: the runners check SolidWorks' private memory before each task and
restart SolidWorks and the service above 12 GB. The watchdog finds
SLDWORKS.exefrom the registry; setSOLIDWORKS_EXEif it does not. - Grading reports an invalid solid for a SolidWorks STEP: OCC occasionally reads degenerate SolidWorks
surfaces as invalid; the part runner stores SolidWorks' own body count / volume next to each STEP
(
.swmass.json) and the grader uses it for solid, volume and bounding-box checks.
Benchmark data
benchmark/ in this repository contains the prompts, rubrics, drawings, three-view reference STEP files and
assembly specifications/rubrics. The complete dataset, including
text_to_part/references/<split>/<case>.step: reference solids of the 100 text tasks (exported from the evaluator's reference constructors),assembly/gold_parts/: reference parts (SLDPRT + STEP) of the 50 mechanisms, 27 reference assemblies and 23 oracle assemblies with aliases and tool-call trajectories,
is available on Hugging Face: https://huggingface.co/datasets/fansunqi/Workflow-CAD-Bench
Download it into benchmark/ (files that already exist are identical and are overwritten):
workflow_cad\venv\Scripts\python.exe -m pip install -U huggingface_hub
workflow_cad\venv\Scripts\hf.exe download fansunqi/Workflow-CAD-Bench --repo-type dataset --local-dir benchmark
Alternatively, download it elsewhere and set WORKFLOW_CAD_BENCH to that folder (e.g. in workflow_cad\.env).
The dataset card describes the file layout, the tasks.jsonl index of each track (loadable with
datasets.load_dataset("fansunqi/Workflow-CAD-Bench", "text_to_part" | "three_view" | "assembly")) and how to
download a single track.
Community
Everyone interested in agentic CAD modeling is welcome to join our WeChat group (scan the QR code below with WeChat). WeChat group QR codes expire after 7 days; if this one has expired, please find the latest one on the project page.

License
Non-commercial use only.
- Code: PolyForm Noncommercial License 1.0.0 (Required Notice: Copyright (c) 2026 The Workflow-CAD Authors, see NOTICE).
- Benchmark data (
benchmark/and the Hugging Face dataset): CC BY-NC 4.0.
SOLIDWORKS is commercial software and must be licensed separately; Xarial.XCad (MIT) is restored from NuGet at build time.
Citation
If you use Workflow-CAD or Workflow-CAD-Bench, please cite:
@article{fan2026workflowcad,
title={Mining and Simulating Engineer Workflows for Agentic CAD Modeling},
author={Fan, Sunqi and Yin, Runqi and Chen, Lingshan and Liu, Zhiguang and Rao, Yongming and Xu, Qunce and Hu, Shi-Min},
journal={arXiv preprint arXiv:2611.38444},
year={2026}
}
Ähnliche Projekte entdecken
Wird geladen…