Files
wheel/scripts/compose_kfl_3030.py

23 lines
1.8 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from PIL import Image,ImageDraw,ImageFont
from pathlib import Path
O=Path(r'C:\projects\wheel\models\kfl_3030_concept')
font=r'C:\Windows\Fonts\msyh.ttc'
def f(s): return ImageFont.truetype(font,s)
canvas=Image.new('RGB',(2400,1740),'#f4f6fa');d=ImageDraw.Draw(canvas)
d.text((70,35),'3030 底座 · 双横梁轴承支撑示意',font=f(50),fill='#18283c')
d.text((70,108),'两块 76 × 80 × 8 mm 板;每块板采用两只 50 × 31 × 19 × 3 mm 长孔角码',font=f(27),fill='#3e5065')
def panel(name,xy,wh,title):
x,y=xy;w,h=wh;d.rounded_rectangle((x,y,x+w,y+h),radius=18,fill='white',outline='#d9e0e9',width=2);d.text((x+20,y+15),title,font=f(28),fill='#20344c')
img=Image.open(O/name).convert('RGB');img.thumbnail((w-28,h-70));canvas.paste(img,(x+(w-img.width)//2,y+58))
panel('assembly.png',(45,165),(1130,1060),'总装:电机、两只轴承、开关空间与 150 mm 轴')
panel('frame.png',(1225,165),(1130,1060),'隐藏电机和开关,查看两根横梁与角码')
d.rounded_rectangle((45,1255,2355,1690),radius=18,fill='white',outline='#d9e0e9',width=2)
d.text((75,1275),'布置与检查范围',font=f(32),fill='#20344c')
rows=['① 底座纵梁、横梁均为 3030;两根横梁夹在纵梁之间并比纵梁低 2 mm,橙色为角码。',
'② 角码的 50 mm 边接板,31 mm 边接横梁;短槽位置按居中假设,实物需核对。',
'③ 灯光开关绿色部分是尺寸包络,未建真实插头、线材和拨杆;型材槽及 T 型螺母未画出。',
'④ 电机侧原有 2020 型材保留,它与底座 3030 的实际连接件未设计,需后续补充。',
'注:此图用于讨论,轴承、螺丝工具空间、型材槽及实际开关均须实物核对,不能直接加工。']
for i,s in enumerate(rows): d.text((75,1338+i*63),s,font=f(25),fill='#9b4939' if i>=3 else '#30445b')
canvas.save(O/'3030底座_双横梁装配示意.png')