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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user