Add SlatWallHoleEdge (dD) classes

Similar to FigerHolesEdge (h)
This commit is contained in:
Florian Festi 2019-06-21 18:47:29 +02:00
parent 9415a6864f
commit 5cef906a9a
2 changed files with 40 additions and 2 deletions

View File

@ -2007,6 +2007,7 @@ Values:
* relative (in multiples of thickness)
* hook_extra_height : 2.0 : space surrounding connectors (in multiples of thickness)
* edge_width : 1.0 : space below holes of FingerHoleEdge
"""
@ -2015,15 +2016,18 @@ Values:
relative_params = {
"hook_extra_height" : 2.0,
"edge_width": 1.0,
}
def edgeObjects(self, boxes, chars="aAbBcC", add=True):
def edgeObjects(self, boxes, chars="aAbBcCdD", add=True):
edges = [SlatWallEdge(boxes, self),
SlatWallEdgeReversed(boxes, self),
SlatWallJoinedEdge(boxes, self),
SlatWallJoinedEdgeReversed(boxes, self),
SlatWallBackEdge(boxes, self),
SlatWallBackEdgeReversed(boxes, self),
SlatWallHoleEdge(boxes, self),
SlatWallHoleEdgeReversed(boxes, self),
]
return self._edgeObjects(edges, boxes, chars, add)
@ -2181,3 +2185,35 @@ class SlatWallHoles(SlatWallEdge):
length - 2 * b, width - 2 * b)
SlatWallEdge.__call__(self, length)
class SlatWallHoleEdge(BaseEdge):
"""Edge with holes for a parallel finger joint"""
char = 'd'
description = "Edge (parallel slot wall Holes)"
reversed_ = False
def __init__(self, boxes, slatWallHoles=None, **kw):
settings = None
if isinstance(slatWallHoles, Settings):
settings = slatWallHoles
slatWallHoles = SlatWallHoles(boxes, settings)
super(SlatWallHoleEdge, self).__init__(boxes, settings, **kw)
self.slatWallHoles = slatWallHoles or boxes.slatWallHolesAt
def __call__(self, length, bedBolts=None, bedBoltSettings=None, **kw):
dist = self.slatWallHoles.settings.edge_width
with self.saved_context():
px, angle = (0, 0) if self.reversed_ else (length, 180)
self.slatWallHoles(
px, dist + self.settings.thickness / 2, length, angle)
self.edge(length, tabs=2)
def startwidth(self):
""" """
return self.slatWallHoles.settings.edge_width + self.settings.thickness
class SlatWallHoleEdgeReversed(SlatWallHoleEdge):
char = "D"
reversed_ = True

View File

@ -37,7 +37,7 @@ class SlatwallEdges(Boxes):
h = self.h
for i, c in enumerate("aAbBcC"):
for i, c in enumerate("aAbBcCdD"):
self.text(c, x=i*30+15, y=5)
self.text("slatWallHolesAt", 115, 15)
self.moveTo(0, 25)
@ -45,3 +45,5 @@ class SlatwallEdges(Boxes):
self.rectangularWall(40, h, "eBeb", move="right")
self.rectangularWall(40, h, "eCec", callback=[
lambda: self.slatWallHolesAt(20, 0, h, 90)], move="right")
self.moveTo(10)
self.rectangularWall(40, h, "eDed", move="right")