建立方向盘项目初始版本

This commit is contained in:
2026-10-29 22:04:55 +08:00
commit 9962cbfbce
834 changed files with 1519203 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
"""Draw a clearly provisional dimension diagram for the KFL001 plate."""
from pathlib import Path
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import landscape,A4
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib.colors import HexColor
import pypdfium2
out=Path(r'C:\projects\wheel\models\kfl001_plate_v1')
pdfmetrics.registerFont(TTFont('Chinese',r'C:\Windows\Fonts\simhei.ttf'))
p=out/'KFL001固定板_尺寸图.pdf'
c=canvas.Canvas(str(p),pagesize=landscape(A4));W,H=landscape(A4)
c.setTitle('KFL001 mounting plate V1 - prototype')
def txt(x,y,t,size=11,color='#17202a'):
c.setFillColor(HexColor(color));c.setFont('Chinese',size);c.drawString(x,y,t)
def ln(x1,y1,x2,y2,col='#444444',width=.7):
c.setStrokeColor(HexColor(col));c.setLineWidth(width);c.line(x1,y1,x2,y2)
def tick(x,y):ln(x-3,y-3,x+3,y+3)
txt(36,555,'KFL001 固定板尺寸图',23)
txt(36,532,'试制版:中心孔直径 39,适配直径 38 凸起',13,'#B42318')
txt(36,512,'两块几何相同;厚 8 mm;下方尺寸单位均为 mm',11)
k=3.6;x0=110;y0=125;w=76*k;h=80*k;cx=x0+w/2;cy=y0+51*k
c.setFillColor(HexColor('#eef2f6'));c.setStrokeColor(HexColor('#263444'));c.setLineWidth(1.1);c.rect(x0,y0,w,h,fill=1,stroke=1)
c.setFillColor(HexColor('#ffffff'));c.circle(cx,cy,19.5*k,stroke=1,fill=1)
for xx in (-24,24):c.circle(cx+xx*k,cy,3.5*k,stroke=1,fill=1)
for xx in (-23.5,23.5):c.roundRect(cx+(xx-4.75)*k,y0+(9-2.75)*k,9.5*k,5.5*k,2.75*k,stroke=1,fill=1)
c.setDash(4,3);ln(cx-23*k,cy,cx+23*k,cy,'#858b93',.5);ln(cx,cy-23*k,cx,cy+23*k,'#858b93',.5);c.setDash()
# Outside dimensions: overall width, height, axis height and KFL bolt pitch.
for x in (x0,x0+w):ln(x,y0-3,x,y0-31)
ln(x0,y0-23,x0+w,y0-23);tick(x0,y0-23);tick(x0+w,y0-23);txt(cx-8,y0-19,'76',10)
for y in (y0,y0+h):ln(x0-2,y,x0-38,y)
ln(x0-30,y0,x0-30,y0+h);tick(x0-30,y0);tick(x0-30,y0+h);txt(x0-50,y0+h/2,'80',10)
ln(x0+w+10,y0,x0+w+38,y0);ln(x0+w+10,cy,x0+w+38,cy)
ln(x0+w+30,y0,x0+w+30,cy);tick(x0+w+30,y0);tick(x0+w+30,cy);txt(x0+w+34,y0+(cy-y0)/2,'51',10)
by=cy+30*k
for x in (cx-24*k,cx+24*k):ln(x,cy+4*k,x,by+4)
ln(cx-24*k,by,cx+24*k,by);tick(cx-24*k,by);tick(cx+24*k,by);txt(cx-8,by+5,'48',10)
txt(472,454,'孔位说明',15)
for i,t in enumerate(['1 中心孔:直径 39,适配直径 38 凸起','2 两侧轴承孔:直径 7,孔距 48','3 底部两槽:9.5 × 5.5,横向','4 两槽中心距 47,槽心距底边 9','5 M5 名义横向总行程 4.5','6 中心孔到轴承孔边名义余量仅 1','7 直径 12 垫圈向中心孔悬出约 1.5','8 与 3030 连接用长角码及实物复核']):txt(472,424-i*24,t,11,'#B42318' if i in (0,5,6) else '#17202a')
ln(472,217,805,217,'#b9c0c9');txt(472,196,'轴承及连接件先试装,',11,'#B42318');txt(472,178,'紧固和动态强度需实物验证。',11,'#B42318')
txt(36,42,'注:圆孔和长槽均贯穿;两块相同。按孔心尺寸加工,无螺纹。',10)
c.showPage();c.save()
doc=pypdfium2.PdfDocument(str(p));page=doc[0];page.render(scale=1.6).to_pil().save(str(out/'KFL001固定板_尺寸图.png'))