feat: harden CAD showcase skill and delivery pipeline

This commit is contained in:
2026-07-10 09:21:13 +08:00
parent a6856f903d
commit 8b1b1d5e89
53 changed files with 5405 additions and 1327 deletions

View File

@@ -1,5 +1,12 @@
# A208 Case Notes
## Contents
1. Source/conversion calibration
2. Layer and alignment signals
3. Showcase/IFC results
4. Presentation calibration
These notes capture the proven workflow from the A208 CAD-to-3D exploration. Use them as calibration, not as hardcoded constants.
## Source Set

29
references/bim_branch.md Normal file
View File

@@ -0,0 +1,29 @@
# BIM and IFC Branch
Use this branch only when the user explicitly requests IFC, BIM-like semantics, or asks whether the showcase can replace BIM.
## Claim Levels
- `Web showcase`: CAD-derived visual model; never BIM replacement.
- `Massing/LOD100-150`: approximate floor/wall/structure visualization.
- `IFC/BIM proof`: IFC entities, storeys, containment, properties, and geometry validation exist.
- `BIM replacement candidate`: require discipline-specific semantics, openings, spaces, quantities, materials, classifications, georeferencing, coordination, and human review. The bundled proof script alone does not reach this level.
## Generate and Validate
Run:
```bash
python3 scripts/build_ifc_poc.py \
--spec outputs/<project>/building_spec.json \
--out-ifc outputs/<project>/<project>_proof.ifc \
--out-report outputs/<project>/<project>_proof_report.json \
--out-notes outputs/<project>/<project>_proof_notes.md \
--vendor-dir work/vendor --validate-geometry
```
Require schema validity, storey/spatial containment, `IfcWall`/`IfcColumn`/`IfcBeam`/`IfcSlab` counts, property sets, and geometry results. Explain every geometry failure.
When Blender cannot import IFC directly, run `extract_ifc_meshes.py` and render with `render_ifc_meshes_blender.py`. Do not imply that a rendered IFC proves production BIM completeness.
Always list remaining gaps: joins, openings, doors/windows, rooms/spaces, quantities, materials, classifications, levels, georeferencing, MEP, and discipline coordination.

View File

@@ -1,19 +1,28 @@
# building_spec.json Schema
Use `building_spec.json` as the contract between CAD extraction, Blender generation, and the Web showcase.
Use `building_spec.json` as the versioned contract between extraction, Blender, trimesh, IFC, and Web delivery. The executable schema is `schemas/building_spec.schema.json`; validate with `python3 scripts/showcase_schema.py spec <file>`.
## Contents
1. Top-level contract
2. Segment/category/footprint semantics
3. Generation config keys
4. Object naming and metadata
5. Precision labels
## Top Level
```json
{
"schema_version": 1,
"project": {
"name": "Project name",
"description": "Short user-facing description"
},
"source": {
"cad_folder": "work/XREF",
"report": "outputs/cad_read_report.json",
"dxf_dir": "work/cad_showcase/dxf_sanitized",
"config": {
"config_version": 1,
"generate_footprints": true,
"use_footprint_slabs": true,
"use_footprint_roofs": true,
@@ -66,7 +75,10 @@ Use `building_spec.json` as the contract between CAD extraction, Blender generat
"detail_lines": [],
"floor_lines": [],
"grid": []
}
},
"caps": [
{"z": 4.2, "polygons": [[[0, 0], [80, 0], [80, 42], [0, 42]]]}
]
}
}
}
@@ -134,6 +146,9 @@ Common `source.config` keys used by `derive_showcase_spec.py` and `build_blender
- `column_support_distance`: XY tolerance for matching upper structural support.
- `column_support_requires_upper_plate`: require an adjacent upper floor/roof footprint before accepting nearby upper structure as support.
- `column_support_allow_plate_only`: if true, an upper plate alone is enough support; leave false when broad footprints would keep too many isolated columns.
- `cap_groups`: ordered `[pattern, group]` pairs used by derive and both exporters; `floor.caps` is the canonical generated-cap geometry.
Unknown config keys, duplicate floor keys, missing source files, incomplete `floor_order`, empty floors, and unsupported schema versions are hard validation failures. The exporters consume canonical `floor.caps`; they do not independently choose another floor grouping.
## Object Naming

View File

@@ -0,0 +1,53 @@
# Campus and Multi-Building Workflow
## Contents
1. Branch selection
2. Placement evidence
3. Site outlines and missing buildings
4. Assembly gates
5. Site context
## Branch Selection
Treat folders such as `1#厂房 / 2#厂房 / 3#辅房 / 总图` as a campus, not floors of one building. Produce one frame-detection run, config, spec, and model per delivered building drawing set. Keep site plans in their own units.
Building plans are usually millimeters; total/site plans may be meters at surveying coordinates. Never combine both in one extraction config. Convert everything to site-local meters before GLB export; raw coordinates hundreds of kilometers from origin lose float32 precision.
## Placement Evidence
Prefer anchors in this order:
1. coordinate callouts;
2. wall lines;
3. envelope rectangles whose dimensions equal the model wall bbox;
4. registered site outlines.
Use wall evidence, not roof/eave envelopes. Derive rotation from a matched edge and resolve the 180-degree ambiguity with an asymmetric feature such as entrances, machine rooms, or basement ramps. Save the source and reasoning in `site_manifest.json`.
For irregular outlines use `register_site_outlines.py`. Constrain the angle window when the building is visibly axis-aligned. Treat residuals roughly as: 0.06m excellent, 0.5-1m plausible with balconies, above 2m likely wrong outline/floors.
## Site Outlines and Missing Buildings
If a building has no delivered drawings but has a site outline and storey label, use `massing_from_outline.py`. Label every such floor/model as total-plan outline massing. Never silently fabricate detailed walls/windows.
Use multiple floor footprints for registration when upper wings/overhangs explain the site outline better than one floor.
## Assembly Gates
Use `assemble_campus.py` with per-building `rotation_deg` where needed. Require:
- no unexplained negative wall-envelope gaps;
- 0.15-0.30m joints corroborated as expansion joints;
- several-meter separations checked against fire/site evidence;
- all buildings inside the red line;
- a top-view overlay or render showing each model inside its site outline;
- numeric envelope dimensions and neighbour gaps in the notes/evidence.
`--allow-overlap` is for a documented shared structure or verified interlocking geometry, not a shortcut around placement bugs.
## Site Context
Use `site_context_from_dump.py` to generate ground/red-line footprints, roads, parking, fences, trees, and low-confidence context massings from one selected site-plan copy. Supply the correct per-dump unit scale, region window, origin, and exclusion quad for real modeled buildings.
Keep site context in every presentation variant. Replace context massings with real models when drawing sets exist. A campus with only boundary sticks is incomplete presentation, but visual completeness never permits fake buildings.

View File

