codeCAD/psorias_releaser.py
2026-02-27 01:43:44 +01:00

63 lines
2.0 KiB
Python

def build_psorias_release(L = 216, W = 127, H = 135,PEAK2PEAK = 160, h_bottom = 15):
R0 = 40
R1 = 8
R2 = 40
R3 = 30
w_cut_inside = (PEAK2PEAK / 2) - R1-1
w_cut_outside = (L / 2) - w_cut_inside - (2 * R1)
print(f"{w_cut_inside = } {w_cut_outside = }")
h_bend = 70
w_bend = w_cut_outside - 8
h_rect = 10
w_slope = 10
with BuildPart() as p:
with BuildSketch(Plane.XZ) as s:
with Locations((0,H-R0)):
Circle(R0)
with Locations((0,0)):
Rectangle(W, h_rect)
make_hull()
extrude(amount=L/2)
with BuildSketch(Plane.YZ.offset(-W/2)) as s:
with Locations((-(L-w_cut_inside)/2, H+h_rect/2)):
Rectangle(w_cut_inside, h_rect)
with Locations(((-L+w_cut_inside-w_slope-R2-1)/2, h_bottom+h_rect/2)):
Rectangle(w_cut_inside-w_slope-R2, h_rect)
with Locations((-(L-w_cut_inside+R2-w_slope)/2, h_bottom+R2)):
Circle(R2)
make_hull()
extrude(amount=W, mode=Mode.SUBTRACT)
with BuildSketch(Plane.YZ.offset(-W/2)) as s:
with Locations((-w_cut_outside/2, H+h_rect/2)):
Rectangle(w_cut_outside, h_rect)
with Locations(((h_rect)/2, h_rect)):
Rectangle(h_rect, h_rect)
with Locations((-w_bend+R3, h_bend)):
Circle(R3)
make_hull()
extrude(amount=W, mode=Mode.SUBTRACT)
fillet(p.edges().sort_by(Axis.Z)[-1], radius=R1)
fillet(p.edges().sort_by(Axis.Z)[-3], radius=R1)
#scale(by=(1,1,0.8), mode=Mode.SUBTRACT)
mirror(p.part, about=Plane(p.faces().group_by(Axis.Y)[0][0]))
return p
p = build_psorias_release()
p1 = build_psorias_release(L = 216, W = 110, H = 100,PEAK2PEAK = 160, h_bottom = 15)
p2 = p.part - p1.part.locate(Location((0.,0,-25.)))
p2
# %%
p1 = copy.copy(p.part)
p1 = scale(p1, by=(0.8,0.95,0.8)).locate(Location((0.,-(1-0.95)*W/2.-2.5,-25.)))
p2 = p.part-p1
p2.export_step("psoas_releaser.step")