diff --git a/data/verify_lining_output.txt b/data/verify_lining_output.txt new file mode 100644 index 0000000..97c75cc --- /dev/null +++ b/data/verify_lining_output.txt @@ -0,0 +1,20 @@ +[PASS] C1 fck 27 in all sheets: 6/6 sheets (표본 아님, 전수) +[PASS] C1 SD400 in all sheets: 6/6 sheets (표본 아님, 전수) +[PASS] C1 Ø25 in all sheets: 6/6 sheets (표본 아님, 전수) +[PASS] C1 R1 6.892 in all sheets: 6/6 sheets (표본 아님, 전수) +[PASS] C1 R2 3,712 in all sheets: 6/6 sheets (표본 아님, 전수) +[PASS] C1 R2' 3,910 in all sheets: 6/6 sheets (표본 아님, 전수) +[PASS] C1 EL -0.367 in all sheets: 6/6 sheets (표본 아님, 전수) +[PASS] C1 EL 0.000 in all sheets: 6/6 sheets (표본 아님, 전수) +[PASS] C2 온도미고려 detail sheets: 3 sheets: ['005', '006', '007'] (전수) +[PASS] C3 pattern-detail count = report rows: raw 9 vs report 9 (전수) +[PASS] C4 R1 6.982 in standard section (03-001 raw): 03-001 raw texts scanned: 322 +[PASS] C4b standard table DOC states R1 6,982: 설계_표준단면치수표 본문 대조 +[PASS] C4c report records decision: R1 결정 문구 존재 +[PASS] C5 thickness arithmetic: 7.282-6.982=0.3 m (matches 300 mm), 7.282-6.892=0.39 m (does not match) +[PASS] C6 file name pattern and version: name v0.1.00 vs header v0.1.00 +[PASS] C6b OUTPUT key items present: fck, SD400, 입출구부, 결정 문구 +[PASS] C7 meta lining_reference 9 groups: 9 groups, status=C0060304-004~009 | fck 27 MPa | SD400 | ... +[PASS] C7b meta open records decision: open[] 결정 문구 +[PASS] C8 no script writes into RAG: scanned 0 scripts +SUMMARY: 19 PASS / 0 FAIL of 19 diff --git a/scripts/build_skeleton.py b/scripts/build_skeleton.py index 6600909..22859df 100644 --- a/scripts/build_skeleton.py +++ b/scripts/build_skeleton.py @@ -192,7 +192,7 @@ meta = { "patterns": [{"from": a, "to": b, "pattern": pat} for a, b, pat, _ in ZONES], "open": ["4+700~4+745 and 5+480~5+500 excluded ([미확정])", "pattern zones (03-003~008) pending Task 5", "lining reference recorded (meta.lining_reference, 04-004~009); sheet-to-station mapping [미확정]", - "[CONFLICT DETECTED] lining sheets print R1=6.892 m, standard section R1=6,982 mm (model keeps 6.982) - user check"] + "[확정 2026-10-21] R1 6,982 mm 유지 (사용자 결정). 라이닝 도면 6장의 R1 6.892 m 표기는 확인 대상 오기로 기록", "pattern-group to excavation-pattern mapping: user explanation conflicts with filename (WL-4) - re-confirm [확인 필요]"] } _ls = json.load(open(f"{ROOT}/data/lining_spec.json", encoding="utf-8")) meta["lining_reference"] = { diff --git a/scripts/make_lining_doc.py b/scripts/make_lining_doc.py index 5aa95aa..739b6fb 100644 --- a/scripts/make_lining_doc.py +++ b/scripts/make_lining_doc.py @@ -32,7 +32,7 @@ lines += ["", "- 철근 라벨 개수는 도면 시트 단위 합계다 (패턴군별 분리 불가). 첫 행에만 표기했다.\n", "## 3. 공통 재료 사양 (6장 동일)", f"- 콘크리트: {conc} ({S[0]['concrete'][0]})", - f"- 철근: {rebar} ({S[0]['rebar_grade'][0]})", + f"- 철근: {rebar}, 도면 표기 SD400 ({S[0]['rebar_grade'][0]})", f"- 굵은골재 최대치수: Ø{agg} mm", "- 설계방법: 강도설계법, 피복두께 6 cm 이상 확보 (주기 1)", "- 이음장 600 mm (도면 치수), 겹침이음 1 cycle (도면 상세)", @@ -46,16 +46,15 @@ lines += ["", "- EL. 0.000 = 노면 기준 (계획고 F = 0.000 과 일치 기록)", "- EL. -0.367 = 아치 중심 높이 (골격의 중심 c = -0.367 m 와 일치)\n", "## 5. 충돌·미확정", - "- [CONFLICT DETECTED] 도면 R1 6.892 m 와 표준단면 R1 6.982 m 가 다르다. 골격은 6.982 m 를 유지하고 확인을 요청한다.", + "- [확정 2026-10-21, 사용자 결정] R1 = 6.982 m 유지. 도면의 6.892 m 표기는 확인 대상 오기로 기록한다.", "- [미확정] 시트별 패턴군이 어느 측점 구간인지 (도면에 측점 없음)", - "- [미확정] 라이닝 패턴군(A~C-2, D-1~2, E-1~2, WL-1~4, RP-1~2, P-2~3)과 굴착 순서도 패턴명(NP-4AD-1-D-2 등)의 대응 관계", + "- [확인 필요] 라이닝 패턴군(A~C-2, D-1~2, E-1~2, WL-1~4, RP-1~2, P-2~3)과 굴착 순서도 패턴명(NP-4AD-1-D-2 등)의 대응. 사용자는 파일명에 기록되어 있다고 답했다. 예시 풀이(NP-5BE-1-WL-4 = NP-5B 의 D-1·D-2)는 파일명 속 WL-4 및 시트 패턴군(WL-3~4)과 맞지 않아 재확인이 필요하다.", "- 재료표 수량(총 중량)은 이번 판독에서 추출하지 않았다. 필요하면 재료표 추출을 별도 Task로 한다.", "- 철근 배치는 골격 LOD 범위 밖이라 모델에 넣지 않았다 (사용자 승인 3D 상세 수준: 축선·표준단면 스윕 골격).", "- 설계 조건과 상이하면 구조해석 검토 후 철근 보강 가능 (주기 5, 시공 중 판단 대상)\n", "## 6. 확인 요청 (HITL)", - "1. R1 6.892 m 와 6.982 m 중 설계 기준값은 무엇인지", - "2. 라이닝 패턴군과 굴착 패턴명의 대응표가 있는지", - "3. 측점별 지보패턴 구간표가 확보되면 그 값으로 placeholder 구간을 교체할지", + "1. NP-5BE-1-WL-4 의 D-1·D-2 풀이가 맞는지, 아니면 WL-4 가 어느 라이닝 패턴군인지", + "2. 측점별 지보패턴 구간표가 확보되면 그 값으로 placeholder 구간을 교체할지", ""] open(OUT, "w", encoding="utf-8").write("\n".join(lines)) print("written", OUT, len(lines), "lines") diff --git a/scripts/verify_lining.py b/scripts/verify_lining.py new file mode 100644 index 0000000..84078e4 --- /dev/null +++ b/scripts/verify_lining.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python3 +"""Step 3 cross-check of the lining deliverables (Task 6). +Re-reads the raw DXF texts (04-004..009 and 03-001) with a plain text search, +independent of extract_lining_spec.py, and compares them with the report and +the model meta. Prints PASS/FAIL per check with population counts. +Usage: verify_lining.py +""" +import glob +import json +import os +import re +import sys + +import ezdxf +from ezdxf import recover + +RAG, DOC_LIN, DOC_STD, META = sys.argv[1:5] +RESULTS = [] + + +def check(name, ok, detail): + RESULTS.append((name, ok, detail)) + print(f"[{'PASS' if ok else 'FAIL'}] {name}: {detail}") + + +def all_texts(path): + try: + doc = ezdxf.readfile(path) + except Exception: + doc, _ = recover.readfile(path) + out = [] + for e in doc.modelspace(): + if e.dxftype() == "TEXT": + out.append(e.dxf.text) + elif e.dxftype() == "MTEXT": + out.append(e.plain_text()) + return out + + +sheets = sorted(glob.glob(os.path.join(RAG, "04_본선터널기타", "C0060304-00[4-9]*.dxf"))) +std = glob.glob(os.path.join(RAG, "03_본선터널굴착", "C0060303-001*.dxf")) +raw = {os.path.basename(p)[:14]: all_texts(p) for p in sheets} +doc_lin = open(DOC_LIN, encoding="utf-8").read() +doc_std = open(DOC_STD, encoding="utf-8").read() +meta = json.load(open(META, encoding="utf-8")) + +# C1 common values present in every sheet (population = 6 sheets) +common = {"fck=27MPa": "fck 27", "fy=400MPa": "SD400", "최대치수 Ø25": "Ø25", + "R1=6.892": "R1 6.892", "R2=3,712": "R2 3,712", "R2'=3,910": "R2' 3,910", + "EL.-0.367": "EL -0.367", "EL. 0.000": "EL 0.000"} +for token, label in common.items(): + hits = [k for k, t in raw.items() if any(token in s for s in t)] + check(f"C1 {label} in all sheets", len(hits) == len(raw), f"{len(hits)}/{len(raw)} sheets (표본 아님, 전수)") + +# C2 temperature-not-considered detail appears on 3 sheets (005, 006, 007) +temp = [k for k, t in raw.items() if any("온도미고려" in s for s in t)] +check("C2 온도미고려 detail sheets", sorted(temp) == sorted([k for k in raw if k[9:12] in ("005", "006", "007")]), + f"{len(temp)} sheets: {[k[9:12] for k in sorted(temp)]} (전수)") + +# C3 pattern-group count in raw texts equals report rows (9) +groups = [s for t in raw.values() for s in t if "패턴" in s and "주철근 조립도" in s or (("패턴)" in s) and ("입출구부" in s or "온도미고려" in s))] +rows = len([l for l in doc_lin.splitlines() if l.startswith("| C0060304-")]) +check("C3 pattern-detail count = report rows", len(groups) == rows, + f"raw {len(groups)} vs report {rows} (전수)") + +# C4 R1 cross-check against the standard section drawing and the report table +std_txt = all_texts(std[0]) if std else [] +std_has = any(("6.982" in s or "6982" in s or "6,982" in s) for s in std_txt) +check("C4 R1 6.982 in standard section (03-001 raw)", std_has, f"03-001 raw texts scanned: {len(std_txt)}") +check("C4b standard table DOC states R1 6,982", "6,982" in doc_std, "설계_표준단면치수표 본문 대조") +check("C4c report records decision", "6.982 m 유지" in doc_lin, "R1 결정 문구 존재") + +# C5 thickness arithmetic: outer R 7.282 m minus inner R +t982 = round(7.282 - 6.982, 3); t892 = round(7.282 - 6.892, 3) +check("C5 thickness arithmetic", t982 == 0.300 and t892 == 0.390, + f"7.282-6.982={t982} m (matches 300 mm), 7.282-6.892={t892} m (does not match)") + +# C6 V9 existence + name version + key content of OUTPUT +name = os.path.basename(DOC_LIN) +m = re.match(r"^설계_콘크리트라이닝상세_(\d{4}-\d{2}-\d{2})_v(\d+\.\d+\.\d{2})\.md$", name) +ver_hdr = re.search(r"\| (v\d+\.\d+\.\d{2}) \|", doc_lin) +check("C6 file name pattern and version", bool(m) and ver_hdr is not None and ver_hdr.group(1) == "v" + m.group(2), + f"name v{m.group(2) if m else '?'} vs header {ver_hdr.group(1) if ver_hdr else '?'}") +check("C6b OUTPUT key items present", all(k in doc_lin for k in ["fck", "SD400", "입출구부", "확정 2026-10-21"]), + "fck, SD400, 입출구부, 결정 문구") + +# C7 meta: lining reference and open items +lr = meta.get("lining_reference", {}) +check("C7 meta lining_reference 9 groups", sum(len(s["groups"]) for s in lr.get("sheets", [])) == 9, + f"{sum(len(s['groups']) for s in lr.get('sheets', []))} groups, status={lr.get('summary', '')[:40]}...") +check("C7b meta open records decision", any("확정 2026-10-21" in o for o in meta.get("open", [])), "open[] 결정 문구") + +# C8 scripts never write to the RAG source tree +writes = [] +for sc in glob.glob("scripts/*lining*.py"): + txt = open(sc, encoding="utf-8").read() + if re.search(r"open\([^)]*RAG[^)]*['\"]w", txt): + writes.append(sc) +check("C8 no script writes into RAG", not writes, f"scanned {len(glob.glob('scripts/*lining*.py'))} scripts") + +n_fail = sum(1 for r in RESULTS if not r[1]) +print(f"SUMMARY: {len(RESULTS) - n_fail} PASS / {n_fail} FAIL of {len(RESULTS)}")