diff --git a/boxes/generators/wallrack.py b/boxes/generators/wallrack.py index 4649c42a..d33b499c 100644 --- a/boxes/generators/wallrack.py +++ b/boxes/generators/wallrack.py @@ -41,28 +41,31 @@ def __init__(self): self.argparser.add_argument( "--back_height", action="store", type=float, default=1.5, help="height of the back as fraction of the front height") + self.argparser.add_argument( + "--side_edges", action="store", + type=ArgparseEdgeType("Fh"), choices=list("Fh"), + default="h", help="edge type holding the shelfs together") self.argparser.add_argument( "--flat_bottom", type=boolarg, default=False, help="Make bottom Flat, so that the rack can also stand") def generate_shelves(self, x, y, front_height, back_height): + se = self.side_edges for i in range(len(self.sh)): self.rectangularWall(x, y, "ffff", move="up", label=f"shelf {i+1}") - self.rectangularWall(x, front_height, "Ffef", move="up", label=f"front lip {i+1}") - self.trapezoidWall(y, front_height, back_height, "FfeF", move="right", label=f"right lip {i+1}") - self.trapezoidWall(y, front_height, back_height, "FfeF", move="up", label=f"left lip {i+1}") + self.rectangularWall(x, front_height, se + "fef", move="up", label=f"front lip {i+1}") + self.trapezoidWall(y, front_height, back_height, se + "fe" + se, move="right", label=f"right lip {i+1}") + self.trapezoidWall(y, front_height, back_height, se + "fe" + se, move="up", label=f"left lip {i+1}") self.move(y + self.thickness*2, back_height, "left", before=True) #Generate finger holes for back part def generate_finger_holes(self, x, back_height): t = self.thickness - offset = -self.sh[0] + (0 if self.flat_bottom else t) - for i in self.sh: - offset += i - pos_y = offset - self.fingerHolesAt(t*0.5, pos_y, x, 0) - pos_y += t*0.5 - self.fingerHolesAt(0, pos_y, back_height, 90) - self.fingerHolesAt(x+t, pos_y, back_height, 90) + pos_y = 0 + for h in self.sh: + self.fingerHolesAt(t*0.5, pos_y + 0.5*t, x, 0) + self.fingerHolesAt(0, pos_y + t, back_height, 90) + self.fingerHolesAt(x+t, pos_y + t, back_height, 90) + pos_y += h def render(self): x, y, front_height = self.x, self.y, self.wall_height @@ -78,6 +81,7 @@ def render(self): else: total_height = sum(self.sh[:-1]) + back_height - self.rectangularWall(x+self.thickness, total_height, "EE" + self.top_edge + "E", + be = "e" if self.flat_bottom and self.side_edges == "F" else "E" + self.rectangularWall(x+self.thickness, total_height, be + "E" + self.top_edge + "E", callback=[partial(self.generate_finger_holes, x, back_height)], label="back wall", move="right") self.generate_shelves(x, y, front_height, back_height)