Add CLI params for basic finger joint settings

Change generators over to set defaults instead of overwriting the settings
This commit is contained in:
Florian Festi 2016-04-02 17:39:26 +02:00
parent d6fe98635e
commit 25be6dbc94
6 changed files with 34 additions and 12 deletions

View File

@ -118,6 +118,15 @@ class Boxes:
def __init__(self):
self.argparser = ArgumentParser(description=self.__doc__)
self.argparser.add_argument(
"--fingerjointfinger", action="store", type=float, default=1.0,
help="width of the fingers in multiples of thickness")
self.argparser.add_argument(
"--fingerjointspace", action="store", type=float, default=1.0,
help="width of the space between fingers in multiples of thickness")
self.argparser.add_argument(
"--fingerjointsurrounding", action="store", type=float, default=1.0,
help="amount of space needed at the end in multiples of normal spaces")
self.argparser.add_argument(
"--thickness", action="store", type=float, default=4.0,
help="thickness of the material")
@ -220,6 +229,10 @@ class Boxes:
# Share settings object
s = edges.FingerJointSettings(self.thickness)
s.setValues(self.thickness,
finger=getattr(self, "fingerjointfinger", 1.0),
space=getattr(self, "fingerjointspace", 1.0),
surroundingspaces=getattr(self, "fingerjointsurrounding", 1.0))
self.addPart(edges.FingerJointEdge(self, s))
self.addPart(edges.FingerJointEdgeCounterPart(self, s))
self.addPart(edges.FingerHoleEdge(self, s))

View File

@ -21,15 +21,16 @@ class Box(Boxes):
def __init__(self):
Boxes.__init__(self)
self.buildArgParser("x", "y", "h")
self.argparser.set_defaults(
fingerjointfinger=3.0,
fingerjointspace=3.0
)
def render(self):
x, y, h = self.x, self.y, self.h
t = self.thickness
self.open(width=x+y+40, height=y+2*h+50)
self.edges["f"].settings.setValues(self.thickness, space=3, finger=3,
surroundingspaces=1)
d2 = [edges.Bolts(2)]
d3 = [edges.Bolts(3)]

View File

@ -23,13 +23,15 @@ class Box(Boxes):
def __init__(self):
Boxes.__init__(self)
self.buildArgParser("x", "y", "h")
self.argparser.set_defaults(
fingerjointfinger=3.0,
fingerjointspace=3.0
)
def render(self):
x, y, h = self.x, self.y, self.h
t = self.thickness
self.open(width=x+y+40, height=y+2*h+50)
self.edges["f"].settings.setValues(self.thickness, space=3, finger=3,
surroundingspaces=1)
d2 = [edges.Bolts(2)]
d3 = [edges.Bolts(3)]

View File

@ -21,6 +21,10 @@ class Box(Boxes):
def __init__(self):
Boxes.__init__(self)
self.buildArgParser("x", "y", "h")
self.argparser.set_defaults(
fingerjointfinger=3.0,
fingerjointspace=3.0
)
def render(self):
x, y, h = self.x, self.y, self.h
@ -28,9 +32,6 @@ class Box(Boxes):
self.open(width=x+y+10*t, height=y+h+10*t)
self.edges["f"].settings.setValues(self.thickness, space=3, finger=3,
surroundingspaces=1)
d2 = [edges.Bolts(2)]
d3 = [edges.Bolts(3)]

View File

@ -21,6 +21,10 @@ class Box(Boxes):
def __init__(self):
Boxes.__init__(self)
self.buildArgParser("x", "y", "h", "hi")
self.argparser.set_defaults(
fingerjointfinger=2.0,
fingerjointspace=2.0
)
def side(self, w, h, hi):
r = min(h-hi, w) / 2.0
@ -62,8 +66,6 @@ class Box(Boxes):
self.open(width=x+y+8*t, height=x+h+hi+4*t)
self.edges["f"].settings.setValues(self.thickness, space=2, finger=2)
self.ctx.save()
self.rectangularWall(x, h, "Ffef", move="up")
self.rectangularWall(x, hi, "Ffef", move="up")

View File

@ -27,6 +27,11 @@ class TypeTray(Boxes):
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.set_defaults(
fingerjointfinger=3.0,
fingerjointspace=3.0,
fingerjointsurrounding=0.5,
)
def xSlots(self):
posx = -0.5 * self.thickness
@ -74,8 +79,6 @@ class TypeTray(Boxes):
t = self.thickness
self.open(width=2*max(x,y)+10*t, height=(len(self.sx)+len(self.sy))*(h+2*t)+4*t)
self.edges["f"].settings.setValues(self.thickness, space=3, finger=3,
surroundingspaces=0.5)
self.moveTo(t, t)
# outer walls