feat(M02): 구조물 도면 상세 · 카드 미리보기에 도각 얹음 — 외곽 좌하단 (0,0) · 보여주기 층

- 서버 GET /api/m02/structure-frame — B07 시스템 양식 00_template_A1 을 frame_entities(fit=False)로 1:1 배치 · 외곽 좌하단 (0,0) 으로 옮김 · 잠금 층 m02-structure-frame「도각(보기)」(마스터 양식 json 그대로)
- 화면 mountDrawingTemplate frame 갈래 — 실을 때 도각 엔티티 · 층 덧붙임 · getDoc 에서 그 층 통째로 뺌(구조물 엔티티 · 저장 본문에 안 섞임)
- 층 없는 빈 구조물 문서는 기본 층을 채움 — 잠금 도각 층만 남아 새 그림이 도각 층에 떨어지는 것 막음
- 불러온 DXF 층(b08-frame)과 층 id 갈라 둠
- 시험 test_m02_router_drawing 도각 원점 · 층 · 원본 양식 불변

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4uKaV4ZBhsJN4GHG7yRj4
This commit is contained in:
2026-10-06 17:52:13 +09:00
co-authored by Claude Opus 5.5
parent ffb851904c
commit ab39bcf986
5 changed files with 112 additions and 7 deletions
@@ -14,7 +14,10 @@ from fastapi.responses import JSONResponse
from B07_DesignDetail.B07_DesignDetail_Engine_Frame_Import import import_frame_file
from B07_DesignDetail.B07_DesignDetail_Engine_Template import (
entities_bbox,
frame_document,
frame_entities,
usable_bbox,
validate_template_entities,
)
from B07_DesignDetail.B07_DesignDetail_Router import title_block_fields
@@ -88,6 +91,45 @@ async def import_drawing_file(file: UploadFile = File(...)) -> JSONResponse:
)
# 얹은 도각 층 — 화면이 돌려줄 때 이 층을 통째로 뺌 · 불러온 DXF 층(`b08-frame`)과 갈라 둠
STRUCTURE_FRAME_LAYER = "m02-structure-frame"
def _on_frame_layer(entity: dict) -> dict:
children = entity.get("children")
return {
**entity,
"layerId": STRUCTURE_FRAME_LAYER,
**({"children": [_on_frame_layer(c) for c in children]} if children else {}),
}
def structure_frame() -> dict:
"""구조물 도면에 얹는 도각 — B07 시스템 양식 1:1 · 외곽 좌하단 (0,0) · 보여주기 층."""
placed = frame_entities("m02-structure", usable_bbox(), fit=False)
box = entities_bbox(placed)
if not box:
return {"entities": [], "layer": None}
ox, oy = box[0], box[1]
x0, y0, x1, y1 = usable_bbox()
entities = frame_entities("m02-structure", (x0 - ox, y0 - oy, x1 - ox, y1 - oy), fit=False)
return {
"entities": [_on_frame_layer(entity) for entity in entities],
"layer": {
"id": STRUCTURE_FRAME_LAYER,
"name": "도각(보기)",
"isVisible": True,
"isLocked": True,
},
}
@router.get("/structure-frame")
async def get_structure_frame() -> JSONResponse:
"""구조물 도면 상세 · 카드 미리보기가 얹는 도각(56장)."""
return JSONResponse({"status": "success", **structure_frame()})
@router.get("/drawing-fields")
async def get_drawing_fields(project_id: UUID | None = None) -> JSONResponse:
"""자리표 키 목록. project_id 를 주면 그 프로젝트의 표제란 값도 함께(미리보기용)."""