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:
@@ -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):
|
||||
|
||||
@@ -141,6 +141,9 @@ def make_multiframe_dxf(path: Path, mif_titles: bool = False) -> None:
|
||||
|
||||
draw_frame(0.0, "一层平面图")
|
||||
draw_frame(-pitch, "二层平面图")
|
||||
# a SHORT MTEXT reaches the title-height probe (long ones are skipped
|
||||
# first); MTEXT has char_height, not height — 27号 1#A crashed here
|
||||
msp.add_mtext("备注说明", dxfattribs={"layer": "PUB_TEXT", "char_height": 500}).set_location((5000, 5000))
|
||||
doc.saveas(path)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user