Add outside parameter to some generators
This commit is contained in:
parent
261a6999f4
commit
3f97d7ad77
|
@ -20,17 +20,24 @@ class Box(Boxes):
|
||||||
"""Fully closed box"""
|
"""Fully closed box"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h")
|
self.buildArgParser("x", "y", "h", "outside")
|
||||||
self.argparser.set_defaults(
|
self.argparser.set_defaults(
|
||||||
fingerjointfinger=3.0,
|
fingerjointfinger=3.0,
|
||||||
fingerjointspace=3.0
|
fingerjointspace=3.0
|
||||||
)
|
)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
x, y, h = self.x, self.y, self.h
|
|
||||||
t = self.thickness
|
|
||||||
self.open()
|
self.open()
|
||||||
|
|
||||||
|
x, y, h = self.x, self.y, self.h
|
||||||
|
|
||||||
|
if self.outside:
|
||||||
|
x = self.adjustSize(x)
|
||||||
|
y = self.adjustSize(y)
|
||||||
|
h = self.adjustSize(h)
|
||||||
|
|
||||||
|
t = self.thickness
|
||||||
|
|
||||||
d2 = [edges.Bolts(2)]
|
d2 = [edges.Bolts(2)]
|
||||||
d3 = [edges.Bolts(3)]
|
d3 = [edges.Bolts(3)]
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Box(Boxes):
|
||||||
"""Box with just 3 walls"""
|
"""Box with just 3 walls"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h")
|
self.buildArgParser("x", "y", "h", "outside")
|
||||||
self.argparser.set_defaults(
|
self.argparser.set_defaults(
|
||||||
fingerjointfinger=3.0,
|
fingerjointfinger=3.0,
|
||||||
fingerjointspace=3.0
|
fingerjointspace=3.0
|
||||||
|
@ -30,6 +30,11 @@ class Box(Boxes):
|
||||||
x, y, h = self.x, self.y, self.h
|
x, y, h = self.x, self.y, self.h
|
||||||
t = self.thickness
|
t = self.thickness
|
||||||
|
|
||||||
|
if self.outside:
|
||||||
|
x = self.adjustSize(x)
|
||||||
|
y = self.adjustSize(y, False)
|
||||||
|
h = self.adjustSize(h, False)
|
||||||
|
|
||||||
self.open()
|
self.open()
|
||||||
|
|
||||||
d2 = [edges.Bolts(2)]
|
d2 = [edges.Bolts(2)]
|
||||||
|
|
|
@ -21,7 +21,7 @@ class FlexBox(boxes.Boxes):
|
||||||
"""Box with living hinge and round corners"""
|
"""Box with living hinge and round corners"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
boxes.Boxes.__init__(self)
|
boxes.Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h")
|
self.buildArgParser("x", "y", "h", "outside")
|
||||||
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")
|
||||||
|
@ -77,6 +77,12 @@ class FlexBox(boxes.Boxes):
|
||||||
self.corner(90)
|
self.corner(90)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
|
||||||
|
if self.outside:
|
||||||
|
self.x = self.adjustSize(self.x)
|
||||||
|
self.y = self.adjustSize(self.y)
|
||||||
|
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 = 8 * self.thickness
|
||||||
r = self.radius or min(x, y-self.latchsize)/2.0
|
r = self.radius or min(x, y-self.latchsize)/2.0
|
||||||
|
|
|
@ -21,7 +21,7 @@ class FlexBox(Boxes):
|
||||||
"""Box with living hinge and top corners rounded"""
|
"""Box with living hinge and top corners rounded"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h")
|
self.buildArgParser("x", "y", "h", "outside")
|
||||||
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 corners in mm")
|
help="Radius of the corners in mm")
|
||||||
|
@ -67,6 +67,11 @@ class FlexBox(Boxes):
|
||||||
self.corner(90)
|
self.corner(90)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
if self.outside:
|
||||||
|
self.x = self.adjustSize(self.x)
|
||||||
|
self.y = self.adjustSize(self.y)
|
||||||
|
self.h = self.adjustSize(self.h)
|
||||||
|
|
||||||
self.latchsize = 8*self.thickness
|
self.latchsize = 8*self.thickness
|
||||||
self.radius = self.radius or min(self.x/2.0, self.y-self.latchsize)
|
self.radius = self.radius or min(self.x/2.0, self.y-self.latchsize)
|
||||||
self.radius = min(self.radius, self.x/2.0)
|
self.radius = min(self.radius, self.x/2.0)
|
||||||
|
|
|
@ -21,7 +21,7 @@ class FlexBox(Boxes):
|
||||||
"""Box with living hinge"""
|
"""Box with living hinge"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y")
|
self.buildArgParser("x", "y", "outside")
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
"--z", action="store", type=float, default=100.0,
|
"--z", action="store", type=float, default=100.0,
|
||||||
help="height of the box")
|
help="height of the box")
|
||||||
|
@ -99,6 +99,11 @@ class FlexBox(Boxes):
|
||||||
self.edge(x+2*t)
|
self.edge(x+2*t)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
if self.outside:
|
||||||
|
self.x = self.adjustSize(self.x)
|
||||||
|
self.y = self.adjustSize(self.y)
|
||||||
|
self.z = self.adjustSize(self.z)
|
||||||
|
|
||||||
x, y, z, d, h = self.x, self.y, self.z, self.d, self.h
|
x, y, z, d, h = self.x, self.y, self.z, self.d, self.h
|
||||||
r = self.radius = self.radius or min(x, y)/2.0
|
r = self.radius = self.radius or min(x, y)/2.0
|
||||||
thickness = self.thickness
|
thickness = self.thickness
|
||||||
|
|
|
@ -21,7 +21,7 @@ class FlexBox(Boxes):
|
||||||
"""Box with living hinge and left corners rounded"""
|
"""Box with living hinge and left corners rounded"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h")
|
self.buildArgParser("x", "y", "h", "outside")
|
||||||
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 corners in mm")
|
help="Radius of the corners in mm")
|
||||||
|
@ -69,6 +69,11 @@ class FlexBox(Boxes):
|
||||||
self.corner(90)
|
self.corner(90)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
if self.outside:
|
||||||
|
self.x = self.adjustSize(self.x)
|
||||||
|
self.y = self.adjustSize(self.y)
|
||||||
|
self.h = self.adjustSize(self.h)
|
||||||
|
|
||||||
self.c4 = c4 = math.pi * self.radius * 0.5
|
self.c4 = c4 = math.pi * self.radius * 0.5
|
||||||
self.latchsize = 8*self.thickness
|
self.latchsize = 8*self.thickness
|
||||||
self.radius = self.radius or min(self.x/2.0, self.y-self.latchsize)
|
self.radius = self.radius or min(self.x/2.0, self.y-self.latchsize)
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Box(Boxes):
|
||||||
"""Open magazine file"""
|
"""Open magazine file"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("x", "y", "h", "hi")
|
self.buildArgParser("x", "y", "h", "hi", "outside")
|
||||||
self.argparser.set_defaults(
|
self.argparser.set_defaults(
|
||||||
fingerjointfinger=2.0,
|
fingerjointfinger=2.0,
|
||||||
fingerjointspace=2.0
|
fingerjointspace=2.0
|
||||||
|
@ -60,6 +60,11 @@ class Box(Boxes):
|
||||||
|
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
if self.outside:
|
||||||
|
self.x = self.adjustSize(self.x)
|
||||||
|
self.y = self.adjustSize(self.y)
|
||||||
|
self.h = self.adjustSize(self.h, e2=False)
|
||||||
|
|
||||||
x, y, h, = self.x, self.y, self.h
|
x, y, h, = self.x, self.y, self.h
|
||||||
self.hi = hi = self.hi or (h / 2.0)
|
self.hi = hi = self.hi or (h / 2.0)
|
||||||
t = self.thickness
|
t = self.thickness
|
||||||
|
|
|
@ -20,9 +20,13 @@ class TrayInsert(Boxes):
|
||||||
"""Tray insert without floor and outer walls - allows only continuous walls"""
|
"""Tray insert without floor and outer walls - allows only continuous walls"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("sx", "sy", "h")
|
self.buildArgParser("sx", "sy", "h", "outside")
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
if self.outside:
|
||||||
|
self.sx = self.adjustSize(self.sx, False, False)
|
||||||
|
self.sy = self.adjustSize(self.sy, False, False)
|
||||||
|
|
||||||
x = sum(self.sx) + self.thickness * (len(self.sx)-1)
|
x = sum(self.sx) + self.thickness * (len(self.sx)-1)
|
||||||
y = sum(self.sy) + self.thickness * (len(self.sy)-1)
|
y = sum(self.sy) + self.thickness * (len(self.sy)-1)
|
||||||
h = self.h
|
h = self.h
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Layout(Boxes):
|
||||||
"""Generate a typetray from a layout file"""
|
"""Generate a typetray from a layout file"""
|
||||||
def __init__(self, input=None, webargs=False):
|
def __init__(self, input=None, webargs=False):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("h", "hi")
|
self.buildArgParser("h", "hi", "outside")
|
||||||
if not webargs:
|
if not webargs:
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
"--input", action="store", type=argparse.FileType('r'),
|
"--input", action="store", type=argparse.FileType('r'),
|
||||||
|
@ -91,6 +91,12 @@ class Layout(Boxes):
|
||||||
edge(length)
|
edge(length)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
if self.outside:
|
||||||
|
self.x = self.adjustSize(self.x)
|
||||||
|
self.y = self.adjustSize(self.y)
|
||||||
|
self.h = self.adjustSize(self.h, e2=False)
|
||||||
|
if self.hi:
|
||||||
|
self.hi = self.adjustSize(self.hi, e2=False)
|
||||||
|
|
||||||
self.hi = hi = self.hi or self.h
|
self.hi = hi = self.hi or self.h
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class TypeTray(Boxes):
|
||||||
"""Type tray - allows only continuous walls"""
|
"""Type tray - allows only continuous walls"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Boxes.__init__(self)
|
Boxes.__init__(self)
|
||||||
self.buildArgParser("sx", "sy", "h", "hi")
|
self.buildArgParser("sx", "sy", "h", "hi", "outside")
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
"--gripheight", action="store", type=float, default=30,
|
"--gripheight", action="store", type=float, default=30,
|
||||||
dest="gh", help="height of the grip hole in mm")
|
dest="gh", help="height of the grip hole in mm")
|
||||||
|
@ -72,6 +72,13 @@ class TypeTray(Boxes):
|
||||||
self.rectangularHole(x/2.0, self.gh*1.5, self.gw, self.gh, r)
|
self.rectangularHole(x/2.0, self.gh*1.5, self.gw, self.gh, r)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
if self.outside:
|
||||||
|
self.sx = self.adjustSize(self.sx)
|
||||||
|
self.sy = self.adjustSize(self.sy)
|
||||||
|
self.h = self.adjustSize(self.h, e2=False)
|
||||||
|
if self.hi:
|
||||||
|
self.hi = self.adjustSize(self.hi, e2=False)
|
||||||
|
|
||||||
x = sum(self.sx) + self.thickness * (len(self.sx)-1)
|
x = sum(self.sx) + self.thickness * (len(self.sx)-1)
|
||||||
y = sum(self.sy) + self.thickness * (len(self.sy)-1)
|
y = sum(self.sy) + self.thickness * (len(self.sy)-1)
|
||||||
h = self.h
|
h = self.h
|
||||||
|
|
Loading…
Reference in New Issue