From e072226aadaa2d61f430d43eeca832910d3b919b Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sun, 23 Jan 2022 17:25:46 +0100 Subject: [PATCH] DrillStand: pass edges param to sidewall Use sidewall() in SlatwallDrillbox, too --- boxes/generators/drillstand.py | 28 +++++++++++++++--------- boxes/generators/slatwalldrillbox.py | 32 ++-------------------------- 2 files changed, 20 insertions(+), 40 deletions(-) diff --git a/boxes/generators/drillstand.py b/boxes/generators/drillstand.py index 391d9a5..ef60866 100644 --- a/boxes/generators/drillstand.py +++ b/boxes/generators/drillstand.py @@ -63,22 +63,28 @@ Assembly: Start with putting the slots of the inner walls together. Then add the self.move(tw, th, move) - def sideWall(self, extra_height=0.0, foot_height=0.0, move=None): + def sideWall(self, extra_height=0.0, foot_height=0.0, edges="šFf", move=None): t = self.thickness x, sx, y, sy, sh = self.x, self.sx, self.y, self.sy, self.sh eh = extra_height fh = foot_height - tw, th = sum(sy) + t * len(sy) + t, max(sh) + eh + edges = [self.edges.get(e, e) for e in edges] + + tw = sum(sy) + t * len(sy) + t + th = max(sh) + eh + fh + edges[0].spacing() if self.move(tw, th, move, True): return - self.edges["š"](y+2*t) - self.edgeCorner("š", "e") + self.moveTo(edges[0].margin()) + + edges[0](y+2*t) + self.edgeCorner(edges[0], "e") self.edge(fh) - self.edges["F"](sh[-1]+eh) - self.polyline(0, 90, t) + self.step(edges[1].startwidth() - t) + edges[1](sh[-1]+eh) + self.edgeCorner(edges[1], "e") for i in range(len(sy)-1, 0, -1): self.edge(sy[i]) if sh[i] > sh[i-1]: @@ -87,10 +93,12 @@ Assembly: Start with putting the slots of the inner walls together. Then add the else: self.polyline(0, -90, sh[i-1] - sh[i], 90, t) self.fingerHolesAt(-0.5*t, self.burn, sh[i-1]+eh) - self.polyline(sy[0], 90) - self.edges["f"](sh[0]+eh) - self.polyline(0, -90, t, 90, fh) - self.edgeCorner("e", "š") + self.polyline(sy[0]) + self.edgeCorner("e", edges[2]) + edges[2](sh[0]+eh) + self.step(t - edges[2].endwidth()) + self.polyline(fh) + self.edgeCorner("e", edges[0]) self.move(tw, th, move) diff --git a/boxes/generators/slatwalldrillbox.py b/boxes/generators/slatwalldrillbox.py index ec5f49b..56a5c01 100644 --- a/boxes/generators/slatwalldrillbox.py +++ b/boxes/generators/slatwalldrillbox.py @@ -33,34 +33,6 @@ class SlatwallDrillBox(DrillStand): "--extra_height", action="store", type=float, default=15.0, help="height difference left to right") - def sideWall(self, extra_height=0.0, move=None): - t = self.thickness - x, sx, y, sy, sh = self.x, self.sx, self.y, self.sy, self.sh - eh = extra_height - - tw, th = sum(sy) + t * len(sy) + t, max(sh) + eh - - if self.move(tw, th, move, True): - return - - self.moveTo(t) - self.polyline(y+t, 90) - self.edges["B"](sh[-1]+eh) - self.polyline(0, 90, t) - for i in range(len(sy)-1, 0, -1): - self.edge(sy[i]) - if sh[i] > sh[i-1]: - self.fingerHolesAt(0.5*t, self.burn, sh[i]+eh, 90) - self.polyline(t, 90, sh[i] - sh[i-1], -90) - else: - self.polyline(0, -90, sh[i-1] - sh[i], 90, t) - self.fingerHolesAt(-0.5*t, self.burn, sh[i-1]+eh) - self.polyline(sy[0], 90) - self.edges["f"](sh[0]+eh) - self.corner(90) - - self.move(tw, th, move) - def render(self): # Add slat wall edges s = edges.SlatWallSettings(self.thickness, True, @@ -82,7 +54,7 @@ class SlatwallDrillBox(DrillStand): self.rectangularWall(x/math.cos(bottom_angle)-t*math.tan(bottom_angle), y, "fefe", callback=[self.bottomCB], move="up") - self.sideWall(move="right") + self.sideWall(edges="eBf", move="right") for i in range(1, len(sx)): self.yWall(i, move="right") - self.sideWall(self.extra_height, move="right") + self.sideWall(self.extra_height, edges="eBf", move="right")