feat(B05·B06·B08): 관 보호공 유입 흙막이 빈 칸 기본 높이 관경 + 0.7 m(유출 · 집수정 0.5 그대로)(211-1)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018jonfdxn1Xit9bdkNJpE4G
This commit is contained in:
2026-10-10 15:17:40 +09:00
co-authored by Claude Sonnet 5.5
parent 2feb1b23cf
commit 0c729d656a
9 changed files with 298 additions and 35 deletions
+25 -11
View File
@@ -51,12 +51,15 @@ export const BOX_COVER_M = 0.5;
export const REVET_HEIGHT_STEP_M = 0.1;
export const REVET_EMBED_DEPTH_M = 0.5;
export const OLD_PIPE_WALL_DEFAULT_M = 1.5;
/** 관 보호공 유입 흙막이 빈 칸 기본 = 관경(올림) + 0.7(211-1) — 유출 · 집수정은 근입 0.5 그대로. */
export const INLET_REVET_ADD_M = 0.7;
/** 관 벽 순수 높이(근입 포함) 기본값 — 파이썬 `pipe_wall_min_height_m`. */
export function pipeWallMinHeightM(diameterM: number): number {
/** 관 벽 순수 높이(근입 포함) 기본값 — 파이썬 `pipe_wall_min_height_m`. `side="inlet"` = + 0.7. */
export function pipeWallMinHeightM(diameterM: number, side = ""): number {
const raw = diameterM;
const steps = Math.ceil(raw / REVET_HEIGHT_STEP_M - 1e-9);
return round(steps * REVET_HEIGHT_STEP_M + REVET_EMBED_DEPTH_M, 3);
const add = side === "inlet" ? INLET_REVET_ADD_M : REVET_EMBED_DEPTH_M;
return round(steps * REVET_HEIGHT_STEP_M + add, 3);
}
/** 관 벽 · 유입 집수정 높이 칸 읽기 — 옛 기본 1.5 이고 관경 > 1.0 이면 관경 기준 값(139-1) ·
@@ -71,7 +74,8 @@ export function pipeWallHeightM(stored: number | null, diameterM: number): numbe
return stored;
}
/** 관 보호공 · 유입 집수정 높이 칸 — 새 관 기본 = 관경 + 0.5(139-1 · 서버 짝 `PIPE_HEIGHT_KEYS`). */
/** 관 보호공 · 유입 집수정 높이 칸 — 새 관 기본 = 관경 + 0.5(139-1) · 유입 흙막이만 + 0.7(211-1)
* (서버 짝 `PIPE_HEIGHT_KEYS`). */
export const PIPE_HEIGHT_KEYS = [
"inlet_revet_height_m",
"outlet_revet_height_m",
@@ -86,12 +90,14 @@ export function fillPipeHeights(
const diameterM = Number(values.pipe_diameter_mm) / 1000;
if (!(diameterM > 0)) return;
for (const key of PIPE_HEIGHT_KEYS)
if (keys.includes(key)) values[key] ??= pipeWallMinHeightM(diameterM);
if (keys.includes(key))
values[key] ??= pipeWallMinHeightM(diameterM, key === "inlet_revet_height_m" ? "inlet" : "");
}
/** 배관 관 보호공 높이 칸(유입 · 유출 · 유입 집수정 = 항목 `height`) — 관경 + 0.5 규칙(139-1).
/** 배관 관 보호공 높이 칸(유입 · 유출 · 유입 집수정 = 항목 `height`) — 관경 + 0.5 규칙(139-1) ·
* 유입 흙막이 + 0.7(211-1).
* `previousMm` 없음 = 읽을 때(옛 1.5 · 관경 > 1.0 옮김) · 있음 = 관경을 바꿈(옛 관경 규칙 값 · 옛 1.5
* 칸만 새 규칙 값으로 · 손 값 · 빈 칸은 그대로). */
* 칸만 새 규칙 값으로 · 손 값 · 빈 칸은 그대로 · 유입은 옛 + 0.5 값도 새 + 0.7 로 따라감). */
export function followPipeHeights(
state: Record<string, Array<Record<string, string>> | undefined>,
diameterMm: string,
@@ -99,7 +105,13 @@ export function followPipeHeights(
): void {
const d = Number(diameterMm) / 1000;
if (!(d > 0)) return;
const prev = previousMm ? pipeWallMinHeightM(Number(previousMm) / 1000) : null;
const prevOf = (id: string): Array<number | null> => {
if (!previousMm) return [];
const p = Number(previousMm) / 1000;
return id === "inlet"
? [pipeWallMinHeightM(p, id), pipeWallMinHeightM(p)]
: [pipeWallMinHeightM(p)];
};
for (const id of ["inlet", "outlet"]) {
const values = state[id]?.[0];
const raw = values?.height ?? "";
@@ -108,8 +120,10 @@ export function followPipeHeights(
const moved =
previousMm === undefined
? pipeWallHeightM(now, d)
: [prev, OLD_PIPE_WALL_DEFAULT_M].some((v) => v !== null && Math.abs(now - v) < 1e-9)
? pipeWallMinHeightM(d)
: [...prevOf(id), OLD_PIPE_WALL_DEFAULT_M].some(
(v) => v !== null && Math.abs(now - v) < 1e-9,
)
? pipeWallMinHeightM(d, id)
: now;
if (moved !== null && moved !== now) values.height = String(moved);
}
@@ -170,7 +184,7 @@ function sideSpec(
const height =
pipeWallHeightM(num(options[`${side}_revet_height_m`], null), diameterM) ??
pipeWallMinHeightM(diameterM);
pipeWallMinHeightM(diameterM, side);
const length = num(options[`${side}_revet_length_m`], null);
const form = text(options[`${side}_revet_form`]);
const before = num(options[`${side}_revet_before_m`], null);