"""Ramp-A P1: convert copies of RAG/Ramp-A교 P1 교각(1..4).dwg to DXF (Code/RampA판독/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("Ramp-A교 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))