detect_sheet_frames: axis ticks vote like grid lines; expanded axis window

Two vote-killers found on 13号地块 towers: axis geometry sits OUTSIDE the
wall-tight clip (stubs beyond the facade), and min_grid_len = pitch*0.25
discarded 0.8m axis-number ticks outright. Axis candidates are now
collected in a pitch*0.16-expanded window, and strictly axis-parallel
stubs (pitch*0.004..0.05) count alongside full-span lines — same-position
ticks cluster into one vote. Synthetic tick fixture goes WEAK -> full votes.

Honest finding logged: the 13号 tower frames genuinely contain NO axis
geometry (all 249 ticks belong to other frames), so votes=0 is the correct
verdict there — modeling proceeds via clip-corner fallback plus mandatory
per-floor overlay verification; wall-position correlation noted as the
future alignment source when axes are absent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 21:42:03 +08:00
parent 12ddc9488d
commit bccc9f41d6
3 changed files with 55 additions and 14 deletions

View File

@@ -72,10 +72,16 @@
默认 axis-layers 是精确 token(AXIS/DOTE),该院所有图层带 `A_` 前缀
→ votes 全 0 落 clip 角点兜底。修复:默认 pattern 加通配
(`*AXIS*,*DOTE*`),回归用例 rowframe 加 layer_prefix="A_" 变体。
**未决(下一轮)**:13号 塔楼修正后仍 0 票(仅 y=1)——A_AXIS 745 条
存在但不进投票,疑似轴号短引线(非跨图长线)或 wall-bbox 精修 clip
裁掉轴线区,需检查 segments_in 的窗口语义;当前 44 框全靠 clip 角点
兜底,标准层间 offset 有 9m 级差异,须按 DoD 用叠图逐层核验后才可建模。
后续排查(同轮完成):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、

View File

@@ -349,13 +349,22 @@ def main() -> int:
if clip is None:
clip = rough
notes.append(f"{t['name']}: no wall/roof geometry in rough clip; using pitch-based clip")
axes = segments_in(lines, clip, axis_layers)
# Axis geometry lives OUTSIDE the wall-tight clip (axis-number stubs sit
# beyond the facade), so collect grid candidates in an expanded window.
axis_margin = pitch * 0.16
axis_clip = [clip[0] - axis_margin, clip[1] - axis_margin, clip[2] + axis_margin, clip[3] + axis_margin]
axes = segments_in(lines, axis_clip, axis_layers)
min_grid_len = pitch * 0.25
# Some sets (13号地块) draw NO through grid lines at all — only ~0.8m
# axis ticks. A tick's position still fingerprints the grid, so accept
# short strictly-axis-parallel stubs alongside full-span lines.
tick_min, tick_max = pitch * 0.004, pitch * 0.05
vert, horiz = [], []
for sx, sy, ex, ey in axes:
if abs(ex - sx) < 2.0 and abs(ey - sy) > min_grid_len:
dx, dy = abs(ex - sx), abs(ey - sy)
if dx < 2.0 and (dy > min_grid_len or tick_min < dy < tick_max):
vert.append((sx + ex) / 2)
elif abs(ey - sy) < 2.0 and abs(ex - sx) > min_grid_len:
elif dy < 2.0 and (dx > min_grid_len or tick_min < dx < tick_max):
horiz.append((sy + ey) / 2)
floors.append({
"key": floor_key_for(t["name"], used_keys),

View File

@@ -181,11 +181,14 @@ def make_blockgrid_dxf(path: Path) -> None:
doc.saveas(path)
def make_rowframe_dxf(path: Path, layer_prefix: str = "") -> None:
def make_rowframe_dxf(path: Path, layer_prefix: str = "", grid_style: str = "lines") -> None:
"""Row layout (3#辅房 pattern): frames side by side, pitch on X, titles same row.
layer_prefix simulates design institutes that prefix every layer
(13号地块: A_WALL/A_DOTE) — exact-token axis patterns then miss the grid.
grid_style="ticks" draws 0.8 m axis-number stubs just OUTSIDE the wall
bbox instead of full-span grid lines (13号: no through grids at all) —
tick positions still fingerprint the grid for correlation.
"""
doc = ezdxf.new("R2010", setup=True)
wall_layer = f"{layer_prefix}WALL"
@@ -203,12 +206,20 @@ def make_rowframe_dxf(path: Path, layer_prefix: str = "") -> None:
((2000, 12000), (6000, 12000))]
for (sx, sy), (ex, ey) in outline + interior:
msp.add_line((sx + ox, sy), (ex + ox, ey), dxfattribs={"layer": wall_layer})
for i in range(3):
x = i * 4000
msp.add_line((x + ox, -2500), (x + ox, 18500), dxfattribs={"layer": grid_layer})
for j in range(4):
y = j * 5000
msp.add_line((-2500 + ox, y), (10500 + ox, y), dxfattribs={"layer": grid_layer})
if grid_style == "ticks":
for x in (0, 2600, 4000, 8000): # varied bays; stubs beyond the wall bbox
msp.add_line((x + ox, -3200), (x + ox, -2400), dxfattribs={"layer": grid_layer})
msp.add_line((x + ox, 16400), (x + ox, 17200), dxfattribs={"layer": grid_layer})
for y in (0, 3400, 5000, 11000):
msp.add_line((-3200 + ox, y), (-2400 + ox, y), dxfattribs={"layer": grid_layer})
msp.add_line((8400 + ox, y), (9200 + ox, y), dxfattribs={"layer": grid_layer})
else:
for i in range(3):
x = i * 4000
msp.add_line((x + ox, -2500), (x + ox, 18500), dxfattribs={"layer": grid_layer})
for j in range(4):
y = j * 5000
msp.add_line((-2500 + ox, y), (10500 + ox, y), dxfattribs={"layer": grid_layer})
msp.add_text(title, height=700, dxfattribs={"layer": "PUB_TEXT"}).set_placement((2500 + ox, -5200))
draw_frame(0.0, "一层平面图")
@@ -417,6 +428,21 @@ def main() -> int:
ok_pref = "F2" in pref_off and abs(pref_off["F2"][0] + 21000.0) <= 120 and "WEAK" not in pref_md
check("prefixed A_DOTE grid still votes", ok_pref, f"{pref_off} weak={'WEAK' in pref_md}")
# tick-style grids (13号: 0.8m axis stubs outside the wall bbox, no through lines)
make_rowframe_dxf(row_dir / "rowframes_ticks.dxf", grid_style="ticks")
proc = run([
sys.executable, "scripts/detect_sheet_frames.py",
"--dxf", str(row_dir / "rowframes_ticks.dxf"), "--out-config", str(WORK / "frames_ticks.json"),
"--out-report", str(WORK / "frames_ticks.md"), "--vendor-dir", str(VENDOR),
])
check("detect handles tick grids", proc.returncode == 0, proc.stderr[-400:])
if proc.returncode == 0:
frames_ticks = json.loads((WORK / "frames_ticks.json").read_text(encoding="utf-8"))
tick_off = {f["key"]: f["offset"] for f in frames_ticks["drawings"][0]["floors"]}
tick_md = (WORK / "frames_ticks.md").read_text(encoding="utf-8")
ok_ticks = "F2" in tick_off and abs(tick_off["F2"][0] + 21000.0) <= 120 and "WEAK" not in tick_md
check("axis ticks vote like grid lines", ok_ticks, f"{tick_off} weak={'WEAK' in tick_md}")
# --- merge_wall_solids: shapely union of wall segments (spec_to_glb) ---
sys.path.insert(0, str(ROOT / "scripts"))
import spec_to_glb # noqa: E402