"""Ramp-A P3-1 갈고리 수정 전(수정5, 도면 r135·70°)·후(수정6, P3 각도) 비교 증거 이미지. 입력: 결과/캡처/hookB_p31(수정5), hookC_p31(수정6) + _capture.json (c1_hookcap.py 로 생성). 출력: 검토파일/수정후_캡처/RampA_P3-1_갈고리_수정전후.png""" import json from pathlib import Path from PIL import Image, ImageDraw, ImageFont ROOT = Path(r"D:\★Pier 자료\프로그램\Pier_T") CAP = ROOT / "Code" / "검토수정" / "결과" / "캡처" OUT = ROOT / "검토파일" / "수정후_캡처" FONT = r"C:\Windows\Fonts\malgun.ttf" FONTB = r"C:\Windows\Fonts\malgunbd.ttf" F = lambda s, b=False: ImageFont.truetype(FONTB if b else FONT, s) def panel(key, head, color, note): cj = json.loads((CAP / ("%s_capture.json" % key)).read_text(encoding="utf-8")) img = Image.open(CAP / ("%s.png" % key)).convert("RGB") d = ImageDraw.Draw(img) P = {k: tuple(v) for k, v in cj["px"].items()} cx, cy = P["center"] for k in ("arc_start", "arc_end"): d.line([(cx, cy), P[k]], fill=(200, 0, 200), width=3) d.ellipse([cx - 7, cy - 7, cx + 7, cy + 7], fill=(255, 255, 0), outline=(0, 0, 0)) for k in ("arc_start", "arc_end", "tail_end"): x, y = P[k] d.ellipse([x - 7, y - 7, x + 7, y + 7], outline=(0, 0, 0), fill=(255, 140, 0)) lines = ["r = %.2f" % cj["radius"], "호 각도 = %.2f° → 호 길이 c = %.1f" % (cj["angle_deg"], cj["arc_len"]), "곧은 구간 d = %.1f" % cj["tail_len"]] y = 14 for t in lines: w = d.textlength(t, font=F(30, True)) d.rectangle([12, y - 4, 12 + w + 16, y + 38], fill=(255, 255, 255)) d.text((20, y), t, font=F(30, True), fill=(0, 100, 0)) y += 46 img = img.resize((750, int(img.height * 750 / img.width))) banner = Image.new("RGB", (750, 62), color) ImageDraw.Draw(banner).text((10, 10), head, font=F(30, True), fill=(255, 255, 255)) foot = Image.new("RGB", (750, 74), (246, 246, 246)) ImageDraw.Draw(foot).text((10, 8), note[0], font=F(20), fill=(20, 20, 20)) ImageDraw.Draw(foot).text((10, 38), note[1], font=F(20), fill=(20, 20, 20)) out = Image.new("RGB", (750, 62 + img.height + 74), (255, 255, 255)) out.paste(banner, (0, 0)); out.paste(img, (0, 62)); out.paste(foot, (0, 62 + img.height)) return out a = panel("hookB_p31", "수정 전 (수정5): 도면 r135 · c165 · d150", (170, 40, 30), ("호 70.03° → 곧은 구간이 바깥(아래 오른쪽)으로 뻗음", "말뚝 밖으로 나감 (PL01 26본 중심 밖, PL02 22본 표면 돌출)")) b = panel("hookC_p31", "수정 후 (수정6): P3 각도 적용", (30, 120, 60), ("호 134.65°(P3와 같음) → 곧은 구간이 안쪽(아래 왼쪽)으로 되돌아옴", "말뚝 안 (PL01 중심 피복 최소 36.4, PL02 최소 111.4)")) H = max(a.height, b.height) W = a.width + b.width + 12 top = Image.new("RGB", (W, 120), (40, 40, 40)) ImageDraw.Draw(top).text((14, 8), "Ramp-A교 P3-1 갈고리 — 수정 전·후 (Rhino 캡처, 철근 1본 확대, 말뚝 표시)", font=F(36, True), fill=(255, 255, 255)) ImageDraw.Draw(top).text((14, 62), "사용자 의견(2026-10-27): 도면 r135 의 각도가 이상해 보임 → 철근은 P3 각도(134.65°)를 따름. C 곡선 165, D 150 유지 → r 70.21", font=F(24), fill=(255, 255, 255)) out = Image.new("RGB", (W, 120 + H), (255, 255, 255)) out.paste(top, (0, 0)); out.paste(a, (0, 120)); out.paste(b, (a.width + 12, 120)) p = OUT / "RampA_P3-1_갈고리_수정전후.png" out.save(p) print(p.name, out.size)