detect_sheet_frames: wildcard axis-layer defaults (prefixed-layer institutes)
13号地块 prefixes every layer (A_DOTE/A_AXIS/A_WALL); the exact-token axis defaults silently zeroed grid-correlation votes for all 44 frames. Defaults now *AXIS*/*DOTE*; rowframe fixture gains a layer_prefix="A_" variant asserting the grid still votes (no WEAK). Logged open item: the tower sheets still vote 0 after the pattern fix — axis stubs vs full-span grid lines or clip-window semantics, to debug next round; plus the plot-13 storey table and the finding that per-floor multi-clip stitching already works via repeated floor keys. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -181,10 +181,16 @@ def make_blockgrid_dxf(path: Path) -> None:
|
||||
doc.saveas(path)
|
||||
|
||||
|
||||
def make_rowframe_dxf(path: Path) -> None:
|
||||
"""Row layout (3#辅房 pattern): frames side by side, pitch on X, titles same row."""
|
||||
def make_rowframe_dxf(path: Path, layer_prefix: str = "") -> 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.
|
||||
"""
|
||||
doc = ezdxf.new("R2010", setup=True)
|
||||
for layer in ("WALL", "DOTE", "PUB_TEXT"):
|
||||
wall_layer = f"{layer_prefix}WALL"
|
||||
grid_layer = f"{layer_prefix}DOTE"
|
||||
for layer in (wall_layer, grid_layer, "PUB_TEXT"):
|
||||
doc.layers.add(layer)
|
||||
msp = doc.modelspace()
|
||||
pitch = 21000.0
|
||||
@@ -196,13 +202,13 @@ def make_rowframe_dxf(path: Path) -> None:
|
||||
interior += [((4000, 0), (4000, 16000)), ((2000, 4000), (6000, 4000)),
|
||||
((2000, 12000), (6000, 12000))]
|
||||
for (sx, sy), (ex, ey) in outline + interior:
|
||||
msp.add_line((sx + ox, sy), (ex + ox, ey), dxfattribs={"layer": "WALL"})
|
||||
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": "DOTE"})
|
||||
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": "DOTE"})
|
||||
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, "一层平面图")
|
||||
@@ -396,6 +402,21 @@ def main() -> int:
|
||||
ok_row = "F2" in row_off and abs(row_off["F2"][0] + 21000.0) <= 120 and abs(row_off["F2"][1]) <= 120
|
||||
check("row layout: x-pitch offset recovered", ok_row, str(row_off))
|
||||
|
||||
# prefixed layers (13号地块: A_WALL/A_DOTE) must still grid-align
|
||||
make_rowframe_dxf(row_dir / "rowframes_prefixed.dxf", layer_prefix="A_")
|
||||
proc = run([
|
||||
sys.executable, "scripts/detect_sheet_frames.py",
|
||||
"--dxf", str(row_dir / "rowframes_prefixed.dxf"), "--out-config", str(WORK / "frames_pref.json"),
|
||||
"--out-report", str(WORK / "frames_pref.md"), "--vendor-dir", str(VENDOR),
|
||||
])
|
||||
check("detect handles prefixed layers", proc.returncode == 0, proc.stderr[-400:])
|
||||
if proc.returncode == 0:
|
||||
frames_pref = json.loads((WORK / "frames_pref.json").read_text(encoding="utf-8"))
|
||||
pref_off = {f["key"]: f["offset"] for f in frames_pref["drawings"][0]["floors"]}
|
||||
pref_md = (WORK / "frames_pref.md").read_text(encoding="utf-8")
|
||||
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}")
|
||||
|
||||
# --- merge_wall_solids: shapely union of wall segments (spec_to_glb) ---
|
||||
sys.path.insert(0, str(ROOT / "scripts"))
|
||||
import spec_to_glb # noqa: E402
|
||||
|
||||
Reference in New Issue
Block a user