35 lines
896 B
Python
35 lines
896 B
Python
from ocp_vscode import *
|
|
from build123d import *
|
|
set_port(3939)
|
|
|
|
length = 9.0
|
|
width = 4.0
|
|
height = 2.0
|
|
arc_l = 3.0
|
|
arc_h = 1.0
|
|
arc_m = 2.5
|
|
|
|
with BuildPart() as box:
|
|
Box(5, 7.5, 2, align=Align.MIN)
|
|
far_vertex = (
|
|
box.vertices().group_by(Axis.Z)[0].group_by(Axis.X)[-1].sort_by(Axis.Y)[-1]
|
|
)
|
|
w = Vector(far_vertex).length
|
|
|
|
# Intersect with a rounded corner
|
|
with BuildPart(mode=Mode.INTERSECT) as with_corners:
|
|
with BuildSketch(Plane.XZ.rotated((0, 0, 45))) as profile:
|
|
with BuildLine() as corner:
|
|
l1 = EllipticalCenterArc(
|
|
(w - 3, 2 - 1), 3, 1, start_angle=0, end_angle=90
|
|
)
|
|
Polyline(l1 @ 1, (0, 2), (0, 0), (w, 0), l1 @ 0)
|
|
make_face()
|
|
extrude(amount=w, both=True)
|
|
|
|
mirror(about=Plane.YZ)
|
|
mirror(about=Plane.XZ)
|
|
mirror(about=Plane.XY)
|
|
|
|
show(box)
|