main
John Lauer Save native two-sided contact artwork and recorded GLB material correction; qualification remains open 57e2489
#!/usr/bin/env python3
"""Engineering plan view; text boxes are native glyph envelopes, not rendered ink."""
import json
from pathlib import Path
import matplotlib;matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
ROOT=Path(__file__).resolve().parents[1];P=ROOT/'design/silkscreen-review'
s=json.loads((P/'bottom-candidates.json').read_text());l=json.loads((P/'bottom-layout.json').read_text())
fig,ax=plt.subplots(figsize=(10,11));ax.set_facecolor('#13282b')
for o in s['obstacles']:
 b=o['box'];ax.add_patch(Rectangle((b[0],b[1]),b[2]-b[0],b[3]-b[1],color='#ff765e' if o['kind']=='association-target' else '#748787',alpha=.7))
for g in l['placements']:
 if g.get('unresolved'):continue
 for c in g['children']:
  b=c['box'];ax.add_patch(Rectangle((b[0],b[1]),b[2]-b[0],b[3]-b[1],edgecolor='#6acaca',facecolor='none',lw=.4));ax.text(c['x'],c['y'],c['text'],ha='center',va='center',fontsize=5,rotation=-c.get('angle',0),color='white')
if (P/'bottom-leaders.json').exists():
 for g in json.loads((P/'bottom-leaders.json').read_text())['leaders']:
  x,y=zip(*g['points']);ax.plot(x,y,color='#ffcb64',lw=.8)
x,y,X,Y=s['bounds'];ax.set_xlim(X+1,x-1);ax.set_ylim(Y+1,y-1);ax.set_aspect('equal');ax.set_title('Bottom inspection • proposed labels, native glyph envelopes\nMirrored viewing coordinates; not native artwork acceptance')
fig.savefig(P/'bottom-plan.png',dpi=180,bbox_inches='tight');print(P/'bottom-plan.png')