from PIL import Image,ImageDraw,ImageFont from pathlib import Path O=Path(r'C:\projects\wheel\models\kfl_double_crossbar_concept'); im=Image.new('RGB',(1700,1150),'white'); d=ImageDraw.Draw(im) def f(n):return ImageFont.truetype(r'C:\Windows\Fonts\msyh.ttc',n) def txt(x,y,s,n=28,c='#243349'):d.text((x,y),s,font=f(n),fill=c) txt(60,35,'加长 L 角码:选购规格示意',45);txt(62,100,'尺寸均为建模假设;确认实物、折弯圆角和孔位后再采购。',25) # front view of upright; pixel/mm = 11; bottom edge at 790, y 45 x0=170;y0=260;s=11 d.rectangle((x0,y0,x0+18*s,y0+45*s),fill='#f5a245',outline='#623c17',width=4) sx=x0+9*s;sy=y0+12*s;rad=2.75*s d.rounded_rectangle((sx-rad,sy-4.75*s,sx+rad,sy+4.75*s),radius=int(rad),fill='white',outline='#704214',width=3) txt(110,800,'正视:竖腿贴住铝板',25) d.line((x0+18*s+25,y0,x0+18*s+25,y0+45*s),fill='#335',width=2);txt(x0+18*s+35,460,'45',26) d.line((x0,y0-25,x0+18*s,y0-25),fill='#335',width=2);txt(x0+50,y0-65,'18',26) txt(440,315,'长槽 9.5 × 5.5',28);d.line((sx+30,sy,425,sy),fill='#335',width=2) txt(440,375,'槽中心距顶端 12',25);txt(440,420,'距折弯底端 33',25) # side diagram scale 10, cutaway L x=1040;y=260;s=10 d.rectangle((x,y,x+3*s,y+45*s),fill='#f5a245',outline='#623c17',width=3) d.rectangle((x,y+42*s,x+20*s,y+45*s),fill='#f5a245',outline='#623c17',width=3) d.line((x-25,y,x-25,y+45*s),fill='#335',width=2);txt(x-95,y+200,'45',26) d.line((x,y+45*s+28,x+20*s,y+45*s+28),fill='#335',width=2);txt(x+75,y+45*s+40,'20',26) txt(980,800,'侧视:两腿连续折弯;板厚 3',25) txt(60,900,'横梁侧:圆孔 Ø5.5,孔中心在 20 mm 腿长度中间。',27) txt(60,955,'铝板上对应水平槽,长槽交叉用于对中。示意未画真实折弯圆角。',27) txt(60,1010,'四只长角码;横梁两端另外各用一只普通角码。',27) im.save(O/'加长角码_尺寸假设.png')