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:
@@ -518,7 +518,10 @@ def build_cross_drawing(
|
||||
|
||||
# 표 모듈은 이 모듈의 직렬화 헬퍼를 쓰므로 순환을 피해 함수 안에서 들여온다.
|
||||
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Table import (
|
||||
_cross_note_entities,
|
||||
_cross_table_entities,
|
||||
cross_note_height,
|
||||
cross_note_lines,
|
||||
cross_table_height,
|
||||
cross_table_width,
|
||||
)
|
||||
@@ -561,6 +564,10 @@ def build_cross_drawing(
|
||||
table_bottom = oy - half_height
|
||||
if quantity_table is not None:
|
||||
table_top = oy - half_height - 8.0
|
||||
# 표 위 글(150-3) — 줄 수만큼 표를 내림
|
||||
note_lines = cross_note_lines(design)
|
||||
entities.extend(_cross_note_entities(drawing_id, note_lines, table_top, center_x))
|
||||
table_top -= cross_note_height(note_lines)
|
||||
entities.extend(
|
||||
_cross_table_entities(drawing_id, quantity_table, table_top, title_label, center_x)
|
||||
)
|
||||
|
||||
@@ -26,6 +26,8 @@ from B07_DesignDetail.B07_DesignDetail_Engine_Cad import (
|
||||
points_from_samples,
|
||||
)
|
||||
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Table import (
|
||||
cross_note_height,
|
||||
cross_note_lines,
|
||||
cross_table_height,
|
||||
cross_table_width,
|
||||
)
|
||||
@@ -90,7 +92,7 @@ def section_block_size(
|
||||
top = half_height + _BORDER_PAD_MM
|
||||
below = half_height + _BORDER_PAD_MM
|
||||
if with_table:
|
||||
below += 8.0 + cross_table_height()
|
||||
below += 8.0 + cross_note_height(cross_note_lines(design_spec)) + cross_table_height()
|
||||
return (width, top + below)
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user