"""PP-270 frozen plate. Run: python plate-build123d.py LENGTH OUTPUT.stl"""
import sys
import build123d as b

length = float(sys.argv[1])
output = sys.argv[2]
width = 24.0
thickness = 5.0
edge_to_center = 6.0
diameter = 4.0
x = length / 2 - edge_to_center
y = width / 2 - edge_to_center
plate = b.Box(length, width, thickness, align=(b.Align.CENTER, b.Align.CENTER, b.Align.MIN))
for sx in (-1, 1):
    for sy in (-1, 1):
        bore = b.Pos(sx * x, sy * y, 0) * b.Cylinder(diameter / 2, thickness, align=(b.Align.CENTER, b.Align.CENTER, b.Align.MIN))
        plate = plate - bore
b.export_stl(plate, output)
print(f"build123d {b.__version__}; source length={length}; solid volume={plate.volume:.9f}; export={output}")
