parent
46f1e1d440
commit
a7f0e97012
|
@ -297,6 +297,8 @@ class Boxes:
|
||||||
self.edges = {}
|
self.edges = {}
|
||||||
self.addPart(edges.Edge(self, None))
|
self.addPart(edges.Edge(self, None))
|
||||||
self.addPart(edges.OutSetEdge(self, None))
|
self.addPart(edges.OutSetEdge(self, None))
|
||||||
|
s = edges.GripSettings(self.thickness)
|
||||||
|
self.addPart(edges.GrippingEdge(self, s))
|
||||||
|
|
||||||
# Finger joints
|
# Finger joints
|
||||||
# Share settings object
|
# Share settings object
|
||||||
|
|
|
@ -211,6 +211,79 @@ class OutSetEdge(BaseEdge):
|
||||||
def startwidth(self):
|
def startwidth(self):
|
||||||
return self.boxes.thickness
|
return self.boxes.thickness
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
#### Gripping Edge
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
class GripSettings(Settings):
|
||||||
|
"""Settings for GrippingEdge
|
||||||
|
Values:
|
||||||
|
|
||||||
|
* absolute_params
|
||||||
|
|
||||||
|
* style : A : "A" (wiggly line) or "B" (bumps)
|
||||||
|
* outset : True : extend outward the straight edge
|
||||||
|
|
||||||
|
* relative (in multiples of thickness)
|
||||||
|
|
||||||
|
* depth : 0.3 : depth of the grooves
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
absolute_params = {
|
||||||
|
"style" : "A",
|
||||||
|
"outset" : True,
|
||||||
|
}
|
||||||
|
|
||||||
|
relative_params = {
|
||||||
|
"depth" : 0.3,
|
||||||
|
}
|
||||||
|
|
||||||
|
class GrippingEdge(BaseEdge):
|
||||||
|
description = """Corrugated edge useful as an gipping area"""
|
||||||
|
char = 'g'
|
||||||
|
|
||||||
|
|
||||||
|
def A(self, length):
|
||||||
|
depth = self.settings.depth
|
||||||
|
grooves = int(length // (depth*2.0)) + 1
|
||||||
|
depth = length / grooves / 4.0
|
||||||
|
|
||||||
|
o = 1 if self.settings.outset else -1
|
||||||
|
for groove in range(grooves):
|
||||||
|
self.corner(o * -90, depth)
|
||||||
|
self.corner(o * 180, depth)
|
||||||
|
self.corner(o * -90, depth)
|
||||||
|
|
||||||
|
def B(self, length):
|
||||||
|
depth = self.settings.depth
|
||||||
|
grooves = int(length // (depth*2.0)) + 1
|
||||||
|
depth = length / grooves / 2.0
|
||||||
|
o = 1 if self.settings.outset else -1
|
||||||
|
if self.settings.outset:
|
||||||
|
self.corner(-90)
|
||||||
|
else:
|
||||||
|
self.corner(90)
|
||||||
|
self.edge(depth)
|
||||||
|
self.corner(-180)
|
||||||
|
for groove in range(grooves):
|
||||||
|
self.corner(180, depth)
|
||||||
|
self.corner(-180, 0)
|
||||||
|
if self.settings.outset:
|
||||||
|
self.corner(90)
|
||||||
|
else:
|
||||||
|
self.edge(depth)
|
||||||
|
self.corner(90)
|
||||||
|
|
||||||
|
def margin(self):
|
||||||
|
if self.settings.outset:
|
||||||
|
return self.settings.depth + self.boxes.spacing
|
||||||
|
else:
|
||||||
|
return self.boxes.spacing
|
||||||
|
|
||||||
|
def __call__(self, length, **kw):
|
||||||
|
getattr(self, self.settings.style)(length)
|
||||||
|
|
||||||
class CompoundEdge(BaseEdge):
|
class CompoundEdge(BaseEdge):
|
||||||
"""Edge composed of multiple different Edges"""
|
"""Edge composed of multiple different Edges"""
|
||||||
description = "Compound Edge"
|
description = "Compound Edge"
|
||||||
|
|
|
@ -5,17 +5,18 @@ As edges started out as methods of the main Boxes class they still are
|
||||||
callables. A set of instances are kept the ``.edges`` attribute of the
|
callables. A set of instances are kept the ``.edges`` attribute of the
|
||||||
``Boxes`` class. It is a dict with strings of length one as keys:
|
``Boxes`` class. It is a dict with strings of length one as keys:
|
||||||
|
|
||||||
* e : Edge
|
|
||||||
* E : OutSetEdge
|
|
||||||
* s : StackableEdge
|
|
||||||
* S : StackableEdgeTop
|
|
||||||
* f : FingerJointEdge
|
|
||||||
* F : FingerJointEdgeCounterPart
|
|
||||||
* h : FingerHoleEdge
|
|
||||||
* d : DoveTailJoint
|
* d : DoveTailJoint
|
||||||
* D : DoveTailJointCounterPart
|
* D : DoveTailJointCounterPart
|
||||||
|
* e : Edge
|
||||||
|
* E : OutSetEdge
|
||||||
|
* f : FingerJointEdge
|
||||||
|
* F : FingerJointEdgeCounterPart
|
||||||
|
* g : GrippingEdge
|
||||||
|
* h : FingerHoleEdge
|
||||||
* ijk : Hinge (start, end, both sides)
|
* ijk : Hinge (start, end, both sides)
|
||||||
* IJK : HingePin (start, end, both sides)
|
* IJK : HingePin (start, end, both sides)
|
||||||
|
* s : StackableEdge
|
||||||
|
* S : StackableEdgeTop
|
||||||
|
|
||||||
Edges of the same type share a settings instance to make sure both
|
Edges of the same type share a settings instance to make sure both
|
||||||
sides match (when the same length is given).
|
sides match (when the same length is given).
|
||||||
|
@ -41,6 +42,12 @@ Straight Edges
|
||||||
.. autoclass:: boxes.edges.Edge
|
.. autoclass:: boxes.edges.Edge
|
||||||
.. autoclass:: boxes.edges.OutSetEdge
|
.. autoclass:: boxes.edges.OutSetEdge
|
||||||
|
|
||||||
|
Grip
|
||||||
|
----
|
||||||
|
|
||||||
|
.. autoclass:: boxes.edges.GripSettings
|
||||||
|
.. autoclass:: boxes.edges.GrippingEdge
|
||||||
|
|
||||||
Stackable Edges
|
Stackable Edges
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue