from ocp_vscode import *
from build123d import *

set_port(3939)

l = 32
b = 30
h = 60
filletRad = 3
wanddikte = 1.2

with BuildPart() as box:
    with BuildSketch() as bodem:
        Rectangle(l+2.4, b+2.4)
        fillet(bodem.vertices(), radius=filletRad)
    extrude(amount=wanddikte)
    fillet(box.edges().group_by(Axis.Z)[0], radius=1.0)
    with BuildSketch(box.faces().sort_by(Axis.Z)[-1]) as zijwand:
        perimeter = Rectangle(l+2.4, b+2.4)
        offset(
            perimeter,
            -wanddikte,
            kind = Kind.INTERSECTION,
            mode = Mode.SUBTRACT,
        )
        fillet(zijwand.vertices(), radius=filletRad)
    extrude(amount=h)
    with BuildSketch(zijwand.faces().filter_by(Axis.Z)[-1]) as klem:
        afsluiter = Rectangle(2.4, 2.4)
#        offset(
#            afsluiter,
#            -(wanddikte*2),
#            kind = Kind.INTERSECTION,
#            mode = Mode.SUBTRACT,
#        )
#        fillet(klem.vertices(), radius=filletRad)
    extrude(amount = 1.6)


#export_stl(box.part, "box.stl")
show(box)
