建立方向盘项目初始版本
This commit is contained in:
31
scripts/compose_kfl_125_switch60.py
Normal file
31
scripts/compose_kfl_125_switch60.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from PIL import Image, ImageChops, ImageDraw, ImageFont
|
||||
from pathlib import Path
|
||||
|
||||
out = Path(r'C:\projects\wheel\models\kfl_125_switch60_concept')
|
||||
font = r'C:\Windows\Fonts\msyh.ttc'
|
||||
title = ImageFont.truetype(font, 38)
|
||||
normal = ImageFont.truetype(font, 24)
|
||||
small = ImageFont.truetype(font, 21)
|
||||
im = Image.new('RGB', (1920, 1200), 'white')
|
||||
d = ImageDraw.Draw(im)
|
||||
d.text((40, 18), '125 mm 轴 · 开关及接线预留 60 mm', fill='#1a304d', font=title)
|
||||
d.text((40, 80), '轴 Ø12 × 125 mm;两端相同法兰;两块 8 mm 铝板,KFL001 反装', fill='#52657b', font=normal)
|
||||
d.rounded_rectangle((40, 123, 1880, 177), radius=8, fill='#fff0eb')
|
||||
d.text((55, 134), '概念示意:实际开关、轴承、接线和中心螺母未实测;不能认定实物可装', fill='#9b2b22', font=normal)
|
||||
|
||||
view = Image.open(out / 'side.png').convert('RGB').rotate(90, expand=True)
|
||||
mask = ImageChops.difference(view, Image.new('RGB', view.size, 'white')).convert('L').point(lambda p:255 if p>12 else 0)
|
||||
bounds = mask.getbbox()
|
||||
if bounds:
|
||||
view = view.crop(bounds)
|
||||
view.thumbnail((1760, 550))
|
||||
d.text((40, 196), '侧视:电机在左,方向盘侧在右', font=normal, fill='#243a55')
|
||||
im.paste(view, (80 + (1760-view.width)//2, 230 + (550-view.height)//2))
|
||||
d.line((40, 800, 1880, 800), fill='#d8e0e9', width=2)
|
||||
d.text((42, 819), '绿色:开关及接线 60 mm 包络占位;灰色 KFL 和中心 Ø47 孔为假设。', font=small, fill='#405b4a')
|
||||
d.text((42, 862), '电机侧不动;前轴承及前法兰前移 12 mm,轴和轴套前移 6 mm。', font=small, fill='#243a55')
|
||||
d.text((42, 905), '示意轴承中心距 76.5 mm,开关包络到两侧内圈各预留 1 mm;法兰与轴承座约 0.5 mm。', font=small, fill='#243a55')
|
||||
d.text((42, 948), '轴两端进入法兰各约 13.5 mm,轴端距法兰底盘内表面各 6.5 mm;键长与强度未知。', font=small, fill='#243a55')
|
||||
d.text((42, 991), '开关真实外形、白色拨片和接线弯曲、M3 中心螺母、KFL 凸起及工具空间尚未验证。', font=small, fill='#9b2b22')
|
||||
d.text((42, 1034), '60 mm 不是已验证的实物安全空间;以上间隙和尺寸仅限此假设模型。', font=small, fill='#9b2b22')
|
||||
im.save(out / '125mm轴_60mm开关_装配示意.png')
|
||||
Reference in New Issue
Block a user