Files
wheel/scripts/compose_kfl_double_crossbar.py

24 lines
1.9 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_double_crossbar_concept')
font=r'C:\Windows\Fonts\msyh.ttc'
def f(size):return ImageFont.truetype(font,size)
canvas=Image.new('RGB',(2400,1830),'#f4f6fa');d=ImageDraw.Draw(canvas)
d.text((70,35),'双横梁方案 · 轴承支撑总装示意',font=f(52),fill='#18283c')
d.text((73,112),'两块 76 × 80 × 8 mm 板;每块下方一根 2020 横梁,使用加长 L 角码直接连接',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+22,y+15),title,font=f(29),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,175),(1130,1100),'整机:电机、两只 KFL、开关及 150 mm 轴')
panel('frame.png',(1225,175),(1130,1100),'去掉电机与开关:查看双横梁和角码')
d.rounded_rectangle((45,1305,2355,1765),radius=18,fill='white',outline='#d9e0e9',width=2)
d.text((75,1328),'固定与调整方式',font=f(32),fill='#20344c')
rows=['① 每块轴承板下配一根横向 2020;横梁两端用普通角码固定在两根纵梁外侧。',
'② 每块板用 2 只加长金属 L 角码直接连接横梁;橙色为角码,不需要额外平连接片。',
'③ 板上横向长孔 + 角码竖向长孔用于同轴微调;横梁沿纵梁槽移动调整前后位置。',
'④ 加长角码按 45 × 20 × 18 × 3 mm 假设,长槽 9.5 × 5.5 mm;实物规格及工具空间待核对。',
'注:型材为实体外形示意,槽、螺母、真实折弯半径及开关细节未定;此图不能直接用于加工。']
for i,s in enumerate(rows): d.text((75,1390+i*67),s,font=f(25),fill='#9b4939' if i==4 else '#30445b')
canvas.save(O/'双横梁_3D装配示意.png')