From 2fa99b45e78dba4b1d33b5a2c075a2926e1f7b5f Mon Sep 17 00:00:00 2001 From: Mariusz Ryndzionek Date: Sat, 19 Feb 2022 11:28:17 +0100 Subject: [PATCH] Added basic USB cutout --- README.md | 2 +- keyboard.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ab8ce0..79704b6 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,4 @@ # TODO - - [ ] adding USB connector cutout + - [x] adding USB connector cutout diff --git a/keyboard.py b/keyboard.py index 4bb7b43..2a9a13f 100644 --- a/keyboard.py +++ b/keyboard.py @@ -249,6 +249,20 @@ def generate(config: Config, odir='output'): "showHidden": False, } + if not (config.split or config.cnc): + fs = spacerPlate.faces('+Y').all() + fs.sort(key=lambda f: f.edges().val().Center().y) + fs = list(filter(lambda f: math.isclose( + f.edges().val().Center().x, 0.0, abs_tol=1e-09), fs)) + assert(len(fs) == 2) + ys = fs[-1].edges().val().Center().y + + conn = cq.Workplane('ZX').sketch().push([(config.spacerThickness / 2, 0)])\ + .slot(9.0 - 2.56, 2.56, angle=90.0).finalize()\ + .extrude(10.0).workplane(offset=-5.0 + 1.5).sketch().push([(config.spacerThickness / 2, 0)])\ + .rect(0.5, 15.5).finalize().extrude(15).mirror('ZX').translate((0, ys, 0)) + spacerPlate = spacerPlate.cut(conn) + if config.cnc: switchPlate = switchPlate.faces(">Z").workplane().pushPoints( shp).hole(config.screwHoleDiameter)