- M02 종류별 탭 [종류 더하기] = 본보기(구조물 정본 원본) 복사 — 키 자동 · 이름 「본보기 2」 · 옵션 · 표시 · 그룹 · 배치 · 규칙 · 종류 덧칸 · 반영 그대로 · 종류.{새}.본보기 · 관 지점 종류 · 복사본은 본보기 밖
- 구조물 표 = 본보기 처음값 이어받음(resolveCatalog · resolve_catalog 짝 · 줄 칸 base) · baseType/base_type · specFor(명세) · 덧단 · 길이 전후 풀기 · 옹벽 추가 단 콘크리트
- 검사(화면 = 서버 짝) — 본보기 = 원본 · 같은 군 · 자리꼴 · 정본 · 만든 뒤 고정 · 복사본은 본보기가 숨긴 칸 이어받음 · 서버 덧칸 본보기 받음
- 특수 동작 = 동작 이름 — 바로 안 놓기 · 포장 나누기 = 포장_물넘이_겹침 · 월류 높이 기다림 = 월류단면
- 정본 목록 = 표 — 파이썬 관 지점 종류 = catalog owner · B05 시설 서브폼 = 표 형상 · 안 쓰는 손 목록 걷음
- drawing_views — 스키마에서 빼고 읽을 때 버림 · M02 [저장] 때 빠짐(코드는 마스터 안 고침)
- 이관 = 지난 판 이름 대신 측점 계획 자리(planted)로 가름 · all_type_names 걷음
- 허용 거리 = common_util_structure_station.py 한 곳(SAME_STATION_M · EDGE_TOLERANCE_M · PIPE_MATCH_M) · TS 표는 station.ts 머리
- 시험: test_323_7_new_type(템플릿 · 일곱 갈래 · 그림 · 검사 짝 · 서버 읽기) · 322-0 유령 시험 = 자리 · 옛 도움 파일 동작 · 표 길 · 기대 글 고침
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
137 lines
4.8 KiB
Python
137 lines
4.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""178-3 사면안정 흙막이 · 옹벽 「추가 단」 상자 → 여러 단 횡단 형상.
|
|
|
|
못박는 것
|
|
- 상자 = 유출 흙막이 상자 양식(공용 [추가] · [빼기]) · 흙막이 = 형태 · 높이 · 옹벽 = 높이만 · 키 `tier_{n}_*`.
|
|
- 명세 저장 왕복 그대로 · 빈 상자도 한 단으로 남음 · 정의 그룹 종류 그대로(`STRUCTURE_SPECS` 에 안 넣음).
|
|
- 서버 저장(structures.json) → 벽 제원(파이썬) 단 수 = 1 + 상자 수 · 단마다 형태 · 높이 · 옹벽 단 = 콘크리트.
|
|
- 횡단 형상(진짜 `computeRevetmentLayout`) — 단 수 · 단마다 형태 · 높이(빈 값 = 본 벽 형태 · 1.5 m) · 옛 `tiers` 그대로.
|
|
|
|
Node 헬퍼 `helper_178_3_slope_tiers.cjs`. 화면은 사용자 확인.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
from B05_Profile.B05_Profile_Structures_Schema import StructureInstance
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
ROOT = os.path.abspath(os.path.join(HERE, "..", ".."))
|
|
|
|
SOIL = {
|
|
"form": "돌쌓기(찰)",
|
|
"length_m": 20,
|
|
"height_m": 2,
|
|
"before_m": 10,
|
|
"after_m": 10,
|
|
"tier_1_form": "콘크리트",
|
|
"tier_1_height": 2,
|
|
"tier_2_form": "돌망태",
|
|
"tier_2_height": 1.2,
|
|
}
|
|
|
|
|
|
def _read(*parts: str) -> str:
|
|
with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle:
|
|
return handle.read()
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_178_3_slope_tiers.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_상자_칸_흙막이_형태_높이_옹벽_높이(out):
|
|
assert out["roundTrip"]["items"] == {
|
|
"soil_guard": ["form", "height"],
|
|
"retaining_wall": ["height"],
|
|
}
|
|
assert out["roundTrip"]["notMainSpecs"] == []
|
|
|
|
|
|
def test_명세_저장_왕복(out):
|
|
trip = out["roundTrip"]
|
|
assert trip["soilState"] == [
|
|
{"form": "콘크리트", "height": "2"},
|
|
{"form": "돌망태", "height": "1.2"},
|
|
]
|
|
assert trip["soilBack"] == {
|
|
"tier_1_form": "콘크리트",
|
|
"tier_1_height": 2,
|
|
"tier_2_form": "돌망태",
|
|
"tier_2_height": 1.2,
|
|
}
|
|
assert trip["wallBack"] == {"tier_1_height": 1.8}
|
|
assert trip["emptyBox"] == {"tier_1_form": ""} # 값 없이 추가만 해도 단 하나
|
|
|
|
|
|
def test_서버_저장_뒤_벽_제원(tmp_path):
|
|
from B05_Profile.B05_Profile_Structures_Repository import save_structures
|
|
from B06_Section import B06_Section_Engine_Structures_Wall as wall
|
|
|
|
items = [
|
|
StructureInstance(
|
|
type_id="soil_guard",
|
|
placement="interval",
|
|
chainage_m=180,
|
|
start_m=170,
|
|
end_m=190,
|
|
options=SOIL,
|
|
),
|
|
StructureInstance(
|
|
type_id="retaining_wall",
|
|
placement="interval",
|
|
chainage_m=300,
|
|
start_m=290,
|
|
end_m=310,
|
|
options={"height_m": 2.5, "tier_1_height": 1.8},
|
|
),
|
|
]
|
|
save_structures(str(tmp_path), items, base_revision=0)
|
|
got = {spec["type_id"]: spec for spec in wall.load_wall_structures(tmp_path)}
|
|
assert got["soil_guard"]["tiers"] == 3
|
|
assert got["soil_guard"]["extras"] == [
|
|
{"form": "콘크리트", "height_m": 2},
|
|
{"form": "돌망태", "height_m": 1.2},
|
|
]
|
|
assert got["retaining_wall"]["tiers"] == 2
|
|
assert got["retaining_wall"]["extras"] == [{"form": "콘크리트", "height_m": 1.8}]
|
|
|
|
|
|
def test_횡단_형상_단_수_단마다_형태_높이(out):
|
|
assert out["soil2"]["requested"] == 3
|
|
assert out["soil2"]["walls"] == [
|
|
{"form": "돌쌓기(찰)", "pure": 2},
|
|
{"form": "콘크리트", "pure": 2},
|
|
{"form": "돌망태", "pure": 1.2},
|
|
]
|
|
assert out["wall1"]["walls"] == [
|
|
{"form": "콘크리트", "pure": 2.5},
|
|
{"form": "콘크리트", "pure": 1.8},
|
|
]
|
|
# 빈 상자 = 본 벽 형태 · 기본 1.5 m · 상자 없으면 옛 tiers 그대로 · 둘 다 없으면 1단
|
|
assert out["emptyBox"]["walls"][1] == {"form": "돌망태", "pure": 1.5}
|
|
assert out["legacy"]["requested"] == 2 and out["legacy"]["extras"] == []
|
|
assert out["none"]["requested"] == 1
|
|
|
|
|
|
def test_배선():
|
|
spec = _read("B05_Profile", "B05_Profile_UI_Structures_Spec.ts")
|
|
# 명세 · 덧붙이 명세 = 본보기 키로(323-7 · 복사한 종류도 같은 상자)
|
|
assert "specFor(type.type_id) ?? ADDON_SPECS[baseType(type.type_id)]" in spec
|
|
walls = _read("common_util", "common_util_structure_walls.ts")
|
|
assert "파이썬 `tier_extras` 짝" in walls
|
|
engine = _read("B06_Section", "B06_Section_Engine_Structures_Wall.py")
|
|
assert "TS `tierExtras` 짝" in engine
|