import json, subprocess, sys, re F = r"D:\★Pier 자료\심수석님 검토 파일\검토_옥성교P1\옥성교P1.dxf" S = json.load(open('ok_shapes.json', encoding='utf-8')) T = json.load(open('ok_texts.json', encoding='utf-8')) cell = {} for e in S: cell.setdefault(e['mark'], (e['x'], e['y'])) rowy = {} for x, y, l, t, h in T: if l == 'CS-TABL-TEX2' and round(x) == 715129 and re.match(r'^[A-Z]{1,2}\d+$', t.strip()) and 324000 < y < 340000: rowy[t.strip()] = y jobs = [] for mk, (x, y) in cell.items(): jobs.append(('cell_%s' % mk, x - 2100, x + 3700, y - 450, y + 2700, 1500)) for mk, y in rowy.items(): jobs.append(('row_%s' % mk, 714300, 722400, y - 170, y + 190, 1700)) jobs.append(('row_head', 714300, 722400, 339950, 340520, 1700)) jobs.append(('um_detail', 649000, 662500, 318400, 326500, 1700)) jobs.append(('p3p4_ring', 732000, 736800, 331000, 333300, 1400)) for name, x0, x1, y0, y1, w in jobs: h = int((y1 - y0) / (x1 - x0) * w) subprocess.run([sys.executable, '-I', 'fastrender.py', F, str(x0), str(x1), str(y0), str(y1), 'ok_crops/%s.png' % name, str(w), 'dark'], check=True) print(len(jobs))