Generalization hardening from 27号 (rounds 5-8): 6 gap fixes, all TDD
- detect_sheet_frames: auxiliary-titled frames (非机动坡道/无障碍改造…) never become the alignment reference; wall-profile correlation fallback when a frame has no axis geometry (coverage+peak-ratio gated); bogus x-pitch from stray same-row titles distrusted (pitch_x < 0.7*pitch_y); plan titles inside cached-xref blocks scanned too - cad_dxf_report: cached_xref_content warning (msp INSERT stubs + in-file block cache -> expand_blocks ≈ bind, not a re-export ask) - derive_showcase_spec: floor_order gaps warn loudly in both directions - assemble_campus: per-building rotation_deg overrides the global one - SKILL.md updated; regression suite +14 checks (auxref/nogrid/mixedrow/ blocktitle/cachedxref/floor_order/rotation scenarios) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -230,6 +230,152 @@ def make_rowframe_dxf(path: Path, layer_prefix: str = "", grid_style: str = "lin
|
||||
doc.saveas(path)
|
||||
|
||||
|
||||
def make_auxref_dxf(path: Path) -> None:
|
||||
"""27号 2# pattern: an auxiliary structure ("非机动坡道一层平面图") sits ABOVE
|
||||
the main plans, grabs the F1 key, and must NOT become the alignment
|
||||
reference — its grid is unrelated to the tower's."""
|
||||
doc = ezdxf.new("R2010", setup=True)
|
||||
for layer in ("WALL", "DOTE", "PUB_TEXT"):
|
||||
doc.layers.add(layer)
|
||||
msp = doc.modelspace()
|
||||
pitch = 98100.0
|
||||
|
||||
def draw_main(oy: float, title: str) -> None:
|
||||
outline = [((0, 0), (40000, 0)), ((40000, 0), (40000, 20000)),
|
||||
((40000, 20000), (0, 20000)), ((0, 20000), (0, 0))]
|
||||
interior = [((8000 * i, 0), (8000 * i, 20000)) for i in range(1, 5)]
|
||||
interior += [((0, 10000), (40000, 10000)), ((12000, 5000), (28000, 5000))]
|
||||
for (sx, sy), (ex, ey) in outline + interior:
|
||||
msp.add_line((sx, sy + oy), (ex, ey + oy), dxfattribs={"layer": "WALL"})
|
||||
for x in (0, 8000, 19000, 26000, 37000, 40000): # varied bays
|
||||
msp.add_line((x, -3000 + oy), (x, 26000 + oy), dxfattribs={"layer": "DOTE"})
|
||||
for y in (0, 6000, 10000, 20000):
|
||||
msp.add_line((-3000, y + oy), (46000, y + oy), dxfattribs={"layer": "DOTE"})
|
||||
msp.add_text(title, height=800, dxfattribs={"layer": "PUB_TEXT"}).set_placement((18000, oy - 6000))
|
||||
|
||||
# ramp frame on top: tiny 6x10 structure with its own (unrelated) grid
|
||||
ry = pitch
|
||||
for start, end in [((0, 0), (6000, 0)), ((6000, 0), (6000, 10000)),
|
||||
((6000, 10000), (0, 10000)), ((0, 10000), (0, 0)),
|
||||
((0, 3300), (6000, 3300)), ((0, 7100), (6000, 7100)),
|
||||
((2500, 0), (2500, 10000))]:
|
||||
msp.add_line((start[0], start[1] + ry), (end[0], end[1] + ry), dxfattribs={"layer": "WALL"})
|
||||
for x in (0, 2500, 6000):
|
||||
msp.add_line((x, ry - 2600), (x, ry + 12600), dxfattribs={"layer": "DOTE"})
|
||||
for y in (0, 3300, 10000):
|
||||
msp.add_line((-2600, y + ry), (8600, y + ry), dxfattribs={"layer": "DOTE"})
|
||||
msp.add_text("非机动坡道一层平面图", height=800,
|
||||
dxfattribs={"layer": "PUB_TEXT"}).set_placement((2000, ry - 6000))
|
||||
|
||||
draw_main(0.0, "一层平面图")
|
||||
draw_main(-pitch, "二层平面图")
|
||||
doc.saveas(path)
|
||||
|
||||
|
||||
def make_nogrid_dxf(path: Path) -> None:
|
||||
"""27号 2#/13号 pattern: frames carry NO axis geometry at all, and floor wall
|
||||
bboxes differ (F2 covers half the building) — clip-corner fallback is
|
||||
off by 20 m in x; only wall-profile correlation recovers the offset."""
|
||||
doc = ezdxf.new("R2010", setup=True)
|
||||
for layer in ("WALL", "PUB_TEXT"):
|
||||
doc.layers.add(layer)
|
||||
msp = doc.modelspace()
|
||||
pitch = 98100.0
|
||||
|
||||
def draw_frame(oy: float, title: str, full_walls: bool) -> None:
|
||||
wall_x0 = 0 if full_walls else 20000
|
||||
outline = [((wall_x0, 0), (40000, 0)), ((40000, 0), (40000, 20000)),
|
||||
((40000, 20000), (wall_x0, 20000)), ((wall_x0, 20000), (wall_x0, 0))]
|
||||
# varied interior bays shared by both floors (the correlation fingerprint)
|
||||
interior = [((26000, 0), (26000, 20000)), ((31000, 0), (31000, 20000)),
|
||||
((37000, 0), (37000, 20000)), ((20000, 0), (20000, 20000)),
|
||||
((23000, 0), (23000, 20000)),
|
||||
((20000, 6000), (40000, 6000)), ((20000, 9400), (40000, 9400)),
|
||||
((20000, 15000), (40000, 15000))]
|
||||
if full_walls:
|
||||
interior += [((6000, 0), (6000, 20000)), ((11000, 0), (11000, 20000)),
|
||||
((0, 6000), (20000, 6000)), ((0, 15000), (20000, 15000))]
|
||||
for (sx, sy), (ex, ey) in outline + interior:
|
||||
msp.add_line((sx, sy + oy), (ex, ey + oy), dxfattribs={"layer": "WALL"})
|
||||
msp.add_text(title, height=800, dxfattribs={"layer": "PUB_TEXT"}).set_placement((18000, oy - 6000))
|
||||
|
||||
draw_frame(0.0, "一层平面图", True)
|
||||
draw_frame(-pitch, "二层平面图", False)
|
||||
doc.saveas(path)
|
||||
|
||||
|
||||
def make_blocktitle_dxf(path: Path) -> None:
|
||||
"""13号 cached-XREF pattern: each sheet lives in ONE block (msp = INSERT
|
||||
stubs), so plan TITLES are inside blocks too — title scan must expand."""
|
||||
doc = ezdxf.new("R2010", setup=True)
|
||||
for layer in ("WALL", "DOTE", "PUB_TEXT"):
|
||||
doc.layers.add(layer)
|
||||
msp = doc.modelspace()
|
||||
pitch = 98100.0
|
||||
|
||||
def make_sheet(idx: int, title: str) -> str:
|
||||
blk = doc.blocks.new(name=f"X-00-00{idx}")
|
||||
outline = [((0, 0), (40000, 0)), ((40000, 0), (40000, 20000)),
|
||||
((40000, 20000), (0, 20000)), ((0, 20000), (0, 0))]
|
||||
interior = [((8000 * i, 0), (8000 * i, 20000)) for i in range(1, 5)]
|
||||
interior += [((0, 10000), (40000, 10000)), ((12000, 5000), (28000, 5000))]
|
||||
for (sx, sy), (ex, ey) in outline + interior:
|
||||
blk.add_line((sx, sy), (ex, ey), dxfattribs={"layer": "WALL"})
|
||||
for x in (0, 8000, 19000, 26000, 37000, 40000):
|
||||
blk.add_line((x, -3000), (x, 26000), dxfattribs={"layer": "DOTE"})
|
||||
for y in (0, 6000, 10000, 20000):
|
||||
blk.add_line((-3000, y), (46000, y), dxfattribs={"layer": "DOTE"})
|
||||
blk.add_text(title, height=800, dxfattribs={"layer": "PUB_TEXT"}).set_placement((18000, -6000))
|
||||
return blk.name
|
||||
|
||||
msp.add_blockref(make_sheet(1, "一层平面图"), (0, 0))
|
||||
msp.add_blockref(make_sheet(2, "二层平面图"), (0, -pitch))
|
||||
doc.saveas(path)
|
||||
|
||||
|
||||
def make_mixedrow_dxf(path: Path) -> None:
|
||||
"""27号 1#B pattern: main plans stack in a COLUMN, but a couple of stray
|
||||
same-row detail titles fabricate a bogus (much smaller) x-pitch. clip_w
|
||||
then shrinks to that x-pitch and the refine window drops the building's
|
||||
second wing (unit-block plans: one wing's midpoint falls outside)."""
|
||||
doc = ezdxf.new("R2010", setup=True)
|
||||
for layer in ("WALL", "DOTE", "PUB_TEXT"):
|
||||
doc.layers.add(layer)
|
||||
msp = doc.modelspace()
|
||||
pitch = 98100.0
|
||||
|
||||
def draw_frame(oy: float, title: str) -> None:
|
||||
# two wings: x 0..30000 and 50000..80000 (gap between); title under the LEFT wing
|
||||
for x0 in (0.0, 50000.0):
|
||||
outline = [((x0, 0), (x0 + 30000, 0)), ((x0 + 30000, 0), (x0 + 30000, 14000)),
|
||||
((x0 + 30000, 14000), (x0, 14000)), ((x0, 14000), (x0, 0))]
|
||||
interior = [((x0 + d, 0), (x0 + d, 14000)) for d in (6000, 13000, 21000)]
|
||||
for (sx, sy), (ex, ey) in outline + interior:
|
||||
msp.add_line((sx, sy + oy), (ex, ey + oy), dxfattribs={"layer": "WALL"})
|
||||
for x in (0, 8000, 19000, 30000, 50000, 61000, 72000, 80000):
|
||||
msp.add_line((x, -3000 + oy), (x, 17000 + oy), dxfattribs={"layer": "DOTE"})
|
||||
for y in (0, 5200, 9000, 14000):
|
||||
msp.add_line((-3000, y + oy), (83000, y + oy), dxfattribs={"layer": "DOTE"})
|
||||
msp.add_text(title, height=800, dxfattribs={"layer": "PUB_TEXT"}).set_placement((12000, oy - 6000))
|
||||
|
||||
draw_frame(0.0, "一层平面图")
|
||||
draw_frame(-pitch, "二层平面图")
|
||||
# stray detail frames titled 平面图 in ONE row of their own, 15 m apart:
|
||||
# their x-gap is the only same-row gap and must NOT define the clip width
|
||||
# for the main column (real 1#B: 非机动坡道 frames row made pitch_x≈15.8k)
|
||||
sy = -250000.0
|
||||
for i, title in enumerate(("电梯机房平面图", "水箱间平面图")):
|
||||
ox = 300000.0 + i * 15000.0
|
||||
for start, end in [((ox, sy), (ox + 8000, sy)), ((ox + 8000, sy), (ox + 8000, sy + 6000)),
|
||||
((ox + 8000, sy + 6000), (ox, sy + 6000)), ((ox, sy + 6000), (ox, sy)),
|
||||
((ox + 4000, sy), (ox + 4000, sy + 6000)), ((ox, sy + 3000), (ox + 8000, sy + 3000)),
|
||||
((ox + 2000, sy), (ox + 2000, sy + 6000)), ((ox + 6000, sy + 3000), (ox + 6000, sy + 6000)),
|
||||
((ox + 1000, sy + 1500), (ox + 7000, sy + 1500)), ((ox + 1000, sy + 4500), (ox + 7000, sy + 4500))]:
|
||||
msp.add_line(start, end, dxfattribs={"layer": "WALL"})
|
||||
msp.add_text(title, height=800, dxfattribs={"layer": "PUB_TEXT"}).set_placement((ox + 1000, sy - 6000))
|
||||
doc.saveas(path)
|
||||
|
||||
|
||||
def run(cmd: list[str]) -> subprocess.CompletedProcess:
|
||||
return subprocess.run(cmd, cwd=ROOT, text=True, capture_output=True)
|
||||
|
||||
@@ -242,6 +388,19 @@ def main() -> int:
|
||||
make_plan_dxf(dxf_dir / "plan.dxf")
|
||||
make_xref_shell_dxf(dxf_dir / "roof.dxf")
|
||||
|
||||
# cached-xref sheet (13号 pattern): msp holds only INSERT stubs, the real
|
||||
# content is CACHED as a block definition inside the same file
|
||||
cx_doc = ezdxf.new("R2010")
|
||||
cx_doc.layers.add("WALL")
|
||||
cx_blk = cx_doc.blocks.new(name="X-00-0011")
|
||||
for i in range(300):
|
||||
cx_blk.add_line((i * 100, 0), (i * 100, 5000), dxfattribs={"layer": "WALL"})
|
||||
cx_msp = cx_doc.modelspace()
|
||||
cx_msp.add_text("总平面图", dxfattribs={"layer": "PUB_TEXT"})
|
||||
for i in range(3):
|
||||
cx_msp.add_blockref("X-00-0011", (i * 50000, 0))
|
||||
cx_doc.saveas(dxf_dir / "cachedxref.dxf")
|
||||
|
||||
# --- cad_dxf_report: XREF shell must be flagged, plan must not ---
|
||||
proc = run([
|
||||
sys.executable, "scripts/cad_dxf_report.py",
|
||||
@@ -254,6 +413,9 @@ def main() -> int:
|
||||
roof_warnings = " ".join(by_file.get("roof.dxf", {}).get("warnings", []))
|
||||
check("roof.dxf flagged as XREF shell", "likely_xref_shell" in roof_warnings, roof_warnings)
|
||||
check("plan.dxf has no warnings", not by_file.get("plan.dxf", {}).get("warnings"), str(by_file.get("plan.dxf", {}).get("warnings")))
|
||||
cx_warnings = " ".join(by_file.get("cachedxref.dxf", {}).get("warnings", []))
|
||||
check("cached-xref stub sheet points at expand_blocks", "cached_xref_content" in cx_warnings and "expand_blocks" in cx_warnings, cx_warnings)
|
||||
check("cached-xref not misreported as re-export ask", "likely_xref_shell" not in cx_warnings and "near_empty" not in cx_warnings, cx_warnings)
|
||||
md = (WORK / "read_report" / "cad_read_report.md").read_text(encoding="utf-8")
|
||||
check("markdown has warnings section", "Warnings (resolve before modeling)" in md)
|
||||
|
||||
@@ -645,6 +807,157 @@ def main() -> int:
|
||||
ok_bg = "F2" in bg_off and abs(bg_off["F2"][0]) <= 120 and abs(bg_off["F2"][1] - 98100.0) <= 120
|
||||
check("block-grid correlation beats clip-corner fallback", ok_bg, str(bg_off))
|
||||
|
||||
# --- auxiliary-titled frame must not become the reference (27号 2#) ---
|
||||
aux_dir = WORK / "dxf_auxref"
|
||||
aux_dir.mkdir(parents=True, exist_ok=True)
|
||||
make_auxref_dxf(aux_dir / "auxref.dxf")
|
||||
proc = run([
|
||||
sys.executable, "scripts/detect_sheet_frames.py",
|
||||
"--dxf", str(aux_dir / "auxref.dxf"), "--out-config", str(WORK / "frames_aux.json"),
|
||||
"--out-report", str(WORK / "frames_aux.md"), "--vendor-dir", str(VENDOR),
|
||||
])
|
||||
check("detect handles aux-titled frames", proc.returncode == 0, proc.stderr[-600:])
|
||||
if proc.returncode == 0:
|
||||
aux_md = (WORK / "frames_aux.md").read_text(encoding="utf-8")
|
||||
ref_line = next((l for l in aux_md.splitlines() if l.startswith("- reference frame:")), "")
|
||||
check("aux title is not the reference", "非机动坡道" not in ref_line, ref_line)
|
||||
check("plain 一层平面图 is the reference", "(一层平面图)" in ref_line, ref_line)
|
||||
frames_aux = json.loads((WORK / "frames_aux.json").read_text(encoding="utf-8"))
|
||||
aux_off = {f["name"]: f["offset"] for f in frames_aux["drawings"][0]["floors"]}
|
||||
f2 = aux_off.get("二层平面图")
|
||||
ok_aux = f2 is not None and abs(f2[0]) <= 120 and abs(f2[1] - 98100.0) <= 120
|
||||
check("main F2 aligns to main F1 (not ramp)", ok_aux, str(aux_off))
|
||||
check("aux frame flagged in report", "auxiliary" in aux_md, aux_md[-400:])
|
||||
|
||||
# --- gridless frames: wall-profile correlation beats clip-corner (27号 2#/13号) ---
|
||||
ng_dir = WORK / "dxf_nogrid"
|
||||
ng_dir.mkdir(parents=True, exist_ok=True)
|
||||
make_nogrid_dxf(ng_dir / "nogrid.dxf")
|
||||
proc = run([
|
||||
sys.executable, "scripts/detect_sheet_frames.py",
|
||||
"--dxf", str(ng_dir / "nogrid.dxf"), "--out-config", str(WORK / "frames_ng.json"),
|
||||
"--out-report", str(WORK / "frames_ng.md"), "--vendor-dir", str(VENDOR),
|
||||
])
|
||||
check("detect handles gridless frames", proc.returncode == 0, proc.stderr[-600:])
|
||||
if proc.returncode == 0:
|
||||
frames_ng = json.loads((WORK / "frames_ng.json").read_text(encoding="utf-8"))
|
||||
ng_off = {f["name"]: f["offset"] for f in frames_ng["drawings"][0]["floors"]}
|
||||
ng_md = (WORK / "frames_ng.md").read_text(encoding="utf-8")
|
||||
f2 = ng_off.get("二层平面图")
|
||||
ok_ng = f2 is not None and abs(f2[0]) <= 120 and abs(f2[1] - 98100.0) <= 120
|
||||
check("wall-profile correlation recovers offset", ok_ng, str(ng_off))
|
||||
check("wall correlation reported (not silent WEAK)", "wall-correlated" in ng_md, ng_md[-500:])
|
||||
|
||||
# --- plan titles inside cached-xref blocks (13号: msp = INSERT stubs only) ---
|
||||
bt_dir = WORK / "dxf_blocktitle"
|
||||
bt_dir.mkdir(parents=True, exist_ok=True)
|
||||
make_blocktitle_dxf(bt_dir / "blocktitle.dxf")
|
||||
proc = run([
|
||||
sys.executable, "scripts/detect_sheet_frames.py",
|
||||
"--dxf", str(bt_dir / "blocktitle.dxf"), "--out-config", str(WORK / "frames_bt.json"),
|
||||
"--out-report", str(WORK / "frames_bt.md"), "--vendor-dir", str(VENDOR),
|
||||
])
|
||||
bt_ok = proc.returncode == 0
|
||||
check("detect finds titles inside blocks", bt_ok, (proc.stdout + proc.stderr)[-400:])
|
||||
if bt_ok:
|
||||
frames_bt = json.loads((WORK / "frames_bt.json").read_text(encoding="utf-8"))
|
||||
bt = {f["name"]: f for f in frames_bt["drawings"][0]["floors"]}
|
||||
check("both block-wrapped frames detected", set(bt) == {"一层平面图", "二层平面图"}, str(set(bt)))
|
||||
f2 = bt.get("二层平面图")
|
||||
ok_bt = f2 is not None and abs(f2["offset"][0]) <= 120 and abs(f2["offset"][1] - 98100.0) <= 120
|
||||
check("block-wrapped frames aligned", ok_bt, str(f2 and f2["offset"]))
|
||||
|
||||
# --- bogus x-pitch from stray same-row titles must not shrink clips (27号 1#B) ---
|
||||
mx_dir = WORK / "dxf_mixedrow"
|
||||
mx_dir.mkdir(parents=True, exist_ok=True)
|
||||
make_mixedrow_dxf(mx_dir / "mixedrow.dxf")
|
||||
proc = run([
|
||||
sys.executable, "scripts/detect_sheet_frames.py",
|
||||
"--dxf", str(mx_dir / "mixedrow.dxf"), "--out-config", str(WORK / "frames_mx.json"),
|
||||
"--out-report", str(WORK / "frames_mx.md"), "--vendor-dir", str(VENDOR),
|
||||
])
|
||||
check("detect handles mixed row/column titles", proc.returncode == 0, proc.stderr[-600:])
|
||||
if proc.returncode == 0:
|
||||
frames_mx = json.loads((WORK / "frames_mx.json").read_text(encoding="utf-8"))
|
||||
mx = {f["name"]: f for f in frames_mx["drawings"][0]["floors"]}
|
||||
f1 = mx.get("一层平面图")
|
||||
ok_span = f1 is not None and f1["clip"][0] <= 0 and f1["clip"][2] >= 80000
|
||||
check("clip spans both wings despite stray x-pitch", ok_span, str(f1 and f1["clip"]))
|
||||
f2 = mx.get("二层平面图")
|
||||
ok_mx = f2 is not None and abs(f2["offset"][0]) <= 120 and abs(f2["offset"][1] - 98100.0) <= 120
|
||||
check("mixed layout offset recovered", ok_mx, str(f2 and f2["offset"]))
|
||||
|
||||
# --- floor_order gaps must warn loudly, not silently drop floors (13号 b2: F11-F16 消失) ---
|
||||
fo_config = {
|
||||
"scale": 0.001,
|
||||
"floor_order": ["1F", "GHOST"],
|
||||
"drawings": [{"file": "plan.dxf", "floors": [
|
||||
{"key": "1F", "name": "首层", "z": 0.0, "height": 4.2},
|
||||
{"key": "2F", "name": "二层", "z": 4.2, "height": 4.2},
|
||||
]}],
|
||||
}
|
||||
fo_path = WORK / "fo_config.json"
|
||||
fo_path.write_text(json.dumps(fo_config, ensure_ascii=False), encoding="utf-8")
|
||||
proc = run([
|
||||
sys.executable, "scripts/derive_showcase_spec.py",
|
||||
"--dxf-dir", str(dxf_dir), "--config", str(fo_path),
|
||||
"--out", str(WORK / "fo_spec.json"), "--vendor-dir", str(VENDOR),
|
||||
])
|
||||
check("derive with floor_order gaps runs", proc.returncode == 0, proc.stderr[-400:])
|
||||
check("missing-from-order floor warns", "floor_order" in proc.stderr and "2F" in proc.stderr, proc.stderr[-300:])
|
||||
check("ghost order key warns", "GHOST" in proc.stderr, proc.stderr[-300:])
|
||||
|
||||
# --- assemble_campus: per-building rotation_deg (27号: 4#楼独自斜置) ---
|
||||
asm_dir = WORK / "assemble"
|
||||
asm_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def mini_spec(tag: str) -> str:
|
||||
walls = []
|
||||
for (sx, sy), (ex, ey) in [((0, 0), (10, 0)), ((10, 0), (10, 20)),
|
||||
((10, 20), (0, 20)), ((0, 20), (0, 0))]:
|
||||
walls.append({"start": [sx, sy], "end": [ex, ey], "width": 0.2, "layer": "WALL"})
|
||||
spec = {
|
||||
"project": tag, "units": {"scale": 0.001},
|
||||
"categories": {"walls": {"label": "墙", "color": "#ccc"}},
|
||||
"source": {"config": {"use_footprint_slabs": True, "roof_specs": []}},
|
||||
"floors": {"F1": {"name": "F1", "z": 0.0, "height": 3.0,
|
||||
"bounds": [0, 0, 10, 20],
|
||||
"segments": {"walls": walls},
|
||||
"footprint": {"polygons": [[[0, 0], [10, 0], [10, 20], [0, 20]]]},
|
||||
"caps": []}},
|
||||
}
|
||||
p = asm_dir / f"spec_{tag}.json"
|
||||
p.write_text(json.dumps(spec), encoding="utf-8")
|
||||
return str(p)
|
||||
|
||||
manifest = {
|
||||
"campus_origin_surveying_m": [0.0, 0.0],
|
||||
"rotation_deg": 0.0,
|
||||
"buildings": {
|
||||
"A": {"spec": mini_spec("a"), "prefix": "A", "model_anchor_m": [0.0, 0.0],
|
||||
"survey_anchor_m": [0.0, 0.0]},
|
||||
"B": {"spec": mini_spec("b"), "prefix": "B", "model_anchor_m": [0.0, 0.0],
|
||||
"survey_anchor_m": [50.0, 0.0], "rotation_deg": 90.0},
|
||||
},
|
||||
}
|
||||
mpath = asm_dir / "manifest.json"
|
||||
mpath.write_text(json.dumps(manifest), encoding="utf-8")
|
||||
proc = run([
|
||||
sys.executable, "scripts/assemble_campus.py",
|
||||
"--manifest", str(mpath), "--out", str(asm_dir / "campus.json"),
|
||||
"--project-name", "rot-test", "--allow-overlap",
|
||||
])
|
||||
check("assemble_campus per-building rotation runs", proc.returncode == 0, proc.stderr[-500:])
|
||||
if proc.returncode == 0:
|
||||
campus = json.loads((asm_dir / "campus.json").read_text(encoding="utf-8"))
|
||||
bb = campus["floors"]["BF1"]["bounds"]
|
||||
ok_rot = (abs(bb[0] - 30.0) < 0.01 and abs(bb[1] - 0.0) < 0.01
|
||||
and abs(bb[2] - 50.0) < 0.01 and abs(bb[3] - 10.0) < 0.01)
|
||||
check("per-building rotation applied (90deg)", ok_rot, str(bb))
|
||||
ab = campus["floors"]["AF1"]["bounds"]
|
||||
ok_a = abs(ab[0]) < 0.01 and abs(ab[2] - 10.0) < 0.01 and abs(ab[3] - 20.0) < 0.01
|
||||
check("unrotated sibling unaffected", ok_a, str(ab))
|
||||
|
||||
# --- isolated legend clusters (黄桥图签窗图例 -> footprint 细三角飘板) ---
|
||||
iso_dir = WORK / "dxf_isolated"
|
||||
iso_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user