feat: harden CAD showcase skill and delivery pipeline
This commit is contained in:
28
README.md
28
README.md
@@ -32,18 +32,26 @@ git clone ... tools/cad-building-showcase # 克隆到项目内任意位置(
|
||||
处理 DWG/DXF 转 3D/Web 展示任务时,必须先完整阅读
|
||||
tools/cad-building-showcase/SKILL.md 并遵守其中 One-Shot Definition of Done
|
||||
七条门禁:门禁失败即停下修复,绝不绕过;改动任何脚本后必须跑
|
||||
`python3 tools/cad-building-showcase/tests/test_extraction_pipeline.py` 且全绿。
|
||||
`pytest tools/cad-building-showcase/tests/test_contracts.py tools/cad-building-showcase/tests/test_delivery.py`
|
||||
与 `python3 tools/cad-building-showcase/tests/test_extraction_pipeline.py` 且全绿。
|
||||
```
|
||||
|
||||
**任何其他 Agent 的兜底用法**:把上面那段话作为任务开场白直接粘给它——skill 的全部约定都在 `SKILL.md` 里,脚本自含 CLI(`--help` 可查),不依赖宿主工具的任何私有机制。
|
||||
|
||||
**运行依赖**:Python ≥3.10 + `ezdxf`(惯例装到 `pip install --target work/vendor ezdxf`)、`shapely`、`trimesh`、`matplotlib`;Node ≥18(`tools/compress.mjs`、无原生转换器时的 WASM DWG 兜底)。可选:libredwg(`dwg2dxf` 批量转换)、ODA File Converter(坏件/天正大图兜底,脚本自动调用)、Blender(高保真渲染分支)。
|
||||
**运行依赖**:Python ≥3.10,核心运行 `pip install -r requirements-core.txt`,交付验证再装 `requirements-delivery.txt`;Node ≥18。可选:libredwg、ODA File Converter、Blender、IfcOpenShell。先运行 `python3 scripts/cad_showcase.py doctor` 检查环境。
|
||||
|
||||
**跨平台**:脚本全用 pathlib + 显式 UTF-8 I/O + 子进程 bytes 解码,macOS/Linux/Windows 均可跑。工具发现顺序:Blender = env `BLENDER` → PATH → 平台安装默认(macOS 应用包 / Windows `Program Files\Blender Foundation`);ODA = env `ODA_CONVERTER` → PATH → 平台默认(Windows 含 `Program Files\ODA`)。Windows 建议:设 `PYTHONUTF8=1`(防重定向输出按 GBK 解码)、开启 LongPathsEnabled(中文长文件名的深层 work/ 目录可能触及 260 字符 MAX_PATH);Windows 上 libredwg 少见,DWG 转换以 ODA 为主路径。
|
||||
|
||||
## 用法
|
||||
|
||||
入口是 `SKILL.md`(操作手册):决策循环、One-Shot Definition of Done 七条门禁、天正图层方言预设、多栋厂区流程。核心链路:
|
||||
入口是 `SKILL.md`(决策树与硬门禁),详细分支按需读取 `references/`。推荐统一 CLI:
|
||||
|
||||
```bash
|
||||
python3 scripts/cad_showcase.py inspect --input <cad> --work work/<project> --output outputs/<project>/read_report
|
||||
python3 scripts/cad_showcase.py run --dxf-dir <dxf> --config <config> --source-report <cad_read_report.json> --out-dir outputs/<project> --name <project> --backend trimesh --web --offline --resume
|
||||
```
|
||||
|
||||
核心链路:
|
||||
|
||||
```
|
||||
cad_dxf_report.py 读图报告(警告:多框图纸/缓存XREF/陌生图层方言…)
|
||||
@@ -60,10 +68,9 @@ register_site_outlines.py / massing_from_outline.py / assemble_campus.py
|
||||
## 目录
|
||||
|
||||
- `scripts/` 全部流水线脚本(自含 CLI,`--help` 有说明)
|
||||
- `tests/test_extraction_pipeline.py` 回归套件(改任何脚本后必跑)
|
||||
- `references/` 案例记录与校准资料:`pipeline.md`(详细流程)、
|
||||
`generalization_test_log.md`(泛化测试与缺口修复清单)、
|
||||
`贝昂CAD诊断与skill优化.md`(首个案例全程)
|
||||
- `schemas/` extraction config、building spec、variants manifest 的版本化 JSON Schema
|
||||
- `tests/` 契约/交付测试 + 合成 DXF 全链路回归
|
||||
- `references/` 当前运行规范;历史复盘移到 `docs/history/`,不再作为 Agent 运行上下文
|
||||
- `assets/` Web 模板与离线 viewer 内联库
|
||||
|
||||
`work/`、`outputs/`、源 CAD 均不入库(见 `.gitignore`),由脚本从源数据再生。
|
||||
@@ -71,7 +78,10 @@ register_site_outlines.py / massing_from_outline.py / assemble_campus.py
|
||||
## 验证纪律
|
||||
|
||||
```bash
|
||||
python3 tests/test_extraction_pipeline.py # 必须全绿
|
||||
pytest tests/test_contracts.py tests/test_delivery.py
|
||||
python3 tests/test_extraction_pipeline.py
|
||||
ruff format --check scripts tests && ruff check scripts tests
|
||||
npm run check:js
|
||||
```
|
||||
|
||||
已在四套真实图纸上端到端验证:贝昂科技厂区(基线)、黄桥文体中心、13号地块(双塔+酒店厂区)、27号地块(7栋混合厂区)。质量对比表见 `references/generalization_test_log.md`。
|
||||
已在四套真实图纸上端到端验证:贝昂科技厂区(基线)、黄桥文体中心、13号地块(双塔+酒店厂区)、27号地块(7栋混合厂区)。历史质量对比见 `docs/history/generalization_test_log.md`。
|
||||
|
||||
Reference in New Issue
Block a user