"""Okseong P1: convert a copy of RAG/옥성교P1.dwg to DXF (Code/옥성P1판독/dxf) and index texts. Uses the app reader (sources are copied before conversion and never touched). Labels D1..D4 by file order.""" import json import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[2] sys.path.insert(0, str(ROOT / "Code" / "교각모델링앱")) from engine import reader # noqa: E402 OUT = Path(__file__).resolve().parent / "dxf" dwgs = sorted((ROOT / "RAG").glob("옥성교P1.dwg")) audit = reader.convert(dwgs, OUT) labels = [f"D{i}" for i in range(1, len(audit) + 1)] for a, lab in zip(audit, labels): a["label"] = lab (OUT / "audit.json").write_text(json.dumps(audit, ensure_ascii=False, indent=1), encoding="utf-8") texts = reader.build_index([OUT / a["dxf"] for a in audit], labels, OUT / "texts.json") print(json.dumps(audit, ensure_ascii=False, indent=1)) print("texts", len(texts))