建立方向盘项目初始版本
This commit is contained in:
24
scripts/make_plate_v3_render_alt.py
Normal file
24
scripts/make_plate_v3_render_alt.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from pathlib import Path
|
||||
p=Path(__file__).with_name('render_kfl_plate_v2.py')
|
||||
s=p.read_text(encoding='utf8').replace('kfl001_plate_v2','kfl001_plate_v3_alt').replace('V2','V3')
|
||||
start=s.index('path=c.beginPath();path.moveTo(x0,y0);path.lineTo(x0+w,y0)')
|
||||
end=s.index("c.setFillColor(HexColor('#ffffff'));",start)
|
||||
s=s[:start]+'''# Exterior as manufactured: R3 tangent corners and R60 arch, symmetric around x=38.
|
||||
path=c.beginPath();path.moveTo(x0+3*k,y0);path.lineTo(x0+73*k,y0)
|
||||
def arc_poly(cx0,cy0,r,a0,a1,n=20):
|
||||
for j in range(1,n+1):
|
||||
a=math.radians(a0+(a1-a0)*j/n)
|
||||
path.lineTo(x0+(cx0+r*math.cos(a))*k,y0+(cy0+r*math.sin(a))*k)
|
||||
arc_poly(73,3,3,-90,0)
|
||||
y_corner=15+math.sqrt(57**2-35**2)
|
||||
path.lineTo(x0+76*k,y0+y_corner*k)
|
||||
theta=math.degrees(math.atan2(y_corner-15,35))
|
||||
arc_poly(73,y_corner,3,0,theta)
|
||||
arc_poly(38,15,60,theta,180-theta,80)
|
||||
arc_poly(3,y_corner,3,180-theta,180)
|
||||
path.lineTo(x0,y0+3*k)
|
||||
arc_poly(3,3,3,180,270)
|
||||
path.close();c.drawPath(path,fill=1,stroke=1)
|
||||
''' + s[end:]
|
||||
s=s.replace("'6 外轮廓两面各 1.5 × 45° 倒角'", "'6 平面过渡 R3;外轮廓双面 C1'")
|
||||
Path(__file__).with_name('render_kfl_plate_v3_alt.py').write_text(s,encoding='utf8')
|
||||
Reference in New Issue
Block a user