"""Render a 2D overview of the generated STL plate using Pillow. The preview is only a placement guide; the STL is the printing artifact. """ from pathlib import Path import json, struct from PIL import Image, ImageDraw, ImageFont, ImageChops, ImageFilter root=Path(__file__).resolve().parent.parent out=root/'models'/'pcd50_print_plate' source=root/'models'/'pcd50_open_pillar_v1' info=json.loads((out/'布局检查.json').read_text(encoding='utf-8')) canvas=Image.new('RGB',(1220,1060),'#f7f9fc') d=ImageDraw.Draw(canvas) font_path='C:/Windows/Fonts/msyh.ttc' title=ImageFont.truetype(font_path,42) font=ImageFont.truetype(font_path,25) small=ImageFont.truetype(font_path,21) d.text((70,38),'一盘打印:支架 + 4 个 0.5 mm 垫片',font=title,fill='#1a2942') d.text((70,104),'俯视排版 · 模型保持原尺寸 · 单位:mm',font=font,fill='#52627b') scale=10.0; ox=250; oy=900 def xy(x,y): return (round(ox+x*scale),round(oy-y*scale)) def triangle_vertices(path): data=path.read_bytes() count=struct.unpack_from('