DividerTray, Typetray: Add handle parameter

This commit is contained in:
suks.ae 2022-06-16 18:06:58 +02:00 committed by Florian Festi
parent bfaabc2619
commit 2086eac5e6
2 changed files with 22 additions and 10 deletions

View File

@ -83,6 +83,7 @@ There are 3 different sets of dividers rendered: One single divider spanning acr
def __init__(self): def __init__(self):
Boxes.__init__(self) Boxes.__init__(self)
self.addSettingsArgs(edges.FingerJointSettings) self.addSettingsArgs(edges.FingerJointSettings)
self.addSettingsArgs(edges.HandleEdgeSettings)
self.buildArgParser("sx", "sy", "h", "outside") self.buildArgParser("sx", "sy", "h", "outside")
self.addSettingsArgs(SlotSettings) self.addSettingsArgs(SlotSettings)
self.addSettingsArgs(NotchSettings) self.addSettingsArgs(NotchSettings)
@ -108,6 +109,9 @@ There are 3 different sets of dividers rendered: One single divider spanning acr
self.argparser.add_argument( self.argparser.add_argument(
"--bottom", type=boolarg, default=False, help="generate wall on the bottom", "--bottom", type=boolarg, default=False, help="generate wall on the bottom",
) )
self.argparser.add_argument(
"--handle", type=boolarg, default=False, help="add handle to the bottom",
)
def render(self): def render(self):
@ -145,7 +149,7 @@ There are 3 different sets of dividers rendered: One single divider spanning acr
# Facing walls (outer) with finger holes to support side walls # Facing walls (outer) with finger holes to support side walls
facing_wall_length = sum(self.sx) + self.thickness * (len(self.sx) - 1) facing_wall_length = sum(self.sx) + self.thickness * (len(self.sx) - 1)
side_edge = lambda with_wall: "F" if with_wall else "e" side_edge = lambda with_wall: "F" if with_wall else "e"
bottom_edge = lambda with_wall: "F" if with_wall else "e" bottom_edge = lambda with_wall, with_handle: ("f" if with_handle else "F") if with_wall else "e"
upper_edge = ( upper_edge = (
DividerNotchesEdge( DividerNotchesEdge(
self, self,
@ -159,7 +163,7 @@ There are 3 different sets of dividers rendered: One single divider spanning acr
facing_wall_length, facing_wall_length,
self.h, self.h,
[ [
bottom_edge(self.bottom), bottom_edge(self.bottom, _ and self.handle),
side_edge(self.right_wall), side_edge(self.right_wall),
upper_edge, upper_edge,
side_edge(self.left_wall), side_edge(self.left_wall),
@ -194,7 +198,7 @@ There are 3 different sets of dividers rendered: One single divider spanning acr
[ [
"f", "f",
"f" if self.right_wall else "e", "f" if self.right_wall else "e",
"f", "Y" if self.handle else "f",
"f" if self.left_wall else "e", "f" if self.left_wall else "e",
], ],
callback=[partial(self.generate_finger_holes, side_wall_length)], callback=[partial(self.generate_finger_holes, side_wall_length)],

View File

@ -40,6 +40,9 @@ class TypeTray(_TopEdge):
self.argparser.add_argument( self.argparser.add_argument(
"--gripwidth", action="store", type=float, default=70, "--gripwidth", action="store", type=float, default=70,
dest="gw", help="width of th grip hole in mm (zero for no hole)") dest="gw", help="width of th grip hole in mm (zero for no hole)")
self.argparser.add_argument(
"--handle", type=boolarg, default=False, help="add handle to the bottom (changes bottom edge in the front)",
)
def xSlots(self): def xSlots(self):
posx = -0.5 * self.thickness posx = -0.5 * self.thickness
@ -112,7 +115,7 @@ class TypeTray(_TopEdge):
callback=[self.xHoles, None, self.gripHole], callback=[self.xHoles, None, self.gripHole],
ignore_widths=[], ignore_widths=[],
move="up") move="up")
self.rectangularWall(x, h, [b, "f", t3, "f"], self.rectangularWall(x, h, ["f" if self.handle else b, "f", t3, "f"],
callback=[self.mirrorX(self.xHoles, x), ], callback=[self.mirrorX(self.xHoles, x), ],
move="up") move="up")
else: else:
@ -120,14 +123,17 @@ class TypeTray(_TopEdge):
callback=[self.xHoles, None, self.gripHole], callback=[self.xHoles, None, self.gripHole],
ignore_widths=[1, 6], ignore_widths=[1, 6],
move="up") move="up")
self.rectangularWall(x, h, [b, "F", t3, "F"], self.rectangularWall(x, h, ["f" if self.handle else b, "F", t3, "F"],
callback=[self.mirrorX(self.xHoles, x), ], callback=[self.mirrorX(self.xHoles, x), ],
ignore_widths=[1, 6], move="up") ignore_widths=[] if self.handle else [1, 6],
move="up")
# floor # floor
if b != "e": if b != "e":
self.rectangularWall(x, y, "ffff", callback=[ if self.handle:
self.xSlots, self.ySlots], move="up") self.rectangularWall(x, y, "ffYf", callback=[self.xSlots, self.ySlots], move="up")
else:
self.rectangularWall(x, y, "ffff", callback=[self.xSlots, self.ySlots], move="up")
# Inner walls # Inner walls
@ -167,11 +173,13 @@ class TypeTray(_TopEdge):
else: else:
self.rectangularWall( self.rectangularWall(
y, h, [b, "f", t2, "f"], callback=[self.yHoles, ], y, h, [b, "f", t2, "f"], callback=[self.yHoles, ],
ignore_widths=[1, 6], move="up") ignore_widths=[6] if self.handle else [1, 6],
move="up")
self.rectangularWall( self.rectangularWall(
y, h, [b, "f", t4, "f"], y, h, [b, "f", t4, "f"],
callback=[self.mirrorX(self.yHoles, y), ], callback=[self.mirrorX(self.yHoles, y), ],
ignore_widths=[1, 6], move="up") ignore_widths=[1] if self.handle else [1, 6],
move="up")
# inner walls # inner walls
for i in range(len(self.sx) - 1): for i in range(len(self.sx) - 1):