建立方向盘项目初始版本
This commit is contained in:
27
scripts/compose_kfl_plate_adjust_concept.py
Normal file
27
scripts/compose_kfl_plate_adjust_concept.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from PIL import Image, ImageChops, ImageDraw, ImageFont
|
||||
from pathlib import Path
|
||||
out=Path(r'C:\projects\wheel\models\kfl_plate_adjust_concept')
|
||||
F=r'C:\Windows\Fonts\msyh.ttc'; title=ImageFont.truetype(F,38); mid=ImageFont.truetype(F,24); small=ImageFont.truetype(F,22)
|
||||
im=Image.new('RGB',(1920,1200),'white');d=ImageDraw.Draw(im)
|
||||
d.text((40,18),'KFL001 反装 · 8 mm 轴承板及对中调整',font=title,fill='#1a304d')
|
||||
d.text((40,75),'Ø12 × 150 mm 轴;两侧 2020 型材;灯光开关及接线 60 mm 包络',font=mid,fill='#52657b')
|
||||
d.rounded_rectangle((40,116,1880,167),radius=8,fill='#fff0eb');d.text((52,126),'概念图:轴承径向凸起、铝板孔、开关外形和五金规格需核实,不可用于 CNC',font=mid,fill='#9b2b22')
|
||||
def panel(filename,x,y,w,h,angle=0):
|
||||
image=Image.open(out/filename).convert('RGB')
|
||||
if angle:image=image.rotate(angle,expand=True)
|
||||
bg=Image.new('RGB',image.size,'white'); mask=ImageChops.difference(image,bg).convert('L').point(lambda p:255 if p>12 else 0); bounds=mask.getbbox()
|
||||
if bounds:image=image.crop(bounds)
|
||||
image.thumbnail((w,h));im.paste(image,(x+(w-image.width)//2,y+(h-image.height)//2))
|
||||
d.text((40,186),'总装(电机在左,方向盘侧在右)',font=mid,fill='#243a55')
|
||||
d.text((1000,186),'轴承板与角码(隐藏开关、法兰)',font=mid,fill='#243a55')
|
||||
panel('side.png',30,220,930,560,90); panel('adjustment.png',980,220,900,560,90)
|
||||
d.line((40,800,1880,800),fill='#d8e0e9',width=2)
|
||||
rows=[
|
||||
('两块铝板各 8 mm;KFL 安装耳贴板,凸起进入中心孔;轴承与板作为整体对中。','#243a55'),
|
||||
('竖向:角码长槽;横向:铝板长槽,交叉槽共用一颗螺丝;前后:2020 槽内 T 型螺母。','#243a55'),
|
||||
('螺丝基准偏心:竖向约上 1 / 下 2 mm,横向约 ±2 mm,为几何行程,不可硬推轴。','#9b2b22'),
|
||||
('轴承轴向按 KMT 标称,板孔 Ø30.2、凸起 Ø29 假设;轴承间中心距约 104.5 mm。','#52657b'),
|
||||
('型材圆孔侧需 Ø9.5×2.75 mm 低头螺丝;工具空间、0.5 mm 法兰间隙未验证。','#9b2b22'),
|
||||
]
|
||||
for i,(txt,color) in enumerate(rows):d.text((40,822+i*48),txt,font=small,fill=color)
|
||||
im.save(out/'KFL反装铝板_3D装配示意.png')
|
||||
Reference in New Issue
Block a user