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):
Boxes.__init__(self)
self.addSettingsArgs(edges.FingerJointSettings)
self.addSettingsArgs(edges.HandleEdgeSettings)
self.buildArgParser("sx", "sy", "h", "outside")
self.addSettingsArgs(SlotSettings)
self.addSettingsArgs(NotchSettings)
@ -108,6 +109,9 @@ There are 3 different sets of dividers rendered: One single divider spanning acr
self.argparser.add_argument(
"--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):
@ -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_wall_length = sum(self.sx) + self.thickness * (len(self.sx) - 1)
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 = (
DividerNotchesEdge(
self,
@ -159,7 +163,7 @@ There are 3 different sets of dividers rendered: One single divider spanning acr
facing_wall_length,
self.h,
[
bottom_edge(self.bottom),
bottom_edge(self.bottom, _ and self.handle),
side_edge(self.right_wall),
upper_edge,
side_edge(self.left_wall),
@ -194,7 +198,7 @@ There are 3 different sets of dividers rendered: One single divider spanning acr
[
"f",
"f" if self.right_wall else "e",
"f",
"Y" if self.handle else "f",
"f" if self.left_wall else "e",
],
callback=[partial(self.generate_finger_holes, side_wall_length)],

View File

@ -40,6 +40,9 @@ class TypeTray(_TopEdge):
self.argparser.add_argument(
"--gripwidth", action="store", type=float, default=70,
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):
posx = -0.5 * self.thickness
@ -112,7 +115,7 @@ class TypeTray(_TopEdge):
callback=[self.xHoles, None, self.gripHole],
ignore_widths=[],
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), ],
move="up")
else:
@ -120,14 +123,17 @@ class TypeTray(_TopEdge):
callback=[self.xHoles, None, self.gripHole],
ignore_widths=[1, 6],
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), ],
ignore_widths=[1, 6], move="up")
ignore_widths=[] if self.handle else [1, 6],
move="up")
# floor
if b != "e":
self.rectangularWall(x, y, "ffff", callback=[
self.xSlots, self.ySlots], move="up")
if self.handle:
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
@ -167,11 +173,13 @@ class TypeTray(_TopEdge):
else:
self.rectangularWall(
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(
y, h, [b, "f", t4, "f"],
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
for i in range(len(self.sx) - 1):