detect_sheet_frames: MTEXT height probe uses char_height

dxf.get("height") raises DXFAttributeError on MTEXT (undefined-for-type);
a short MTEXT reaching the title probe crashed the 27号 1#A detection.
Fixture gains a short MTEXT note.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 22:22:31 +08:00
parent 778f6b0b5d
commit 06776e4b76
2 changed files with 10 additions and 1 deletions

View File

@@ -274,7 +274,13 @@ def main() -> int:
x, y = float(pos.x), float(pos.y)
except Exception:
continue
height = float(entity.dxf.get("height", 0) or 0)
# MTEXT stores char_height; asking MTEXT for "height" raises
# DXFAttributeError (only undefined-for-type attributes raise).
try:
height_attr = "char_height" if kind == "MTEXT" else "height"
height = float(entity.dxf.get(height_attr, 0) or 0)
except Exception:
height = 0.0
layer = str(entity.dxf.layer)
if plan_title.search(content) and not (plan_exclude and plan_exclude.search(content)):
if not match_any(layer, title_excludes):