MagazineFile: Add MountingEdge
This commit is contained in:
parent
20f45224fb
commit
7f67bae793
|
@ -15,17 +15,22 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from boxes import *
|
from boxes import *
|
||||||
|
from boxes.lids import _TopEdge
|
||||||
|
|
||||||
class MagazinFile(Boxes):
|
class MagazinFile(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", "outside")
|
self.buildArgParser(x=100, y=200, h=300, hi=0, outside=False)
|
||||||
self.addSettingsArgs(edges.FingerJointSettings)
|
self.addSettingsArgs(edges.FingerJointSettings)
|
||||||
|
self.addSettingsArgs(edges.MountingSettings, margin=0, num=1)
|
||||||
|
self.argparser.add_argument(
|
||||||
|
"--top_edge", action="store",
|
||||||
|
type=ArgparseEdgeType("eG"), choices=list("eG"),
|
||||||
|
default="e", help="edge type for top edge")
|
||||||
|
|
||||||
def side(self, w, h, hi):
|
def side(self, w, h, hi, top_edge):
|
||||||
r = min(h - hi, w) / 2.0
|
r = min(h - hi, w) / 2.0
|
||||||
|
|
||||||
if (h - hi) > w:
|
if (h - hi) > w:
|
||||||
|
@ -37,6 +42,8 @@ class MagazinFile(Boxes):
|
||||||
lx = (w - 2 * r) / 2.0
|
lx = (w - 2 * r) / 2.0
|
||||||
ly = 0
|
ly = 0
|
||||||
|
|
||||||
|
top_edge = self.edges.get(top_edge, top_edge)
|
||||||
|
|
||||||
e_w = self.edges["F"].startwidth()
|
e_w = self.edges["F"].startwidth()
|
||||||
self.moveTo(3, 3)
|
self.moveTo(3, 3)
|
||||||
self.edge(e_w)
|
self.edge(e_w)
|
||||||
|
@ -47,11 +54,11 @@ class MagazinFile(Boxes):
|
||||||
self.edges["F"](hi)
|
self.edges["F"](hi)
|
||||||
self.corner(90)
|
self.corner(90)
|
||||||
self.edge(e_w)
|
self.edge(e_w)
|
||||||
self.edge(lx)
|
top_edge(lx)
|
||||||
self.corner(-90, r)
|
self.corner(-90, r)
|
||||||
self.edge(ly)
|
self.edge(ly)
|
||||||
self.corner(90, r)
|
self.corner(90, r)
|
||||||
self.edge(lx)
|
top_edge(lx)
|
||||||
self.edge(e_w)
|
self.edge(e_w)
|
||||||
self.corner(90)
|
self.corner(90)
|
||||||
self.edges["F"](h)
|
self.edges["F"](h)
|
||||||
|
@ -68,17 +75,18 @@ class MagazinFile(Boxes):
|
||||||
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
|
||||||
|
t1, t2, t3, t4 = _TopEdge.topEdges(self, self.top_edge)
|
||||||
|
|
||||||
|
|
||||||
with self.saved_context():
|
with self.saved_context():
|
||||||
self.rectangularWall(x, h, "Ffef", move="up")
|
self.rectangularWall(x, h, "Ff"+t2+"f", move="up")
|
||||||
self.rectangularWall(x, hi, "Ffef", move="up")
|
self.rectangularWall(x, hi, "Ffef", move="up")
|
||||||
self.rectangularWall(x, y, "ffff")
|
self.rectangularWall(x, y, "ffff")
|
||||||
|
|
||||||
self.rectangularWall(x, h, "Ffef", move="right only")
|
self.rectangularWall(x, h, "Ffef", move="right only")
|
||||||
self.side(y, h, hi)
|
self.side(y, h, hi, t1)
|
||||||
self.moveTo(y + 15, h + hi + 15, 180)
|
self.moveTo(y + 15, h + hi + 15, 180)
|
||||||
self.side(y, h, hi)
|
self.side(y, h, hi, t3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue