建立方向盘项目初始版本
This commit is contained in:
31
scripts/compose_kfl_compact80_concept.py
Normal file
31
scripts/compose_kfl_compact80_concept.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from PIL import Image, ImageChops, ImageDraw, ImageFont
|
||||
from pathlib import Path
|
||||
o=Path(r'C:\projects\wheel\models\kfl_compact80_concept')
|
||||
font=r'C:\Windows\Fonts\msyh.ttc'
|
||||
t=ImageFont.truetype(font,38); n=ImageFont.truetype(font,24); s=ImageFont.truetype(font,21)
|
||||
im=Image.new('RGB',(1920,1300),'white');d=ImageDraw.Draw(im)
|
||||
d.text((40,18),'紧凑轴承板与单根横梁 · 3D 概念装配',font=t,fill='#1a304d')
|
||||
d.text((40,80),'两块 76 × 80 × 8 mm 铝板;一根横向 2020 加固两根纵梁',font=n,fill='#52657b')
|
||||
d.rounded_rectangle((40,122,1880,176),radius=8,fill='#fff0eb')
|
||||
d.text((55,133),'示意方案:加长连接片、轴承开孔、型材和五金均需实物核对,不是 CNC 定稿',font=n,fill='#9b2b22')
|
||||
def prepare(file,w,h,rotate=0):
|
||||
v=Image.open(o/file).convert('RGB')
|
||||
if rotate:v=v.rotate(rotate,expand=True)
|
||||
mask=ImageChops.difference(v,Image.new('RGB',v.size,'white')).convert('L').point(lambda x:255 if x>12 else 0)
|
||||
bounds=mask.getbbox()
|
||||
if bounds:v=v.crop(bounds)
|
||||
v.thumbnail((w,h));return v
|
||||
d.text((40,195),'完整总装(电机侧在左)',font=n,fill='#243a55')
|
||||
d.text((1000,195),'两块板、连接片及一根横梁',font=n,fill='#243a55')
|
||||
left=prepare('side.png',870,560,90);right=prepare('frame.png',870,560)
|
||||
im.paste(left,(45+(870-left.width)//2,230+(560-left.height)//2));im.paste(right,(1000+(870-right.width)//2,230+(560-right.height)//2))
|
||||
d.line((40,810,1880,810),fill='#d8e0e9',width=2)
|
||||
rows=[
|
||||
'灰色是 2020 型材及两块铝板;浅黄色为金属连接片;橙色为角码;绿色是开关包络。',
|
||||
'单根横梁连接两根纵梁以加固框架;两块铝板通过四组角码与连接片分别固定在纵梁内侧。',
|
||||
'铝板小于 80 × 80 mm;每侧连接片示意 18 × 40 × 3 mm,并使用 3 mm 金属垫柱。',
|
||||
'两侧纵梁内侧与板边的名义间隙约 2.62 mm;螺栓、垫圈和板槽提供对中调整。',
|
||||
'轴承孔 Ø39 和凸起 Ø38 为示意包络;开关、接线和轴承顶丝位置未完整建模。',
|
||||
'横梁、连接件与旧2020的真实槽型、调角连接及强度需核对;型材长度仅为示意。']
|
||||
for i,x in enumerate(rows):d.text((42,830+i*48),x,font=s,fill='#283f5c' if i<4 else '#8c392c')
|
||||
im.save(o/'76x80_单横梁_3D示意.png')
|
||||
Reference in New Issue
Block a user