feat(B07): 횡단도 수량표 바로 위 B06 [상세] 글 여러 줄 · 칸 이름 「도면 표 위 글」(150-3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JywHxQuWPk6UYXTebyrBoU
This commit is contained in:
2026-10-09 19:02:11 +09:00
co-authored by Claude Opus 5.5
parent 7e874b876a
commit 1850fb2e32
5 changed files with 143 additions and 3 deletions
@@ -14,6 +14,7 @@ from B07_DesignDetail.B07_DesignDetail_Engine_Cad import (
TABLE_LINE_COLOR,
TABLE_VALUE_COLOR,
_format,
_text_entity,
table_entity,
)
@@ -318,6 +319,44 @@ def extract_quantity_table(
return table
# 표 위 글(150-3) — B06 [상세] 글(`design.structure_note`)을 줄마다 표 왼쪽 맞춤으로 찍음.
_CROSS_NOTE_LINE_HEIGHT = 3.0
def cross_note_lines(design: dict[str, Any] | None) -> list[str]:
"""설계의 표 위 글 → 줄 목록(앞뒤 빈 줄 · 줄 끝 공백 지움 · 없으면 빈 목록)."""
note = design.get("structure_note") if isinstance(design, dict) else None
if not isinstance(note, str):
return []
return [line.rstrip() for line in note.strip().splitlines()]
def cross_note_height(lines: list[str]) -> float:
"""표 위 글 높이(mm) — 줄 수 × 줄 높이."""
return _CROSS_NOTE_LINE_HEIGHT * len(lines)
def _cross_note_entities(
drawing_id: str, lines: list[str], top: float, center_x: float = 0.0
) -> list[dict[str, Any]]:
"""표 위 글 줄마다 Text — 표 왼쪽 끝 맞춤 · 위에서 아래로(id `{도면}:note:{n}`)."""
left = center_x - _CROSS_TABLE_WIDTH / 2.0
return [
_text_entity(
f"{drawing_id}:note:{index}",
line,
left,
top - _CROSS_NOTE_LINE_HEIGHT * (index + 0.5),
CROSS_TABLE_LAYER_ID,
_CROSS_TABLE_FONT,
TABLE_LABEL_COLOR,
align="left",
)
for index, line in enumerate(lines)
if line
]
def cross_table_width() -> float:
"""수량 산출표 가로 폭(mm)."""
return _CROSS_TABLE_WIDTH