FlexBox: Make latchsize configurable

This commit is contained in:
Florian Festi 2018-10-19 21:35:11 +02:00
parent 791ef0fdca
commit 4d76457d3a
1 changed files with 4 additions and 1 deletions

View File

@ -31,6 +31,9 @@ class FlexBox(boxes.Boxes):
self.argparser.add_argument( self.argparser.add_argument(
"--radius", action="store", type=float, default=15, "--radius", action="store", type=float, default=15,
help="Radius of the latch in mm") help="Radius of the latch in mm")
self.argparser.add_argument(
"--latchsize", action="store", type=float, default=8,
help="size of latch in multiples of thickness")
def flexBoxSide(self, x, y, r, callback=None, move=None): def flexBoxSide(self, x, y, r, callback=None, move=None):
t = self.thickness t = self.thickness
@ -108,7 +111,7 @@ class FlexBox(boxes.Boxes):
self.h = self.adjustSize(self.h) self.h = self.adjustSize(self.h)
x, y, h = self.x, self.y, self.h x, y, h = self.x, self.y, self.h
self.latchsize = 8 * self.thickness self.latchsize *= self.thickness
r = self.radius or min(x, y - self.latchsize) / 2.0 r = self.radius or min(x, y - self.latchsize) / 2.0
r = min(r, x / 2.0) r = min(r, x / 2.0)
self.radius = r = min(r, max(0, (y - self.latchsize) / 2.0)) self.radius = r = min(r, max(0, (y - self.latchsize) / 2.0))