parent
b68aa5bb0f
commit
3bf4be5e1d
|
@ -182,15 +182,20 @@ class DividerTray(Boxes):
|
||||||
# with margin
|
# with margin
|
||||||
- self.divider_bottom_margin
|
- self.divider_bottom_margin
|
||||||
)
|
)
|
||||||
|
self.generate_divider(
|
||||||
|
self.sx, divider_height, "up",
|
||||||
|
first_tab_width=self.thickness if self.left_wall else 0,
|
||||||
|
second_tab_width=self.thickness if self.right_wall else 0
|
||||||
|
)
|
||||||
for i, length in enumerate(self.sx):
|
for i, length in enumerate(self.sx):
|
||||||
is_first_wall = i == 0
|
is_first_wall = i == 0
|
||||||
is_last_wall = i == len(self.sx) - 1
|
is_last_wall = i == len(self.sx) - 1
|
||||||
self.generate_divider(
|
self.generate_divider(
|
||||||
length,
|
[length],
|
||||||
divider_height,
|
divider_height,
|
||||||
"up",
|
"right",
|
||||||
only_one_wall=(is_first_wall and not self.left_wall)
|
first_tab_width=self.thickness if self.left_wall or i>0 else 0,
|
||||||
or (is_last_wall and not self.right_wall),
|
second_tab_width=self.thickness if self.right_wall or i<(len(self.sx) - 1) else 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
|
@ -236,9 +241,9 @@ class DividerTray(Boxes):
|
||||||
posx += x + self.thickness
|
posx += x + self.thickness
|
||||||
self.fingerHolesAt(posx, 0, length)
|
self.fingerHolesAt(posx, 0, length)
|
||||||
|
|
||||||
def generate_divider(self, width, height, move, only_one_wall=False):
|
def generate_divider(
|
||||||
second_tab_width = 0 if only_one_wall else self.thickness
|
self, widths, height, move, first_tab_width=0, second_tab_width=0):
|
||||||
total_width = width + self.thickness + second_tab_width
|
total_width = sum(widths) + (len(widths)-1) * self.thickness + first_tab_width + second_tab_width
|
||||||
|
|
||||||
if self.move(total_width, height, move, True):
|
if self.move(total_width, height, move, True):
|
||||||
return
|
return
|
||||||
|
@ -247,27 +252,31 @@ class DividerTray(Boxes):
|
||||||
|
|
||||||
upper_radius = self.divider_upper_notch_radius
|
upper_radius = self.divider_upper_notch_radius
|
||||||
lower_radius = self.divider_lower_notch_radius
|
lower_radius = self.divider_lower_notch_radius
|
||||||
upper_third = (width - 2 * upper_radius - 2 * lower_radius) / 3
|
|
||||||
|
|
||||||
# Upper: first tab width
|
# Upper: first tab width
|
||||||
self.edge(self.thickness)
|
self.edge(first_tab_width)
|
||||||
|
|
||||||
# Upper: divider width (with notch if possible)
|
for nr, width in enumerate(widths):
|
||||||
if upper_third > 0:
|
if nr > 0:
|
||||||
self.polyline(
|
self.edge(self.thickness)
|
||||||
upper_third,
|
|
||||||
(90, upper_radius),
|
# Upper: divider width (with notch if possible)
|
||||||
self.divider_notch_depth - upper_radius - lower_radius,
|
upper_third = (width - 2 * upper_radius - 2 * lower_radius) / 3
|
||||||
(-90, lower_radius),
|
if upper_third > 0:
|
||||||
upper_third,
|
self.polyline(
|
||||||
(-90, lower_radius),
|
upper_third,
|
||||||
self.divider_notch_depth - upper_radius - lower_radius,
|
(90, upper_radius),
|
||||||
(90, upper_radius),
|
self.divider_notch_depth - upper_radius - lower_radius,
|
||||||
upper_third,
|
(-90, lower_radius),
|
||||||
)
|
upper_third,
|
||||||
else:
|
(-90, lower_radius),
|
||||||
# if there isn't enough room for the radius, we don't use it
|
self.divider_notch_depth - upper_radius - lower_radius,
|
||||||
self.edge(width)
|
(90, upper_radius),
|
||||||
|
upper_third,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# if there isn't enough room for the radius, we don't use it
|
||||||
|
self.edge(width)
|
||||||
|
|
||||||
self.polyline(
|
self.polyline(
|
||||||
# Upper: second tab width if needed
|
# Upper: second tab width if needed
|
||||||
|
@ -279,14 +288,24 @@ class DividerTray(Boxes):
|
||||||
second_tab_width,
|
second_tab_width,
|
||||||
-90,
|
-90,
|
||||||
height - self.slot_depth,
|
height - self.slot_depth,
|
||||||
# Lower edge
|
90)
|
||||||
90,
|
# Lower edge
|
||||||
width,
|
for width in reversed(widths[1:]):
|
||||||
# Second side, always a tab
|
self.polyline(width, 90,
|
||||||
|
height - self.slot_depth,
|
||||||
|
-90,
|
||||||
|
self.thickness,
|
||||||
|
-90,
|
||||||
|
height - self.slot_depth,
|
||||||
|
90)
|
||||||
|
|
||||||
|
self.polyline(
|
||||||
|
# Second side tab
|
||||||
|
widths[0],
|
||||||
90,
|
90,
|
||||||
height - self.slot_depth,
|
height - self.slot_depth,
|
||||||
-90,
|
-90,
|
||||||
self.thickness,
|
first_tab_width,
|
||||||
90,
|
90,
|
||||||
self.slot_depth,
|
self.slot_depth,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue