Add CLI params for basic finger joint settings
Change generators over to set defaults instead of overwriting the settings
This commit is contained in:
parent
d6fe98635e
commit
25be6dbc94
|
@ -118,6 +118,15 @@ class Boxes:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.argparser = ArgumentParser(description=self.__doc__)
|
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(
|
self.argparser.add_argument(
|
||||||
"--thickness", action="store", type=float, default=4.0,
|
"--thickness", action="store", type=float, default=4.0,
|
||||||
help="thickness of the material")
|
help="thickness of the material")
|
||||||
|
@ -220,6 +229,10 @@ class Boxes:
|
||||||
|
|
||||||
# Share settings object
|
# Share settings object
|
||||||
s = edges.FingerJointSettings(self.thickness)
|
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.FingerJointEdge(self, s))
|
||||||
self.addPart(edges.FingerJointEdgeCounterPart(self, s))
|
self.addPart(edges.FingerJointEdgeCounterPart(self, s))
|
||||||
self.addPart(edges.FingerHoleEdge(self, s))
|
self.addPart(edges.FingerHoleEdge(self, s))
|
||||||
|
|
|
@ -21,15 +21,16 @@ class Box(Boxes):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h")
|
self.buildArgParser("x", "y", "h")
|
||||||
|
self.argparser.set_defaults(
|
||||||
|
fingerjointfinger=3.0,
|
||||||
|
fingerjointspace=3.0
|
||||||
|
)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
x, y, h = self.x, self.y, self.h
|
x, y, h = self.x, self.y, self.h
|
||||||
t = self.thickness
|
t = self.thickness
|
||||||
self.open(width=x+y+40, height=y+2*h+50)
|
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)]
|
d2 = [edges.Bolts(2)]
|
||||||
d3 = [edges.Bolts(3)]
|
d3 = [edges.Bolts(3)]
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,15 @@ class Box(Boxes):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h")
|
self.buildArgParser("x", "y", "h")
|
||||||
|
self.argparser.set_defaults(
|
||||||
|
fingerjointfinger=3.0,
|
||||||
|
fingerjointspace=3.0
|
||||||
|
)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
x, y, h = self.x, self.y, self.h
|
x, y, h = self.x, self.y, self.h
|
||||||
t = self.thickness
|
t = self.thickness
|
||||||
self.open(width=x+y+40, height=y+2*h+50)
|
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)]
|
d2 = [edges.Bolts(2)]
|
||||||
d3 = [edges.Bolts(3)]
|
d3 = [edges.Bolts(3)]
|
||||||
|
|
|
@ -21,6 +21,10 @@ class Box(Boxes):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h")
|
self.buildArgParser("x", "y", "h")
|
||||||
|
self.argparser.set_defaults(
|
||||||
|
fingerjointfinger=3.0,
|
||||||
|
fingerjointspace=3.0
|
||||||
|
)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
x, y, h = self.x, self.y, self.h
|
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.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)]
|
d2 = [edges.Bolts(2)]
|
||||||
d3 = [edges.Bolts(3)]
|
d3 = [edges.Bolts(3)]
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,10 @@ class Box(Boxes):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h", "hi")
|
self.buildArgParser("x", "y", "h", "hi")
|
||||||
|
self.argparser.set_defaults(
|
||||||
|
fingerjointfinger=2.0,
|
||||||
|
fingerjointspace=2.0
|
||||||
|
)
|
||||||
|
|
||||||
def side(self, w, h, hi):
|
def side(self, w, h, hi):
|
||||||
r = min(h-hi, w) / 2.0
|
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.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.ctx.save()
|
||||||
self.rectangularWall(x, h, "Ffef", move="up")
|
self.rectangularWall(x, h, "Ffef", move="up")
|
||||||
self.rectangularWall(x, hi, "Ffef", move="up")
|
self.rectangularWall(x, hi, "Ffef", move="up")
|
||||||
|
|
|
@ -27,6 +27,11 @@ class TypeTray(Boxes):
|
||||||
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.set_defaults(
|
||||||
|
fingerjointfinger=3.0,
|
||||||
|
fingerjointspace=3.0,
|
||||||
|
fingerjointsurrounding=0.5,
|
||||||
|
)
|
||||||
|
|
||||||
def xSlots(self):
|
def xSlots(self):
|
||||||
posx = -0.5 * self.thickness
|
posx = -0.5 * self.thickness
|
||||||
|
@ -74,8 +79,6 @@ class TypeTray(Boxes):
|
||||||
t = self.thickness
|
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.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)
|
self.moveTo(t, t)
|
||||||
# outer walls
|
# outer walls
|
||||||
|
|
Loading…
Reference in New Issue