- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환 - Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용 - pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관) - worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md) - D:\Rhino-MCP 경로 참조를 새 위치로 치환 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
42 lines
1.8 KiB
Python
42 lines
1.8 KiB
Python
"""Region image of a converted drawing (DXF) for the "도면 보기" links of the candidate tables (stage C, 2026-10-19).
|
|
|
|
The same drawing code as the reading aid Code/울산P1판독/dxftools.render, parameterised by a DXF path. Entities that touch the region are drawn
|
|
black on white; Korean text shows as boxes (no font mapping), numbers are readable.
|
|
"""
|
|
import ezdxf
|
|
from ezdxf import bbox
|
|
|
|
|
|
def _in_region(e, x0, y0, x1, y1):
|
|
try:
|
|
b = bbox.extents([e], fast=True)
|
|
except Exception:
|
|
return False
|
|
return b.has_data and b.extmax.x >= x0 and b.extmin.x <= x1 and b.extmax.y >= y0 and b.extmin.y <= y1
|
|
|
|
|
|
def render(dxf_path, cx, cy, half, out_png, px=1400, mark=True):
|
|
"""PNG of the square [cx-half, cx+half] x [cy-half, cy+half]; a ring marks the point (cx, cy)."""
|
|
import matplotlib
|
|
matplotlib.use("Agg")
|
|
import matplotlib.pyplot as plt
|
|
from ezdxf.addons.drawing import Frontend, RenderContext
|
|
from ezdxf.addons.drawing.config import BackgroundPolicy, ColorPolicy, Configuration
|
|
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend
|
|
doc = ezdxf.readfile(dxf_path)
|
|
x0, x1, y0, y1 = cx - half, cx + half, cy - half, cy + half
|
|
keep = [e for e in doc.modelspace() if _in_region(e, x0, y0, x1, y1)]
|
|
fig = plt.figure(figsize=(px / 100, px / 100), dpi=100)
|
|
ax = fig.add_axes([0, 0, 1, 1])
|
|
cfg = Configuration(background_policy=BackgroundPolicy.WHITE, color_policy=ColorPolicy.BLACK)
|
|
Frontend(RenderContext(doc), MatplotlibBackend(ax), config=cfg).draw_entities(keep)
|
|
if mark:
|
|
ax.add_patch(plt.Circle((cx, cy), half * 0.04, fill=False, color="red", linewidth=2))
|
|
ax.set_xlim(x0, x1)
|
|
ax.set_ylim(y0, y1)
|
|
ax.set_aspect("equal")
|
|
ax.axis("off")
|
|
fig.savefig(out_png, facecolor="white")
|
|
plt.close(fig)
|
|
return out_png
|