refactor(511-B B-4 기본 설계 셋 Node · preview 걷음): run_calc = 늘 떠 있는 Node(못 띄우면 새 프로세스) · 기본 설계 셋(체인 · 노선 저장 이월 · [측점 만들기] · GET 빈 측점 · B05 확정 측구 방향 역반영) = 측점 묶음 Node cross.design 한 번 · 포장 · 기울임 · 세월교 하강 = TS facilityRanges(cross.design facilities · Node 못 부르면 파이썬 구간 짝) · /cross-design/preview 걷음(창구 · 스키마 · recompute_designs_for_alignment · 화면 refreshFromServer) · crossOptions = logic/B06_Section_Cross_Save.ts(다음 단계 [저장] 횡단 한 바퀴 짝 · 아직 안 부름) · 시험 266 · 475_3 · masshaul_single_source 기대 맞춤 — 요구 320-4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 14:18:09 +09:00
co-authored by Claude Opus 5.5
parent f6abe881a2
commit f40ff98819
14 changed files with 496 additions and 543 deletions
+61 -6
View File
@@ -52,10 +52,59 @@ def _python(job: DesignJob, standard: dict[str, Any] | None) -> dict[str, Any] |
return None
# 시설 구간(포장 · 기울임 · 세월교 하강) = TS `facilityRanges` — (프로젝트 뿌리, 측점 누가거리)
Facilities = tuple[Path, list[float]]
def facility_inputs(project_root: Path) -> dict[str, list[dict[str, Any]]]:
"""TS `facilityRanges` 입력 — 관 = 지금 노선에 얹은 관 지점(`route_pipe_points`) · 구조물 정본.
못 읽은 쪽은 빈 목록(파이썬 `pavement_ranges` · `ford_surface_drops` 의 비치명 태도 그대로)."""
from dataclasses import asdict
from B05_Profile.B05_Profile_Engine_Sections import route_pipe_points
from B05_Profile.B05_Profile_Structures_Repository import load_structures
try:
pipes = [asdict(point) for point in route_pipe_points(project_root)]
except Exception: # noqa: BLE001 — 정본을 못 읽어도 설계 계산은 이어 간다
logger.exception("B06 관 지점을 읽지 못했습니다 (시설 구간 없음으로 본다)")
pipes = []
try:
structures = [s.model_dump(mode="json") for s in load_structures(str(project_root))[1]]
except Exception: # noqa: BLE001
logger.exception("B06 구조물 정본을 읽지 못했습니다 (포장 · 맹암거 구간 없음으로 본다)")
structures = []
return {"pipes": pipes, "structures": structures}
def _python_facility(root: Path) -> Any:
"""Node 를 못 부를 때 — 파이썬 구간 짝(`Router_Design_Ranges` · `Engine_Tilt`)."""
from B06_Section.B06_Section_Engine_Tilt import tilt_args, tilt_ranges
from B06_Section.B06_Section_Router_Design_Ranges import (
ford_drop_at,
ford_surface_drops,
paved_at,
pavement_ranges,
)
paved, tilts, drops = pavement_ranges(root), tilt_ranges(root), ford_surface_drops(root)
return lambda c: {
"paved": paved_at(c, paved),
"surface_drop_m": ford_drop_at(c, drops),
**tilt_args(c, tilts),
}
def compute_cross_designs(
jobs: list[DesignJob], standard: dict[str, Any] | None
jobs: list[DesignJob],
standard: dict[str, Any] | None,
facilities: Facilities | None = None,
) -> list[dict[str, Any] | None]:
"""측점 묶음 횡단 설계 — 차례 그대로 결과 · None = 못 세움(파이썬 ValueError 자리)."""
"""측점 묶음 횡단 설계 — 차례 그대로 결과 · None = 못 세움(파이썬 ValueError 자리).
`facilities` = (뿌리, 누가거리) 면 포장 · 기울임 · 세월교 하강을 TS 구간이 측점마다 얹음
(511-B B-4 · C3)."""
if not jobs:
return []
stations = [
@@ -69,12 +118,18 @@ def compute_cross_designs(
}
for samples, elevation, options in jobs
]
results = run_calc(
["cross.design"],
{"cross_design": {"standard": full_standard(standard), "stations": stations}},
)
batch: dict[str, Any] = {"standard": full_standard(standard), "stations": stations}
if facilities is not None:
root, chainages = facilities
batch["facilities"] = facility_inputs(root)
for station, chainage in zip(stations, chainages, strict=True):
station["chainage_m"] = chainage
results = run_calc(["cross.design"], {"cross_design": batch})
if results is None:
logger.warning("Node 횡단 설계 실패 — 파이썬 짝으로 셈(%d 측점)", len(jobs))
if facilities is not None:
at = _python_facility(facilities[0])
jobs = [(s, z, {**o, **at(c)}) for (s, z, o), c in zip(jobs, facilities[1])]
return [_python(job, standard) for job in jobs]
return [None if "error" in row else row for row in results["cross.design"]]