fix(M02): 구조물·도면 빈 문서에 기본 도면층 채움

- Store.py create_structure · UI_Side.ts stubDoc(도면 양식 「새로」) 둘 다
  빈 CAD 문서에 기본 도면층 하나(id·name "기본") 넣음 — 없으면 sub1 이 고친
  CAD import 가드가 대신 채우지만 뿌리도 처음부터 채움
- 이미 만들어진 구조물 도면 49개(resources/master_template/structure/*.json)
  도면.layers 채움(한 번 도는 정리) — 다른 칸·도번은 그대로 · 줄바꿈도 그대로
- 시험(test_m02_structure.py) — 새 문서 layers 1개 확인으로 바꿈

검증: M02 시험 28개 · 루트 npm run typecheck 통과. ORCA 로 확인 —
빈 구조물 도면(rv) 오류 없이 열림 · 도면 양식 「새로」 빈 도면 오류 없이 열림 ·
실제 선 하나 넣어 저장 → 다시 열기 → 화면에 그대로 · [저장] 단추로도 저장됨
(검증 뒤 rv 는 원래 빈 문서로 되돌림 · 검증용 임시 양식은 지움).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EUypcnp5d1gU2aeKh9F2H7
This commit is contained in:
2026-09-27 20:16:46 +09:00
co-authored by Claude Sonnet 5
parent d53ef8d3bf
commit dd7300aa02
52 changed files with 457 additions and 53 deletions
@@ -24,6 +24,10 @@ STRUCTURE_TABLE = "구조물집계표"
_BASIS_HEAD = (("work", "공종"), ("spec", "규격"), ("detail", "산출 내역"), ("unit", "단위"))
_NUMBER = re.compile(r"^구-(\d+)$")
_BAD_NAME = re.compile(r'[\\/:*?"<>|\x00-\x1f]|\.\.')
# 도각 없는 빈 CAD 문서의 기본 도면층 — 없으면 B07 CAD 가 못 엶("Cannot read properties
# of undefined (reading 'length')") · CAD 쪽도 없으면 새로 채우지만(2026-09-27 sub1 고침)
# 뿌리도 처음부터 채움
_BLANK_LAYER = {"id": "기본", "name": "기본", "isVisible": True, "isLocked": False}
# ponytail: 저장은 한 번에 하나(프로세스 안 잠금) · 서버를 여럿 띄우면 파일 잠금으로
_LOCK = threading.Lock()
@@ -145,7 +149,7 @@ def create_structure(column: str) -> dict[str, Any]:
"판": 1,
"열": column,
"도번": f"구-{number:02d}",
"도면": {"format": 6, "entities": []},
"도면": {"format": 6, "entities": [], "layers": [dict(_BLANK_LAYER)]},
"산출근거": {"양식": "산출근거", "종류": "표", "판": 1, "열": basis, "줄": basis_rows},
}
atomic_write_json(path, doc)