@@ -1,30 +0,0 @@
> 归档:skill 早期迭代时使用的工作提示词,仅作历史记录;文中路径以当时的仓库布局为准。
# Claude Code 提示词:CAD 展示模型 skill 剩余改进项
(在 /Users/zhengwr/workspace/cad-building-showcase 目录下启动 claude 后粘贴)
---
你在 CAD 建筑展示模型 skill 的仓库里工作。开始前先完整阅读 SKILL.md(操作手册,含 One-Shot Definition of Done 七条门禁)、references/web_presentation_notes.md(效果升级清单与 PENDING 项)、贝昂CAD诊断与skill优化.md(项目全程记录)。铁律:任何脚本改动后必须跑 `python3 tests/test_extraction_pipeline.py`(当前 24 项全绿);门禁失败就停下修复,绝不绕过;产出必须亲眼验证(渲染图/浏览器截图),不做假数据。
现成数据:outputs/beian_1hao/ 下有 campus_spec.json(厂区 22 层合成 spec)、building_spec.json / spec_2.json / spec_3.json(1#/2#/3# 单体)、beian_campus.glb(14.9MB 未压缩)、site_manifest.json(摆位配方)、site_floors.json(场布)。CAD 源图在 /Users/zhengwr/workspace/test3d-6/fs贝昂科技_新建项目cad20250728/(如需重新提取,按 SKILL.md 步骤 1 的 WASM 兜底或 macOS ODA 转换)。
按顺序执行,每项完成后简报结果再继续:
任务 1 — Draco 压缩(30 分钟)
在仓库根目录 `npm install @gltf-transform/core @gltf-transform/extensions @gltf-transform/functions draco3dgltf`,然后 `node tools/compress.mjs outputs/beian_1hao/beian_campus.glb outputs/beian_1hao/beian_campus.draco.glb`。验收:压缩后 ≤3MB,用 pygltflib 或 gltf-transform inspect 确认节点数不变(122)、KHR_draco_mesh_compression 存在。沙盒里 WASM 会崩,macOS 正常——如果这里也崩,报告环境信息,不要硬试。
任务 2 — 正式 Web 模板部署验证(1 小时)
按 SKILL.md 步骤 6:用 scripts/build_showcase_variants.py --build 生成 overview/standard/detail 三档(输入 outputs/beian_1hao/campus_spec.json),scripts/write_web_showcase.py --variants-manifest 组装到 outputs/beian_1hao/web/,`npm install --prefix outputs/beian_1hao/web three@0.181.2 lucide@0.468.0`,起本地服务打开。验收:亲自在浏览器确认——RoomEnvironment 环境光与阴影生效(模板 app.js 刚升级过:主光已移到地上、阴影视锥按模型自适应、幕墙为物理玻璃)、楼层爆炸/剖切/点击溯源可用、桌面与手机宽度布局正常、控制台无报错;截图存 outputs/beian_1hao/web_verify/。
任务 3 — Tier 2 几何升级:连续墙体(半天,先写测试)
给 scripts/spec_to_glb.py 和 scripts/build_blender_showcase.py 加配置开关 `merge_wall_solids`(默认 false):每层墙段用 shapely buffer(width/2, cap_style=2) + unary_union 合并为连续多边形再挤出,消除转角缝。先在 tests/test_extraction_pipeline.py 加用例(L 形墙 union 后应为单一多边形、顶点数合理、默认关闭时输出与现状逐字节一致),再实现。完成后用 campus_spec.json 开关对比渲染两张图,肉眼验证转角处无缝且无异常鼓包,写入 references/web_presentation_notes.md 的 Status。
任务 4 — 幕墙竖梃分格(半天,同样先测试后实现)
spec_to_glb 加 `glazing_mullions`(默认 false):合并后的每条玻璃带按 glazing_panel_w(默认 1.5m)生成竖梃、按层高生成横梃(细盒型材,walls 材质),玻璃面保留。验收同任务 3:新增测试 + 前后对比渲染 + notes 更新。
任务 5 — 4#/5# 与 3# 精确定位(依赖外部数据,先问我)
现有图纸没有 4# 机械停车坑、5# 污水处理池的定位轮廓,3# 是 ±1m 近似摆位。先向我确认是否已拿到设计院"含全部构筑物的可点坐标总平面";拿到后按 SKILL.md 厂区章节流程(detect_sheet_frames → 提取 → 在 site_manifest.json 增加条目 → scripts/assemble_campus.py 重新装配,它会自动做邻栋间距门禁)。没拿到就跳过并在报告里注明,不要造假体量。
全部完成后:更新 贝昂CAD诊断与skill优化.md 追加一节记录本轮结果与教训,确认 24+ 项测试全绿,git status 列出改动清单(不要自行 commit,等我确认)。

View File

@@ -1,391 +0,0 @@
# Skill 泛化测试记录(test3d-7 三项目,2026-07-02 起)
目的:验证 cad-building-showcase skill 在不同 CAD 图纸上能否达到与贝昂案例
同等的 3D 模型质量。判定标尺 = One-Shot Definition of Done 七条门禁 +
量化指标 + 固定目检清单,任何门禁失败 → 修 skill(不绕过)→ 重跑。
## 测试对象
| 项目 | 形态 | 导出 | 考验点 |
|---|---|---|---|
| 黄桥文体中心 | 单体大公建 | 天正 _t3 | 多图框单文件(平面图 A-01-101~107 共 7 框)、钢结构、大跨 |
| 13号地块 | 双塔 + 地库 + 总图 | 天正 _t3 | 厂区装配、住宅塔楼标准层、地库 |
| 27号地块 | 1#综合楼A/B + 2# + 配电房 + 门卫 + 地库 | _t3 与 _t8 混用 | 混合导出惯例、小体量构筑物、总平面定位 |
## 质量对比表(随进度填充)
| 门禁/指标 | 贝昂(基线) | 黄桥 | 13号 | 27号 |
|---|---|---|---|---|
| 读图 Warnings 清零 | PASS | PASS(13/13 ok,ODA 兜底×3) | PASS(18/18 ok,ODA 兜底×8;XREF=缓存块解锁) | PASS(13/13 ok,ODA 兜底×9) |
| 图框网格对齐 votes≥3 | PASS | PASS(7框全对齐 x=14 y≥11) | PASS*(塔楼框 votes=0 是正确结论:图签定位+墙剖面相关人工配方,叠图核验) | PASS(1#A 14框对齐;1#B x=21;2# 修参考框后 x=17 全列;墙相关兜底在 B1 首次自动生效) |
| audit exit 0(三硬门禁) | PASS | PASS | PASS(+block_locked WARN 信息性) | PASS×5栋(1#A 四门禁全 PASS;1#B/2#/配电 glazing 合法 SKIP) |
| 无 topless_group / 三角化失败 | PASS | PASS(补 roof_specs 后) | PASS(roof_specs) | PASS(roof_specs 全覆盖) |
| 邻栋间距门禁 | PASS(0.19m 贴缝) | n/a 单体 | PASS(-1.46m=共享地库坡道咬合,放行留痕) | PASS(全正值,min 1.72m) |
| 裁剪口径覆盖率 | ~40%(多图框正常) | 56.9% | b1 51.5% / b2 48.0% | 1#A 76.4% / 1#B 57.3% / 2# 46.0% / 配电 87.2% / 门卫 73.5% |
| 幕墙连续率 | 100% | 100%(6/6 层) | 100%(厂区 30 层全通过) | 1#A 100%(18层);2# 6/6;住宅塔无幕墙合法 SKIP |
| GLB(Draco) | 0.57MB/121节点 | 0.37MB/42节点 | 5.4MB HTML 离线 viewer/127节点 | 2.75MB Draco/520节点(7栋100层) |
| 目检(渲染+viewer) | PASS | PASS(console 零消息) | PASS(离线 viewer console 零错误) | PASS(离线 viewer console 零错误,鸟瞰布局与总图一致) |
三项目 Web 交付(2026-07-03 浏览器实测均零 console 错误、交互正常):
`outputs/huangqiao/viewer_huangqiao.html`(2.9MB)、`outputs/dikuai13/viewer_dikuai13.html`(5.4MB)、
`outputs/dikuai27/viewer_dikuai27.html`(11.5MB,7栋100层)。
黄桥备注:柱仅 5 段(天正柱为 HATCH 填充,架构图不可提取——SKILL.md 已知
限制,需结构图补柱网);F4 幕墙延伸出墙体范围属实(高大厅通高幕墙出现在
多层平面),按图提取;主屋面暂合并为 20.1m 单板(25.0m 高体量顶待按
剖面证据细分 roof_specs);层高取自立面剖面 PUB_TEXT 标高
(B1=-5.5/F1=0/F2=5.6/F3=11.0/F4=15.5/RF=20.1)。
## 泛化缺口与修复清单
1. **dwg2dxf GBK 输出崩报告**(发现于黄桥首跑):libredwg 在中文图纸上
stdout/stderr 是 GBK 字节,`subprocess text=True` 按 UTF-8 解码直接崩。
修复:改 bytes 捕获 + `errors="replace"` 解码。
2. **消毒步骤毁 CJK 文本**(发现于黄桥二跑):`sanitize_dxf_comments` 用
UTF-8 `errors="ignore"` round-trip 重写 ANSI_936/GBK 的 DXF,
"一层平面图"→"一平图",下游 detect_sheet_frames 的平面图标题匹配整体失效;
结构破损还让 ezdxf 落入 recover 的 surrogateescape 路径,报告写盘
`surrogates not allowed` 崩溃。修复:消毒改**字节级**处理(保持原编码),
另加 `scrub_surrogates` 纵深防御(recover 泄漏的代理字符按 GBK 还原,
还原不了就替换,单个坏图不再拖死整批)。回归测试 +4 项(GBK 合成 DXF
全链路)。
## 13号/27号 进度(读图阶段完成,2026-07-02 晚)
- **ODA 自动兜底在两地块大规模验证**:13号 18/18 全 OK(兜底 8/8)、27号
13/13 全 OK(兜底 9/9)。此前 libredwg 路径下 9 个文件 failed、8 个主图
0 实体,全部恢复(一号楼平面 36,715 实体/70 标题;27号 1#综合楼 89,629
实体/42 标题)。
- **13号 已知障碍(下一轮处理)**:
1. 立面剖面文件(A-0x-200-299)只有 5-6 实体 = 未绑定 XREF 壳——层高无法
从立面标高取,需从 0600 系列(2,834/2,153 实体)找剖面,或按住宅标准
层高推断并如实标注;总图 A-00 系列也偏空(24/159 实体,疑似 XREF 壳),
摆位数据可能要向用户要绑定后的导出。
2. **新结构形态:多座 + 分区平面**(frames_b1 检出 45 候选框):
"A/B座"前缀是独立文字实体(标题只剩"座标准层平面图");地下层每层拆
2-3 张分区图(clip 高度重叠)。正确建模需要 (a) 座前缀归并,
(b) **一层多 clip 拼接**(当前 config 一个楼层只支持一个 clip+offset)
——skill 特性缺口,待设计实现。
3. 住宅"标准层平面图"一框对应 5~26 层:config 需要楼层复制机制
(floor_order 展开或 template floor),当前要手写 N 份同 clip 条目。
- **27号 待启动**:全部图纸可读;总平面定位图 2,166 实体(有真实摆位内容);
建筑为"整套建施一文件"形态(平面+立面混排,28-49 标题),配电房/门卫
是 2 框小体量。
10. **图层前缀习惯(A_DOTE/A_AXIS)令轴网匹配静默归零**(13号):检测器
默认 axis-layers 是精确 token(AXIS/DOTE),该院所有图层带 `A_` 前缀
→ votes 全 0 落 clip 角点兜底。修复:默认 pattern 加通配
(`*AXIS*,*DOTE*`),回归用例 rowframe 加 layer_prefix="A_" 变体。
后续排查(同轮完成):A_AXIS 全部是 0.7-1.5m 轴号刻线(角度 0/90° 精确)
且位于墙 bbox 之外——两处投票杀手都已修:轴线收集窗口外扩
(pitch×0.16)、接受短刻线为网格候选(tick_min/tick_max = pitch×0.004
/0.05,同位刻线聚簇即一票;合成 tick 用例从 WEAK 变满票)。
**但 13号 塔楼框实测仍 0 票且这是正确结论**:249 根刻线全部属于其他
框(地下分区图),一层/二层/标准层框内没有任何轴线几何。此时只能走
DoD 逃生通道:clip 角点兜底 + 叠图逐层核验。注意 clip 角点锚的是墙
bbox 最小角,随内容而变(标准层 268914 vs RF 259914 差 9m = 阳台/
露台外扩差异,贝昂 B1 式陷阱)——候选改进:轴线缺失时改用墙体位置
互相关(wall-correlation)做对齐,待下一轮设计。
13号 一号楼已完成的判读(供下一轮直接使用):办公 A/B 双塔 + 3 层裙房;
层高表(平面文件标高直方图 + "地上10层"说明):F1=0/6.0、F2=6.0/6.0、
F3=12.0/4.2、F4~F10=16.2 起步 4.2m 步进(标准层一框两翼,用重复 key 多
clip 合并——**该能力已存在**:floor_specs 为列表、buckets 按 key 聚合,
重复 key 自动并段,缺口 2 的"多 clip 拼接"实为文档缺失)、PH/RF=45.6、
机房顶 49.8、女儿墙 51.8、B1=-5.95、B2=-9.65;夹层框(F1M/F2M/B1M)与
分区地下框首版跳过;地下体量建议统一由 A-03 地库图集出,避免双份几何。
11. **跨 clip 长线整条渗入楼层**(13号):derive 的 clip 判定是"中点或端点
在框内即整条保留"——表格边框/注记长线把整张图纸宽度带进楼层(56m 框吐出
143m 几何,footprint 凸包长出游离大板,顶视图一片狼藉)。修复:新增
`clip_segment_to_rect`(Liang-Barsky)把线段**裁剪**到 clip 矩形,全内
线段原样通过。回归:40m 框内 140m 穿越线裁到框宽。贝昂框距大未暴露此坑,
图框密排的图集必踩。
13号 一号楼 round 3 结论(含一次重要撤回):
- 有效产出:标准层/机房/屋顶的框内提取与 clip 裁剪干净,audit 三门禁
PASS,GLB 双塔形态正确。
- **撤回**:"双塔间距 85.8m"不可信——后续证据链("地下各层及一层平面图"
大框实为纯文字说明区、F1 仅 70m 墙容不下两个 49m 塔、A/B 座标题各踞一个
并排图框)表明标准层区域是 **A/B 座并排排版**,38m 框间隙是排版间距,
不是建筑几何;__2 的 104m 宽 clip 是墙 bbox 精修吞并邻框的检测伪影。
- **教训(多座建筑通则)**:翼间真实位置只能由"同一图框内含双翼"的图纸
锚定(本例候选:A-03 地库的塔楼竖井、绑定 XREF 后的总图);并排图框的
间距永远不可当作建筑间距。floors_aligned 门禁对该形态存在盲区(多座
merge 后包络中心检查无法发现翼间距错误),候选加固:多座配置要求显式
anchor_frame 或跨框共有几何校验。
- 下一轮:先提取 A-03 地库(6,877 实体、16 框)拿到双塔竖井真实间距,
再回填一号楼翼位与裙房分区,最后叠图核验 + viewer 目检。
- round 3 收尾探针结论:地库包的"地上一层平时平面图"锚框候选是空壳
(15 条 A_P_LINE);第二区域 B1_2(地下一层平面图)有实内容
(A_WALL 377 / A_STAIR 442 / A_COLUMN 73)但也是 40m 分区条带——
地库同样要分区拼接(机械能力已具备:重复 key 多 clip + Liang-Barsky
裁剪)。若地库拼接后仍无双塔竖井锚,则需向用户索取绑定 XREF 的总图/
立面导出(A-00 总图与 200-299 立面均为壳)。
## 27号 round 4 进度(2026-07-02 深夜)
- **门卫(6#)、配电房(5#) 全链跑通**:图框检测(门卫 RF 网格对齐 x=6/y=4 票)、
标高实证(门卫 3.8/4.2,配电房 4.2/4.8)、derive/audit/GLB。门卫三门禁全
PASS(14 节点/1.2MB);配电房 floors_aligned PASS、glazing 合法 SKIP
(变电所无幕墙),`unsupported_roof` 规则自动清掉立面框渗入的 43.2m 悬空
屋面线——新规则首次在新项目自然生效。_t8 与 _t3 图层方言在此两例上一致
(WALL/CURTWALL/COLUMN/AXIS/DOTE + 材质命名层如"古铜不锈钢/涂料分割线")。
- **总平面定位图有真锚**:DIM_COOR 层 104 个坐标标注(贝昂配方首选的
"可点坐标")+ 车位/消防道路/道路禁开口段等场布层——27号 摆位数据齐备,
不依赖外部补件。
- 待办:1#综合楼A(42框)、1#B区(49框)、2#(23框)三个大体量的
detect→config→derive 循环;总平面 DIM_COOR 锚点提取与 site_manifest;
assemble_campus 装配 + viewer 目检。
## 13号 解锁:XREF 内容其实在包内(round 5,用户追问促成)
**修正此前"需要设计院补绑定总图"的结论**——用户反问"你不会自己操作吗"
促使深挖,发现被引用内容以 **AutoCAD 缓存块**形式存于宿主 DWG:
`X-00-0011`(总图)块内 5,306 图元、`X-01-0200`(立面)4,443 图元;
modelspace 只有 INSERT 桩,读图报告按 msp 计数误报 near_empty。
libredwg 丢 xref 标志、ODA 保留 `xref_path=".\\X-01-0200.dwg"` 但 flags=0
——两条转换路径都把缓存内容导成普通块定义,**expand_blocks 即等效绑定**。
证据要点:总图块内层名带 `X-00-0011$0$` 绑定前缀(0-规划道路/0-景观树木/
0-地面停车/0-消防环线/栏杆/DIM_COOR×40);单位为米制测绘坐标
(x≈55km, y≈57km,同贝昂总图形态);楼栋尺度轮廓在 `...$dx` 层。
**待落地的 skill 改进(下一轮 TDD)**:
1. cad_dxf_report 的 near_empty/xref_shell 判定要检查"INSERT 引用的块内
实体数"——桩+大块 = 缓存 XREF,提示 expand_blocks 而非"找用户要文件";
xref_definitions 收集也要识别 flags=0 但 xref_path 非空/块名 X-* 的情况。
2. detect_sheet_frames 的标题扫描要进入此类大块(当前只扫 msp 文本)。
3. 一号楼翼间距锚:总图 dx 层楼栋轮廓 + 40 个 DIM_COOR 坐标标注;
立面块 X-01-0200 可实证层高表。
## 13号 round 6:一号楼全楼重锚完成(2026-07-02 深夜续)
**撤回之撤回:85.8m 双塔间距是对的。** 总平面缓存块 X-00-0011(藏在
A-00-011-099_t3.dwg,msp 只有 3 个桩 + 两个 1:500 A0 框)展开后实测:
- 三塔同转角 157.668°、同长 49.80m:A座 ctr(56728.78,57289.85)、
B座 ctr(56649.42,57322.45)、二号楼 ctr(56585.65,57348.81)(OBB 49.8×22.5/22.2)
- **B→A 中心距 85.80m、横向偏差 0.00m**;B→二号楼 69.00m 同列
- 图纸内 `__2`/`__3` 标准层框 offset 差恰 85,800mm——图内相对位置=真实位置
(全 DXF 共享一个绘图原点)。当时撤回的理由("F1 70m 装不下双塔")错了:
F1 其实画在 **加长A0(178.35×84.1m @1:100)** 上、全楼一张图,检测器按
sheet pitch(≈55m) 的粗窗把它截半了。
- 交叉验证:85.8+49.8=135.6m + 外墙 = 138.6m = B1 提取跨度 ✓
- 其余锚:办公A/B座 10F H=46.55(女儿墙46.40);裙房 2F H=12.30(12.15);
二号楼 16F H=57.95(57.80);±0.00=4.30 绝对标高;测绘惯例图面x=测绘Y。
已固化 outputs/dikuai13/site_anchors.json(含地下室轮廓 70 点)。
**重锚方法(无轴网楼栋的通用配方,已人工验证,待 TDD 进 skill)**:
1. **共享 x 原点判定**:F3 图幕墙 x=[276262..326062] 与 A座标准层逐毫米相等
→ 同列图纸共享 x,offset_x 全部统一为标准层的 268914.9。
2. **墙体 y 剖面互相关**:塔柱列(两塔 x 带)内墙段按 y 直方图(20mm 桶,
长度加权),与标准层互相关取峰 → 每张图的 y 平移。双塔独立求解全部 Δ=0mm
互证;且 F1/F2/F3 行间平移恒等图框行距 85,100mm,再证。
3. 修正量:F1 偏 x+75.6m/y+12.9m;F2 偏 y+18.4m;**F3 错槽 85.8m(A座三层
被锚到 B座)**;PH 偏 y+4.3m;RF 偏 x≈11m/y+11.3m——而旧 audit
floors_aligned 全 PASS(门禁对"自洽但整体错位"失明,需要跨层公共基准)。
4. F2/F3 图面北缘的楼梯/前室大样混入 → clip y 带宽剔除(与黄桥图签图例同族;
isolated-cluster 阈值逮不住 20m 外 6m 大盒)。右侧簇 45 框全是核心筒详图,
当楼层框检出全 WEAK——详图簇要能识别丢弃。
5. 结果:spec 重导 12 层,F4-F10 双塔 135.6×22.5 ✓,F1 158.7m(含两端
地库坡道,与总图"地库入口/出口"位置吻合)✓,门禁 3 PASS +
block_locked WARN(并行会话新门禁,信息性);b1.glb 64 节点重建,
顶视/轴测目检通过(双塔立于裙房、比例正确)。
**新增 skill TODO(本轮实证出的缺口)**:
- detect_sheet_frames 应优先用图签块 INSERT(A0/A1/A2*_V1 + scale)定图框矩形,
pitch 窗口只做兜底——加长A0 被 pitch 截半就是教训。
- "共享原点 + 墙剖面相关"要成为 votes=0 时的自动对齐路径(先验证共享 x,
再 1D y 相关,双塔/双列一致性做置信度)。
- floors_aligned 门禁要加跨层公共基准核验(如标准层墙罩盒 vs 各层同列内容)。
## 13号 round 7:二号楼 + 厂区装配完成(地上部分收口)
**二号楼(A-02-0100)** 图册干净:左列 5 张 A1(1:100)纵排、行距 60,400,
一层/二层/标准层/机房/屋顶各一张;右侧全是核心筒详图(与 b1 同病,检出即弃)。
- 共享 x 逐毫米成立;墙剖面相关的 y 平移 = ±k×60,400 严格整数倍(内容随框恒位)。
- 剖面标高序列实证层高表:F1=0/6.0、F2=6.0/3.4、F3=9.4/3.4(无独立图,
沿用二层平面)、F4–F16=12.8+3.4k、主屋面 57.0、女儿墙 57.8/58.0、
机房顶 61.2、塔冠幕墙 63.4——**与总图标注 63.4 独立吻合**。
- 塔身提取 49.8×22.2 与总图 OBB 完全一致;门禁 3 PASS + block_locked WARN;
b2.glb 63 节点;F2 与标准层轮廓叠图重合。
- 坑:floor_order 从 b1 抄来只有 F1..F10 → F11-F16 被静默滤掉("floors":12
才暴露)。skill TODO:derive 应在 config floors 里出现但 floor_order 缺失时
大声告警而不是静默丢层。
**厂区装配(assemble_campus)**:锚=总图缓存块实测塔心 OBB 中心,
rotation −22.332°;一二号楼包络重叠 −1.46m 经叠图核验为**缝隙共享地库坡道**
(两张一层图各画一半、互补咬合非重复)→ --allow-overlap 放行并留痕。
campus_spec 30 层/2 楼,dikuai13_campus.glb 127 节点,轴测目检与总图排布一致。
产物:site_anchors.json / site_manifest.json / campus_spec.json /
dikuai13_campus.glb / campus_iso.png / stack_check2.png / b2_verify.png。
**范围说明**:地下车库(A-03,B1/B2/夹层多分区)为地下体量,showcase 默认
不展示,本轮不建模;一层两端地库坡道挡墙已随 F1 提取呈现。待需要时按
右簇分区图+人防图纸另行拼接。
## 27号 round 5-8:三大体量 + 总平面配准 + 厂区装配(2026-07-03,全程收口)
**1#综合楼A(17F办公,0908_t3)**:剖面标高梯干净(0/4.5/.../76.5,机房顶79.5,
女儿墙80.1——图框检测聚合列里的 2.25 步进是楼梯半层平台,逐框probe即排除)。
四层是裙房顶大平层(办公区/楼梯/露台标注俱在,2-2剖面止于18.0 证裙房=F1-F4)
——初判"clip 吞邻框"是误判,唯一真污染是 F6 clip 上缘越入 F5 图纸下缘(收紧
y 带解决)。屋顶平面框只有 S-BEAM/单线/落水管,弃用,主屋面 roof_specs 从
F17 出板。18 层四门禁全 PASS,幕墙连续 100%。
**1#B区(10F,租赁_t3)**:标准层平面由**户型块拼装**(hxt11/hxt22 各含 75 段
WALL 线,轴网在 $TD_AUDIT_GENERATED_(6792) 块)——按名单展开丢墙,必须
expand_blocks=true 全展开。首版 clip 被假 x-pitch 砍半(右侧详图簇同排标题
制造 pitch_x≈15.8k),楼被切掉整翼——检测器修复后全宽恢复(44.9×17.3 ↔ 总图
轮廓 40×14.5 ✓)。精修 clip 会吞上一张图纸的层间杂条:按各层墙 y 簇裁带解决。
层高实证 F1/F2=4.5、F3-F9=2.95、F10=2.85、机房顶35.5。
**2#(22F住宅,_t7_t3)**:此前"全 WEAK"的根因是**参考框选错**——检测器把
"非机动坡道一层平面图"当参考(辅助构筑物,轴网与塔楼无关)。修复参考框排序后
主列 votes x=17 y=7 全对齐;墙剖面互相关兜底在 B1 上首次自动生效
(coverage 0.86/0.83)。墙在绑定前缀层(12314$0$WALL)须 *WALL* 通配且
glazing 在 walls 之前匹配。3.0m×22 层梯(0..66,机房顶69)。
**总平面配准(A-00-001定位图)**:图面坐标=测绘米制(x=测绘Y东、y=测绘X北,
与13号同惯例,52 个 X=/Y= 坐标标注对直接验证)。楼栋轮廓藏在 **EVTR 层**
(六栋闭合多段线按最近楼栋标签认领);1#A **没有画轮廓**,只有 DIM_COOR 角点
——剔除车库轮廓线/消防登高场地上的标注点后,用"模型多层 footprint 并集 对
角点集"点-边 ICP 配准(θ=-2.15°,与 1B 的 -2.1° 场地统一倾角互证)。轴对齐
轮廓要锁角度窗(阳台齿会造出 ~10° 的伪极小值——B2 教训)。配电房配准残差
0.063m(轮廓 9.2×19.2 与模型毫米级吻合)。**总图还揭示 3#/4# 两栋 21-22F
住宅无交付图纸**:按 EVTR 轮廓×层数×3.0m 出诚实体量块(spec 标注"总图轮廓
体量")。门卫模型(42.8m)与总图雨篷(17.4m)尺寸不符,按重心放置留痕待查。
**装配**:assemble_campus 新增每栋 rotation_deg(4#楼独自斜置 ~27°);
7栋100层,邻栋间距全正(min 1.72m),dikuai27_campus.glb 520节点/50.6MB
(Draco 2.75MB)。离线 viewer 浏览器实测零 console 错误,鸟瞰与总图一致。
## 泛化缺口与修复清单(27号 round 5-8 新增,全部 TDD 带回归)
12. **辅助构筑物标题抢参考框**(2#全WEAK根因):ref_rank 只认 key=="F1",
"非机动坡道一层平面图"先到先得。修复:标题纯度判定(楼层词+平面图 之外
有前缀=辅助),辅助框永不做参考并在报告标记;纯 F1 族优先。回归 auxref 场景。
13. **votes=0 的墙剖面互相关自动对齐**(13号 round 6 人工配方进代码):
墙位置直方图(长度加权,x/y 独立),coarse 500mm 投票 + fine 50mm 精化,
coverage≥0.35 且峰比≥1.5 才接受(防止坡道对塔楼的伪相关),报告
`wall-correlated` 而非静默 WEAK。回归 nogrid 场景(clip 角点必错 20m)。
14. **散排标题伪造 x-pitch 砍半 clip**(1#B 整翼被切):pitch_y 存在且
pitch_x < 0.7×pitch_y 时判伪弃用(真实 2D 图纸网格的 pitch_x≈图宽,
不会远小于图高)。回归 mixedrow 场景。
15. **缓存 XREF 识别**(13号 round 5 教训进代码):cad_dxf_report 新增
`insert_block_content`(msp INSERT 引用块的实体量),近空 msp + 块内
≥200 实体 → `cached_xref_content` 警告(提示 expand_blocks≈bind),
不再误导"找用户要绑定导出";detect_sheet_frames 标题扫描进展开块
(13号形态:图名也在缓存块内)。回归 cachedxref/blocktitle 场景。
16. **floor_order 缺口静默丢层**(13号 b2 F11-F16 消失教训):derive 对
"drawings 有但 floor_order 没有"与"floor_order 有但无图产出"两个方向
都大声告警。回归 fo_config 场景。
17. **assemble_campus 每栋 rotation_deg**(27号 4#楼独自斜置):manifest
每栋可覆盖全局旋转。回归 90° 旋转场景。
18. **凹包桥接双塔生成横跨楼板**(13号 一号楼,用户 viewer 目检发现):
一层 key 装 A/B 两塔时 concave_hull 对全部点只出一个包,
use_footprint_slabs 在 36m 空隙上逐层铺板(侧视=塔间"三角连接")。
修复:出包前按端点邻近分簇(footprint_cluster_linkage 6m,网格桶并查集,
段两端强制同簇),每簇独立凹包——真连廊因连廊墙自然连通不受影响。
修后 F4-F10 = 2×49.8m 独立塔包(与总图 OBB 一致);黄桥 F4/RF 北侧
1.4m 长条构件也随之脱离主包(更诚实);27号 各楼无回归。回归 twintower
场景(两簇 40m 距,断言 2 包且无 25m+ 跨包)。教训:**门禁与顶视图对
桥接楼板都不敏感,侧视/正视目检必须看"楼间空气"**——已列入 DoD 目检项。
19. **图签块 INSERT 定图框**(留档项③落地,13号 加长A0 教训):detect 预扫
msp 中 A0/A1/A0+0.5_V1/图框/图签 类块名的 INSERT,世界 bbox 通过尺寸/
长宽比合理性检验后作为该框 clip 窗(墙精修结果 clamp 在框内,不吞邻图);
13号 b1 实测 45 框全部由图签矩形定窗。回归 titleblock 场景(加长A0 一框
双塔,pitch 窗必截半)。
20. **floors_aligned 跨层墙基准核验**(留档项⑤落地,13号 F3 错槽教训):
audit 对同组楼层做墙剖面互相关(对墙量最大的参考层),强峰在非零位移
(|shift|>1m,coverage≥0.45,ratio≥1.5)→ FAIL "自洽但整体错位"。
**零位移护栏**:目标层在原位已贴合(zero_cov≥0.7×best)则不报——
密集裙房参考层会让小轮廓层"哪儿都能贴上"(27号 1#A PH 在 1.5m 处
出过伪峰)。回归 crossdatum 场景(错槽 FAIL/对槽 PASS)+ 三项目审计
无误报。
21. **门卫"尺寸不符"溯源结论(非缺陷)**:模型 42.8m 是大门建筑组
(两侧门房 x 0-8/21-29 + 端部围墙 39-42 + 中间门洞幕墙带),总图只画
岗亭符号(2.4m 八边形)+门头雨篷(17.4m)——表达粒度不同,重心放置合理,
结案。
22. **场地机制产品化 + config 自动化**(本轮以会话脚本验证的能力固化进
scripts/):`register_site_outlines.py`(点-边 ICP 配准 CLI,manifest
片段直出,残差>2m 大声告警)、`massing_from_outline.py`(轮廓×层数
体量 spec CLI);detect 三项:多层合并图名自动展开(四、六、八/
十一至十四 → 每层一条 config 条目,13号 b2 静默丢层的根源性预防)、
复合中文数字解析(十一/二十一 不再变 F0 键)、逐框标高梯 + 均匀步进
层高建议(27号 2# 实测:19 层枚举图名自动展开、step 3.0×11 建议命中;
建议只是证据不自动填 z——楼梯剖面的半层节拍是反例)。回归 +11 项。
23. **查漏门禁四件套**("新项目会不会漏"的正面回应——全部是账目/互证型
不变量,对没见过的方言天然有效):
- `frame_ledger`(audit --frames):检出框必须入 config 或列入
`discarded_frames` 带理由——静默弃用的框正是整翼消失的所在;
- `area_declared`(config `declared_areas_m2`):模型 footprint 面积对
经济技术指标表/标注互证(±15% 默认)——1#B 半栋消失只有总图能暴露;
- `storey_count`(config `expected_storeys_above_ground`):地上层数对
总图 22F 标签/标高梯级数互证;
- `unknown_layer_dialect`(读图报告):平面文件无任何 *WALL*/*墙* 类图层
时点名"陌生方言,先自觉建映射"。
三门禁未布防时 SKIP(既有项目零影响),新项目应全部布防。回归 +8 项。
24. **Web 模板功能移植 + 按需渲染**(test3d-5 会话演进版回收进模板,2026-07-04):
变体页内热切换、分享链接(全状态进 URL hash)、自动巡游、toast、建筑分组
楼层控制(无 buildings 字段时按楼层键前缀回退分组)、按(楼层,类别)合并
网格削 draw call、渐进加载(单 GLB 部署自动跳过二段加载);书签补全
(列表+恢复+删除+入 hash)。**按需渲染**根治"网页开着风扇狂转":静态场景
只在变更时渲染(invalidate() + damping/autoRotate 期间连续),阴影
autoUpdate=false 按变更重烤,模板与离线 viewer 同一契约;27号 实测
模板 web 静止 3 秒 0 帧、离线 viewer 加载全程仅 25 帧。`window.__renders`
为诊断计数,DoD 目检可要求"静止时不增长"。
**仍留档**:⑦ 未命名详图簇(核心筒大样)仍靠 clip 带宽人工剔除,标题纯度
只覆盖有名字的辅助框(需要"详图簇 vs 楼层框"的几何判别设计);2# 的
"十九、二十一层平面图"修改单簇(无障碍改造相关)未并入模型(需用户确认
以哪版为准)。
(待续)
3. **消毒步骤误删 XRECORD 的 999 数值行**(发现于苏州博物馆/test3d-8 首跑):
`sanitize_dxf_comments` 逐行匹配 `999`,但 DXF 是严格 码/值 行对;ODA 转出的
XRECORD 里整数值恰为 999 时被当成注释码连删两行,后续组码整体错位,
strict 读取抛 `ValueError: Invalid handle {ACAD_REACTORS.`(非 DXFError,
read_doc 不兜底)→ 整文件误判 failed。libredwg 输出同样中招——首跑 111 个
"失败"文件中相当一部分是消毒自伤。修复:按码/值对遍历(只在码位上匹配 999);
read_doc 兜底 `(DXFError, ValueError)` 走 recover。
4. **MIF 图名解码落地**(黄桥 TDD 存量):`\M+5XXXX` 转义在 cad_dxf_report 的
count_plan_titles 与 detect_sheet_frames 的 entity_text 统一解码
(\M+1..5 → cp932/big5/cp949/johab/gbk),多帧警告与图框识别恢复。
回归测试 10 项全绿。
5. **ODA 自动兜底进代码**(黄桥主平面图 0 实体触发):libredwg 转大型天正
DWG 产坏件(重复句柄、缺 ENDBLK/EOF)或转出空 modelspace——黄桥
A-01-101~107 经 dwg2dxf 读 0 实体、经 ODA 读 21,171 实体。
cad_dxf_report 现在对"转换失败 / inspect failed / modelspace 0 实体"的
DWG 自动走 ODA File Converter 重转(ASCII 暂存名规避编码坑、1800s 超时、
`oda_fallback_ok/failed` 留痕;env `ODA_CONVERTER` 可覆盖路径)。
回归测试用假目录转换器锁住兜底管线(3 项,沙盒无 ODA 也可跑)。
7. **图签窗图例进模型,footprint 拉出"每层一个尖角"**(黄桥,用户目检发现):
每张图纸图签区画的窗样符号在真实 CURTWALL 层上(每框 6 段共 4.6m,距主体
18–40m,逐层同位),图层排除逮不住;footprint 凹包被拉过去生成细三角飘
板。修复:derive 新增 `drop_isolated_clusters`(默认开)——分类后对全部
段做端点邻近聚簇(union-find + 网格桶,linkage 3m),保留最大簇,丢弃
"距主体 >12m 且总长 <15m"的孤立微簇并大声警告;bounds 随过滤重算。真实
的脱开构件(连廊/门头,总长大或贴近主体)不受影响;F4 西侧高大厅通高幕
墙保留验证通过。回归 6 项(默认丢弃+警告+bounds 收缩+开关保留)。
8. **无支撑屋面线挤成悬空飘带**(黄桥,用户在 Blender 里发现 F3__roof 悬浮):
平面图会画低矮雨篷/坡屋面轮廓(A-ROOF),其支撑柱是天正 HATCH 填充提不出
来——黄桥 F3 西南角坡屋面下方 F1/F2 均无一段墙,挤出后 15 段线带悬在
11m 空中;B1 平面上的地面雨篷投影线更是埋在 -5.85m。修复:derive 新增
`drop_unsupported_roof_lines`(默认开)——roof 段中点在"全部楼层
footprint+caps 并集 buffer 2m"之外即丢弃并大声警告(黄桥 F3 丢 10 段/
24.1m、B1 丢 1 段/82m;贴主体 2m 内的附墙雨篷边保留);要保留可显式加
roof_specs 板或关开关。回归 5 项(域内保留/域外丢弃/警告/开关)。
9. **轴网藏在匿名块里,图框对齐全 WEAK**(黄桥):detect_sheet_frames 只扫
modelspace 线,而这套图把每框轴网包在 A$C... 匿名块(DOTE 线 296/203/197
条在块内、msp 仅 8 条),投票 x=0 y=0 → 全部落到 clip 角点兜底。修复:
检测器递归展开 INSERT(深度≤3、按块名 memo 只展开含轴/墙层曲线的块),
黄桥 7 框全部恢复 grid-aligned(votes x=14 y≥11),B1 的独立偏移被正确
纠出。回归用例构造"轴网在块内 + 两框墙体 bbox 不同"场景,clip 角点兜底
必错 20m、网格投票必对;教训:合成轴网要用不均匀开间,等距网格的子集
相关天然多解。

View File

@@ -0,0 +1,85 @@
# Input Formats and Conversion Branches
## Contents
1. Supported inputs
2. DWG conversion selection
3. XREF and cached-block handling
4. 3DSOLID/MESH branch
5. PDF boundary
6. Dependencies and portability
## Supported Inputs
Use this skill directly for architectural DWG/DXF drawing folders and DXF files produced by the bundled WASM bridge. Preserve source folders and write conversions under `work/`.
For multi-discipline sets, model from 建筑 by default. Pull 结构 later for columns/beams only when the requested showcase needs them. Never feed architecture, structure, MEP, and site drawings into one extraction config.
## DWG Conversion Selection
Run `cad_showcase.py inspect` or `cad_dxf_report.py` with an explicit converter policy:
- `--converter auto`: use libredwg first and retry failed/zero-entity conversions with ODA.
- `--converter libredwg`: require libredwg and do not change converter silently.
- `--converter oda`: use ODA for every DWG. Choose this for known 3DSOLID/ACIS drawings and TArch files known to break libredwg.
Tool discovery is environment variable, PATH, then platform defaults:
- Blender: `BLENDER` -> PATH -> macOS/Windows install defaults.
- ODA: `ODA_CONVERTER` -> PATH -> macOS/Windows install defaults.
ODA requires existing absolute input/output directories. It may show GUI errors while returning no useful stderr; an exit 0 with no output is still a failure. The script stages ASCII file names and verifies produced files.
If native converters are unavailable, use the tested WASM bridge:
```bash
npm install --prefix work/vendor-js @mlightcad/libredwg-web
node scripts/dwg_dump_json.mjs input.dwg work/dump.json \
--module-dir work/vendor-js/node_modules
python3 scripts/dwgjson_to_dxf.py --json work/dump.json --out work/dxf_raw/input.dxf
```
The bridge carries LINE/POLYLINE/ARC/CIRCLE/ELLIPSE/SPLINE/TEXT/INSERT and block definitions. It drops HATCH/DIMENSION/ATTRIB; record that limitation and do not infer hatch-only columns or attribute-held axis labels from the result.
## XREF and Cached Blocks
- `cached_xref_content`: the file contains INSERT stubs plus cached block definitions. Expand blocks in detect/derive; do not ask for a re-export.
- `likely_xref_shell`: the referenced geometry is absent. Ask the user to bind/insert XREFs and re-export DXF.
- `has_xref_definitions`: verify that no essential external content is missing before modeling.
Never treat an unresolved XREF shell as a completed floor.
## 3DSOLID/MESH Branch
Force ODA before inspecting known solid models because libredwg can keep annotations while silently dropping ACIS data. Then run:
```bash
python3 scripts/extract_3d_solids.py \
--dxf work/dxf_sanitized/model.dxf \
--out-glb outputs/model/solids.glb \
--out-obj outputs/model/solids.obj \
--report outputs/model/solids_report.json
```
The extractor supports DXF MESH and flat polygonal ACIS faces. It counts cone/sphere/spline/torus/cylinder/swept/revolution surface records as unsupported. If curved records dominate, request OBJ/STL/STEP exported by AutoCAD, BricsCAD, or another full CAD kernel. Label partial output honestly.
## PDF Boundary
This skill does not natively reconstruct CAD geometry from PDF. For PDF-only input:
- ask for DWG/DXF when precision matters;
- or use a separate PDF/vector/OCR workflow with explicit scale calibration before invoking this skill;
- never treat raster tracing as CAD-equivalent geometry without dimensional evidence.
Do not advertise PDF support merely because a floor plan is visible in a PDF.
## Dependencies and Portability
Install deterministic dependency sets in the project environment:
```bash
python3 -m pip install -r requirements-core.txt
python3 -m pip install -r requirements-delivery.txt
```
Use `cad_showcase.py doctor` before a full run. On Windows set `PYTHONUTF8=1` and enable long paths for deep Chinese file names. Keep optional Blender/IfcOpenShell branches separate from the core Python path.

View File

@@ -0,0 +1,66 @@
# Multi-Frame Sheets and TArch/天正
## Contents
1. Detecting sheet walls
2. Alignment evidence
3. Titles and storeys
4. Clip risks
5. TArch mapping preset
## Detecting Sheet Walls
Chinese architectural DWGs often place all plans, elevations, sections, and details in one modelspace. Run `detect_sheet_frames.py`; never model the whole file as one floor.
The detector:
- scans plan titles in modelspace and cached blocks;
- rejects catalog/title-block copies and auxiliary titles;
- prefers title-block INSERT bboxes over pitch-only windows;
- expands enumerated/ranged titles such as `三、五层` and `十一至十四层`;
- emits a config skeleton plus a Markdown evidence report.
Pass every detector output config to audit with `--frames`. Account for every detected plan frame in extraction config or `discarded_frames` with a nonempty reason.
## Alignment Evidence
Prefer structural-grid voting. TArch grids often live on `DOTE`, not `AXIS`. When through grids are absent, accept tick-grid voting. When no axes exist, use wall-profile correlation independently in X/Y. Use clip-corner anchoring only as a weak fallback.
Require overlay review for `WEAK grid match` and `wall-correlated` results. The audit cross-floor datum gate must reject a strong correlation peak at a nonzero shift; envelope centers alone cannot detect a floor placed into the wrong tower slot.
Never stack frames without offsets. That preserves sheet-layout pitch and creates the classic diagonal staircase building.
## Titles and Storeys
Read per-frame elevation ladders from section/elevation frames, but treat suggested storey tables as evidence rather than truth. Stair sections can contain half-storey rhythms; podium, machine-room, and roof heights differ.
Set explicit `z`, `height`, and `floor_order`. The schema rejects floor-order gaps and ghost keys.
## Clip Risks
Title-block or refined clips can still swallow adjacent rows, details, legends, or revision tables. Investigate when a footprint dimension is 2-4x its siblings or contains distant sliver polygons. Tighten the clip band or use isolated-cluster filtering; do not simply raise noise thresholds until the artifact disappears.
## TArch Mapping Preset
Start consciously from this calibration, then inspect actual top layers:
- walls: `WALL`, `*WALL*`, `*墙*`
- columns: `COLUMN`, `*COL*`
- glazing: `CURTWALL`, `*GLAZ*`, `*幕墙*`, `*玻璃*`
- roof: `屋面`, `*屋顶*`
- detail: `STAIR`, `EVTR`, `平面`, `开口`
- grid: `DOTE`, `AXIS`
Doors/windows may both be INSERTs on `WINDOW`, with leaf geometry on layer `0`. Use block-name classification:
```json
{
"expand_blocks": ["$TCHSYS$*", "$DorLib2D$*"],
"block_name_categories": {
"glazing": ["$TCHSYS$WIN2D*"],
"doors": ["$DorLib2D$*"]
}
}
```
Exclude annotation/frame layers such as `*-IDEN`, `*图签*`, `PUB_*`, `DIM_*`, `*TEXT*`, `面积核算`, `格子线`, `SEC-*`, `立面`, `剖面`, `家具`. TArch column fills can be HATCH-only; pull structure from the structural drawing set instead of inventing columns.

View File

@@ -1,5 +1,15 @@
# Skill 优化建议(来自主辅楼建筑群 11 张图实战复盘)
## Contents
1. Lightweighting
2. Up-axis contract
3. Geometry completeness
4. Robustness
5. QA
6. Portability
7. Reusable artifacts
本文记录在一次完整实战(A202/A205/A208–A213 共 11 张 CAD 平面图 → 轻量化 Web 展示模型)中暴露的问题与已验证的修复,作为对 skill 脚本与模板的具体改进建议。修复均已在该项目落地验证。
---

View File

@@ -1,5 +1,19 @@
# CAD to Web Building Showcase Pipeline
Prefer `scripts/cad_showcase.py` for source inspection and the resumable post-config pipeline. Use the individual commands below when diagnosing or iterating a specific stage.
## Contents
1. Inventory and conversion
2. CAD read report
3. Layer mapping
4. Floor detection and alignment
5. Spec extraction
6. Audit and overlays
7. Blender generation
8. Web showcase
9. Verification and IFC proof
## 1. Inventory and Conversion
Start by listing source files and preserving names. CAD drawing names often encode floor numbers, building zones, and drawing type.
@@ -88,6 +102,7 @@ Example:
```json
{
"config_version": 1,
"project_name": "Main Building",
"scale": 0.001,
"origin_strategy": "center",
@@ -157,6 +172,13 @@ Example:
}
```
Validate before extraction:
```bash
python3 <skill>/scripts/showcase_schema.py config work/cad_showcase/config.json \
--dxf-dir work/cad_showcase/dxf_sanitized
```
In the A208 test project, 1F and 2F were on the same sheet and the second floor required an X shift of about `-158029.255 mm` to align the grids. Treat this as an example, not a constant.
Use `origin_strategy: "center"` for large CAD coordinates. It mirrors the A208 proven workflow and keeps Blender/Web coordinates numerically stable.
@@ -297,10 +319,12 @@ Run the Blender-free QA pass first, then eyeball the previews before opening the
python3 <skill>/scripts/verify_showcase.py \
--spec work/cad_showcase/building_spec.json \
--glb outputs/<project>/variants/overview.glb outputs/<project>/variants/standard.glb outputs/<project>/variants/detail.glb \
--out outputs/<project>/verify_previews.png --budget-mb 0.6
--out outputs/<project>/verify_previews.png --budget-mb 25 --strict
```
It prints per-floor segment/cap/glazing-continuity counts and a GLB size-budget pass/fail, and writes front/side/plan orthographic previews. Use these to catch missing floors, a lying-down (wrong up-axis) model, uncapped columns, or discontinuous glazing **before** declaring the model done — early visual verification avoids most rework.
It prints per-floor segment/cap/glazing-continuity counts and a GLB size-budget pass/fail, and writes front/side/plan previews from the spec. Use those previews for stacking and footprint gaps. Use an actual GLB render/browser screenshot to verify Y-up orientation, caps, materials, and slab fins; a spec preview cannot prove exported geometry orientation.
Finish with `verify_delivery.py` and retain its `evidence_manifest.json`; for formal Web delivery include the passing report from `web_smoke_test.mjs`.
Minimum verification:

View File

@@ -0,0 +1,67 @@
# GLB and Web Delivery
## Contents
1. Variant contract
2. Served viewer
3. Offline viewer
4. Browser smoke test
5. Strict evidence manifest
## Variant Contract
Deliver three variants for Web/digital-twin presentation:
- overview: walls, glazing, roof, columns, beams, slabs;
- standard: overview plus railings and doors; use as default;
- detail: all extracted categories for review.
Generate them with `build_showcase_variants.py` or `cad_showcase.py run`. Validate `variants_manifest.json` and every variant spec. Keep `source_file==site` floors intact across variants.
Both GLB backends consume versioned `building_spec.json`. They must preserve `<floor>__<category>` names and glTF Y-up. `floor.caps` is canonical; exporters must not independently infer different cap groups.
## Served Viewer
Use `write_web_showcase.py`, then install local dependencies from the copied exact-version `package.json`. Do not use mainland-unreliable CDNs.
The official template includes on-demand rendering, ACES/RoomEnvironment lighting, physical glass, shadows, grouped floor/category toggles, overview-to-standard progressive load, in-page variant switching, explode/section controls, presets, tour, bookmarks, URL-hash state, screenshot, inspection, and downloads.
Require idle `window.__renders` growth of zero after damping stops.
## Offline Viewer
Use `write_offline_viewer.py` only for double-click/no-server delivery. It embeds vendored Three r147, pako, and a gzip-compressed GLB. Run `verify_delivery.py --offline-viewer` to decode and verify the embedded payload.
The offline viewer intentionally follows an older Three API. Keep its vendored library versions/checksums documented when updating them; do not copy modern template code blindly into r147.
## Browser Smoke Test
Serve the Web directory locally, then run:
```bash
node scripts/web_smoke_test.mjs \
--url http://127.0.0.1:8188 \
--out outputs/<project>/browser_smoke_report.json \
--screenshots-dir outputs/<project>/browser_smoke
```
Install Playwright/Chromium first when needed. The script checks desktop/mobile control visibility, console/page/request failures, and idle render behavior. Feed the report to final verification with `--browser-report`; use `--require-browser-report` for formal Web delivery.
## Strict Evidence Manifest
Run `verify_showcase.py --strict` for spec previews and GLB budgets, then:
```bash
python3 scripts/verify_delivery.py \
--source-report outputs/<project>/cad_read_report.json \
--spec outputs/<project>/building_spec.json \
--variants-manifest outputs/<project>/delivery/variants_manifest.json \
--web-dir outputs/<project>/web \
--offline-viewer outputs/<project>/viewer.html \
--render outputs/<project>/verify_previews.png outputs/<project>/iso.png \
--browser-report outputs/<project>/browser_smoke_report.json \
--require-browser-report \
--evidence-out outputs/<project>/evidence_manifest.json
```
The verifier checks schema versions, GLB headers/mesh structure/naming/budgets, render dimensions/nonblank variance, Web assets/placeholders/features/variants, offline payload, and browser report. Treat overall FAIL as a delivery blocker.

View File

@@ -1,5 +1,13 @@
# Web Presentation Upgrades (视觉/交互/性能改进清单)
## Contents
1. Tier 1 defaults
2. Tier 2 geometry quality
3. Tier 3 interaction and scale-out
4. Current implementation status
5. Honesty rules
Prioritized playbook for pushing a working showcase model toward digital-twin
presentation quality. Apply AFTER the geometry passes the One-Shot Definition
of Done — polish never excuses a wrong model. Each item names the code to
@@ -64,16 +72,13 @@ touch. Ordered by value-per-effort.
## Tier 3 — interaction & scale-out
10. Click-to-inspect: raycast -> highlight mesh, show floor/category/source
layer + drawing file (all present in `building_spec.json`; write it into
GLB `extras` during export so the viewer needs no extra fetch).
11. Camera bookmarks + auto-orbit tour; state (visible floors, section
height, camera) serialized into the URL hash for sharing.
12. Progressive loading for campuses: load `overview` GLB first, swap in
`standard`/`detail` per building on idle or on selection
(`build_showcase_variants.py` already produces the variants + manifest).
13. Per-building toggles grouped in the panel (floors nested under building)
once floor keys carry building prefixes (1F1 / 2F1 / 3F1 ...).
10. Click-to-inspect — PARTIAL: raycast/highlight plus floor/category is done.
Source layer + drawing file still require preserved GLB extras; merging
currently collapses that provenance.
11. Camera bookmarks + auto-orbit tour + URL-hash state — DONE.
12. Progressive loading — PARTIAL: overview -> standard global swap is done;
per-building idle/selection loading remains future work.
13. Per-building grouped toggles with floor-key prefix fallback — DONE.
14. Instancing & merge policy: merge static same-material meshes per building
(`BufferGeometryUtils.mergeGeometries`) — target < 150 draw calls for a
5-building campus; keep per-floor granularity only for toggleable nodes.
@@ -128,7 +133,8 @@ catcher (was at basement depth — shadows floated detached), and a data-URI
favicon (console stays clean).
PENDING (Tier 2/3): door/window openings, road/green surfaces (filled
polygons), camera tours / URL state, progressive per-building loading.
polygons), source-layer/drawing provenance through merged GLB extras, and
progressive per-building loading. Camera tours / URL state are complete.
## Honesty rules for presentation upgrades

View File

@@ -1,89 +0,0 @@
# 贝昂科技厂区 CAD:为什么生成错了 + skill 优化记录
日期:2026-07-02 | 源数据:`test3d-6/fs贝昂科技_新建项目cad20250728`
## 一、错误原因诊断
截图里"6 个楼层 B1F–B6F 沿对角线散开"的直接原因,是这套图纸的组织方式与 skill 的假设完全不匹配:
1. **这是厂区(5 栋建筑),不是一栋楼的 6 层。** `建筑/` 下每个 DWG 是一栋楼(1#厂房、2#厂房、3#辅房、4#机械停车坑、5#应急污水处理池)外加两张总图。上一次运行把"每个文件当一层"堆起来,楼层数、命名(B1F 会被 skill 按地下室排序)、位置全都不对。
2. **每个 DWG 的 modelspace 里是整套图纸墙。** 以 1#厂房为例:8 张平面图(地下一层/一层/一层夹层/二~四层/屋顶机房层/屋顶)+ 4 张立面 + 2 张剖面 + 楼梯电梯详图,全部按 A1 图框(1:150,纵向间距 98,100mm)排开。不裁剪 clip 就提取 = 所有图纸叠在一层;裁了但不做 offset 归零 = 每层保留图框位置 → 就是截图里的"斜楼梯"。
3. **天正 t3 图层惯例不被默认规则识别。** 轴网在 `DOTE`(不是 AXIS);门窗都是 `WINDOW` 层上的块(窗块 `$TCHSYS$WIN2D`、门块 `$DorLib2D$*`),块内几何在 0 层靠 INSERT 继承图层——skill 的"按子实体图层探测"对这种块**一根线都留不下**,必须显式展开 + 按块名分类。
4. **单位混用陷阱。** 楼栋图是毫米;总图是**米制真实测量坐标**(x≈349xxx、y≈663xxx)。config 只有一个全局 scale,两类图不能混在一个 spec 里。
5. **性能缺陷(这次已修)。** `derive_showcase_spec.py` 原来对每个楼层重复展开全部 INSERT(O(楼层×块)),audit 又对每个 INSERT 重复 explode。A208 案例"一文件一层"没暴露;贝昂这种"一文件八层 + 1,684 个块"直接超时。
## 二、这套 CAD 的正确做法
按栋建模 + 总图摆位,已在 1#厂房上完整验证:
1. DWG→DXF:macOS 上用 ODA/libredwg;无原生转换器时用新增的 WASM 兜底(`dwg_dump_json.mjs` + `dwgjson_to_dxf.py`,22,970 图元 + 4,081 块定义零丢失)。
2. `detect_sheet_frames.py`(新增)自动完成最难的部分:识别 8 个平面图图框(过滤图纸目录行/图签同名字)、按墙体 bbox 收紧 clip、**用轴线位置互相关投票算每层 offset**(B1 图框有 250mm 非均匀偏移也被修正)。
3. 层高从剖面图 DIM_ELEV 标高取:B1=-4.8,F1=0(层高 8.1 含 4.8 夹层),F2=8.1,F3=13.1,F4=18.1,机房=23.1,屋面=27.9。
4. 天正图层映射 + 门窗块规则写入 config(见 `outputs/beian_1hao/extract_config.json`,可直接当 t3 模板复用)。
5. 提取 → 审计 → 叠图 → GLB → 三视图验证:地上各层 bounds 完全一致(104.8m × 58.8m),B1 正确落在内部 33×48m;幕墙连续 100%;GLB 6.7MB / 48 节点。三视图见 `outputs/beian_1hao/beian_previews.png`。
剩下 4 栋照同样流程各自出模型;楼栋摆位建议用 `更新图纸/贝昂 建筑-总图 首层带轴号(可点坐标)` 量各栋锚点与转角,写一个 site manifest,在 viewer 里按 transform 组装(不要把米制总图混进毫米 spec)。结构柱如需完整,从 `结构/` 图纸补(建筑图里柱多为填充,t3 导出后只剩 6 根线框柱/层)。
## 三、本次对 skill 的修改
新增脚本:`detect_sheet_frames.py`(多图框切分+网格对齐配置生成)、`dwg_dump_json.mjs` + `dwgjson_to_dxf.py`(WASM DWG 兜底转换)。
修复/优化:`derive_showcase_spec.py` 改单遍展开+按层分桶(本例 >45s 超时 → 6.3s,输出逐段一致)、块叶子图层缓存跳过无关块、`cap_groups` 可配置(原来硬编码 A208 的 AUX_/B1 分组)、新增"顶层无盖"警告(顶层既无 caps 又无 roof_specs 时强提示,防止生成没屋顶的模型);`audit_showcase_extraction.py` 块内几何清点改块定义遍历+按名缓存(40s+ → 6.3s);`spec_to_glb.py` 修复两处:多边形三角化失败(缺 mapbox_earcut)原来**静默丢弃全部楼板/顶盖/屋面**,现在显式报警;新增 `slab_bounds_fallback` 开关,避免女儿墙层从 bounds 生成盖满全楼的假板;`cad_dxf_report.py` 修复 input 目录与 work/dxf_raw 相同时 copy 崩溃。
屋顶问题复盘(第二轮反馈"没有屋顶"):三个原因叠加——① 地上顶盖按设计要走 config `roof_specs`(机房顶 27.9m 一块、主屋面由 F4 顶帽 + 机房层楼板组成 23.1m 一层),首版配置漏了;② roof 类默认线宽 0,女儿墙挤出为零厚度;③ 沙盒缺 mapbox_earcut 导致所有板类网格静默失败。三处都已修,GLB 现含 `PH__roof`(机房顶)、`RF__roof`(檐口/女儿墙带)、F4 顶帽环 + 各层楼板。
SKILL.md 新增:多图框工作流(第 3 步)、"厂区多栋"章节、天正 t3 预设章节、WASM 兜底说明、audit 裁剪口径注意事项(多图框时全文件覆盖率 ~40% 属正常,要看叠图而非头条数字)、B 前缀楼层键警告。
回归测试 `tests/test_extraction_pipeline.py` 12 项全部通过。
## 四、后续建议(未实施)
audit 增加"裁剪范围内"口径的第二组覆盖率数字;detect_sheet_frames 顺带解析剖面标高自动填 z/height;桥接脚本补 HATCH(柱填充)与 ATTRIB(轴号);出一个 site-manifest 组装脚本把多栋 GLB 合成厂区场景。
## 五、"一次做对"机制(2026-07-02 第二轮加固)
思路:把 Agent 的判断变成**会大声失败的确定性门禁**,宁可停在中间也不产出错模型。
新增/加固的机制(全部有回归测试覆盖,共 20 项 checks):读图报告新增 `multi_frame_sheet` 警告(一个 modelspace 里发现 ≥2 个"XX平面图"标题就强制走 detect_sheet_frames,防"一文件当一层");audit 新增 `floors_aligned` 硬门禁(同组楼层墙体包络中心偏差超限即 exit 3,直接拦截"斜楼梯"输出,测试验证了有 offset 通过 / 无 offset 失败);derive 的 `topless_group` 警告(顶层无盖必须配 roof_specs);GLB 导出的三角化失败显式报警(楼板静默消失问题)。SKILL.md 增加 "One-Shot Definition of Done" 检查单:7 条逐项要有证据(报告行/门禁状态/亲眼看过的渲染图)才能交付。
## 六(补)、场布重建(第三轮反馈"场布就几根线")
原因:首版场布只取了定位图测量副本,那份图本来就只画红线/围墙/道路骨架;真正的场地内容(车行道细节、车位、行道树、绿化、出入口、连廊等)在 `建筑-总图(施工图)` 里(米制、含三份方案副本,取顶部与定位副本重合那份)。已把场布提取固化为 skill 脚本 `site_context_from_dump.py`:地面=红线 footprint 板、道路/车位(含圆弧展开与车位块展开,1303+358 段)、围墙=1.8m 栅栏(149 段)、行道树=52 根绿柱(自定义 trees 类别)、场内小构筑物体量(连廊/消控室/钢楼梯,按最近标注命名,出入口自动跳过)。2# 厂房在总图顶副本无独立轮廓(与 1# 贴建、自有整套图纸),按规范应同法建模后摆入,不造假体量。
## 七、2#/3# 建模与摆位(第四轮"继续")
2#厂房、3#辅房用与 1# 完全相同的配方跑通(桥接→图框检测→提取):2# 七层全部网格对齐,包络 64.1×40.1m;3# 暴露并修复了检测器一个盲区——**横排图框**(标题同行、x 向 21m 间距),检测器现在同时支持纵排/横排。摆位数据的攻坚:定位图给排水/电气总图的楼底图都是未绑定 XREF(死路),最终解法是**副本配准**——定位图里未旋转的施工场布副本画有全部楼栋,用 1# 的 90.2×42.2 特征矩形做两副本间刚体配准(验证误差 2mm:红线角点变换后与坐标标注完全吻合),再把该副本里 2# 的屋面轮廓(66×39.2)映射回测量坐标同心摆位。3# 用东侧地块四个红线角点均值近似摆位(±1m,manifest 注记待校正)。4#/5# 为地下坑/低矮水池,定位图无轮廓,标记待建不造假。三栋楼与场布的俯视校验见 campus_check.png。
## 八、1#/2# 间距核实与修正(第六轮)
用户质疑两楼紧贴。核实结论:**贴建是对的,但差一条缝**——首版按屋面轮廓同心摆位导致 2# 嵌入 1# 达 0.26m。证据链:可点坐标角点中 +10.8m/+38.0m 两条线均精确过沿线 90.2m(1# 东立面延长线)→ 2# 东立面与 1# 齐平;副本A 缝隙带 +0.19m 处的平面线 = 变形缝;反证:若按 10m 防火间距,2# 会顶穿北侧红线(几何不可能)。修正后:墙对墙间距 0.190m、东立面错位 0.001m(seam_check.png)。教训固化进 SKILL.md:摆位锚点必须用墙线/坐标标注而非屋面轮廓(含雨棚外挑会偏);邻栋间距必须数值核验(负值=bug,0.15-0.3m=贴建变形缝需旁证,红线冲突可否证假设)。
## 六、厂区合成(定位图 → 摆位)
`定位图 - 副本(2).dwg` 里有一份落在测量坐标上的总平面(mm 单位,x≈349.6km)。1# 厂房在其中的"面积核算"框是 **90.2 × 42.2m、旋转 7.57°**——与模型墙体包络 90.2 × 42.2m 完全 1:1 对应,据此得到精确变换(角点 D=(349582714, 664188492)mm ↔ 模型 (7.3, 8.3)m);180° 朝向歧义用机房墙密度投票判定(no-flip 119 vs 72)。场地本地原点取用地红线角点(避免 349km 坐标撑爆 float32)。合成方式是 **spec 级合并**:把 1# 全部楼层几何旋转平移到场地坐标,再加一层 SITE(红线/围墙/道路/其他楼轮廓),一次导出厂区 GLB。俯视校验图 `campus_check.png` 显示楼栋严丝合缝落在定位框内。剩余 2#/3#/4#/5# 楼各自建模后按 `site_manifest.json` 里同样的配方摆入即可。
## 九、剩余改进项推进(第七轮)
沙盒内已完成 4 项:① `assemble_campus.py` 转正——manifest 驱动的多栋装配 + 自动邻栋间距门禁(穿模 exit 3、0.1-0.3m 提示贴缝),用贝昂三栋回归验证与手工装配偏差 ≤0.35mm(manifest 舍入噪声),并且初跑就自我纠错一次(全楼层包络误报穿模 → 改为首层包络判定);② detect_sheet_frames 新增剖面标高收集,1# 实测输出完整层标高序列(-4.8/±0/4.8/8.1/…/27.9/28.8 全中);③ audit 新增裁剪口径覆盖率(多图框时以此为准);④ 桥接脚本补 ATTRIB→TEXT(天正轴号/坐标标注属性不再丢失)。回归测试扩至 24 项全绿(含横排图框用例)。
Mac 侧待办(沙盒能力边界):Draco 压缩(`node tools/compress.mjs`,WASM 沙盒必崩);正式模板部署验证(npm install three@0.181.2 + 本地服务,验证升级后的 IBL/阴影/物理玻璃实际渲染);4#/5# 建模(先向设计方要含这两个构筑物轮廓的总平面或坐标);3# 摆位精确化(同样需权威定位数据);Tier 2 几何升级(墙体 union/幕墙分格/门窗开洞,动导出管线,需配套回归用例);IFC 语义(build_ifc_poc.py,需 IfcOpenShell)。
## 十、Mac 侧四项推进:Draco / 正式模板 / 墙体 union / 幕墙分格(第八轮,2026-07-02)
沙盒能力边界外的待办在 macOS 上全部落地,过程中又修掉一批"两后端行为分歧"型 bug:
1. **Draco 压缩**:`tools/compress.mjs` 在 macOS 正常(沙盒 WASM 崩溃确认是环境问题)。beian_campus.glb 15.0MB → **0.57MB**(Draco + weld/dedup/prune),121 节点逐一核对无丢挂,`KHR_draco_mesh_compression` 在场且可解码。dedup 把 2 个全同 mesh 合并共享(122→120),无损。
2. **正式模板部署验证**(含用户两次现场反馈的修复):
- "屋顶的板超出了":`build_blender_showcase.py` 生成屋面默认走 bounds+margin 矩形(要 `use_footprint_roofs` 才用多边形),PH 机房顶变成盖满全楼 bbox 的大板。已改为 footprint 无条件优先(与 spec_to_glb 同契约),修复后 6 个屋面节点尺寸与已验证 GLB 逐一吻合。同类:Blender 端不认 `slab_bounds_fallback:false`,ROADS/FENCE/TREES 等无 footprint 层生成盖满全厂区的 bounds 假板,同步修复。**教训:spec_to_glb 修过的坑要同步检查 Blender 端——两后端必须一个契约,否则换后端重建即翻车。**
- "为什么没有嵌入式 viewer 的效果":① 变体类别过滤把场地内容滤掉(路在 detail_lines/grid、树在自定义 trees),`build_showcase_variants.py` 现对 `source_file=="site"` 的楼层整层保留;② 官方模板缺实例化树,已移植(write_web_showcase 从 spec 抽 52 树坐标进 metadata `site_trees`,app.js InstancedMesh 树干+树冠,2 draw call)。
- 阴影接收板从 bounds.min.y(B1 底 -5.1m)钳制到 ±0 地坪(地下室存在时阴影悬空脱开建筑);favicon 404 用 data-URI 消掉,控制台零消息。
- 浏览器亲测:IBL/软阴影/物理玻璃、爆炸 6m、剖切 14m、点击溯源(F3 墙体)、顶视摆位、390px 手机布局全部通过,截图存 `outputs/beian_1hao/web_verify/`。
3. **Tier 2 连续墙体 `merge_wall_solids`**(默认关):spec_to_glb 用 shapely buffer+unary_union+extrude;Blender 端 Python 3.13 无 shapely(ABI 不敢注入),改用原生 `mathutils.geometry.delaunay_2d_cdt` 求并集、边界边挤侧墙。**几何教训:cap_style=2 平头矩形在共享端点的 L 角天生留 w/2×w/2 缺口,union 闭合不了(首轮对比渲染完全一致才暴露);解法是只对共享端点的墙端预延长 w/2(`extend_shared_wall_ends`),洞口自由端不动,T 接头本就有重叠。** 验收:L 角 union 后单多边形恰 6 顶点;默认关闭下厂区 GLB 与改前黄金文件逐字节一致(14,994,560B);开启后三角 +37%(选配近景用)。对比图 `wall_merge_{off,on}_corner.png`。
4. **Tier 2 幕墙分格 `glazing_mullions`**(默认关,`glazing_panel_w` 1.5m):竖梃/横梃合成为伪墙段(细盒型材,横梃带 `_z0/_z1`)并入 `<floor>__walls` 节点,viewer 零改动得到墙材质,玻璃保留,且刻意绕过墙体 union。对比图 `mullions_{off,on}_facade.png`(87m F2 幕墙带效果显著)。
5. **4#/5# 摆位**:向用户确认"含全部构筑物的可点坐标总平面"尚未拿到——按规范跳过,不造假体量;3# 仍为 ±1m 近似,manifest 注记不变。
回归测试扩至 **52 项 checks 全绿**(新增墙体 union 8 项、幕墙分格 8 项等)。产出均亲眼验证(浏览器截图 + Blender 渲染对比),无假数据。
## 交付物
`outputs/beian_1hao/`:beian_1.glb + beian_1_viewer.html(单楼)、beian_campus.glb + beian_campus_viewer.html(厂区:总平面 + 1# 按定位图摆位)、campus_check.png(摆位俯视校验)、site_manifest.json(各楼摆位配方)、beian_iso.png、beian_previews.png、building_spec.json、campus_spec.json、extract_config.json(t3 模板)、frames_report.md、extraction_audit.md、overlays/(8 层叠图 SVG)。