Add color selection to all holes
All methods that uses the holeCol decorator now take a parameter color. Added semantic symbols for colors.
This commit is contained in:
parent
c86ae75712
commit
9a46882c8f
|
@ -4,3 +4,9 @@ class Color:
|
||||||
GREEN = [ 0.0, 1.0, 0.0 ]
|
GREEN = [ 0.0, 1.0, 0.0 ]
|
||||||
RED = [ 1.0, 0.0, 0.0 ]
|
RED = [ 1.0, 0.0, 0.0 ]
|
||||||
WHITE = [ 1.0, 1.0, 1.0 ]
|
WHITE = [ 1.0, 1.0, 1.0 ]
|
||||||
|
|
||||||
|
# TODO: Make this configurable
|
||||||
|
OUTER_CUT = BLACK
|
||||||
|
INNER_CUT = BLUE
|
||||||
|
ANNOTATIONS = RED
|
||||||
|
ETCHING = GREEN
|
||||||
|
|
|
@ -72,9 +72,14 @@ def holeCol(func):
|
||||||
|
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def f(self, *args, **kw):
|
def f(self, *args, **kw):
|
||||||
|
if "color" in kw:
|
||||||
|
color = kw.pop("color")
|
||||||
|
else:
|
||||||
|
color = Color.INNER_CUT
|
||||||
|
|
||||||
self.ctx.stroke()
|
self.ctx.stroke()
|
||||||
with self.saved_context():
|
with self.saved_context():
|
||||||
self.set_source_color(Color.BLUE)
|
self.set_source_color(color)
|
||||||
func(self, *args, **kw)
|
func(self, *args, **kw)
|
||||||
self.ctx.stroke()
|
self.ctx.stroke()
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,7 @@ class DrillBox(Boxes):
|
||||||
for k in range(self.holes):
|
for k in range(self.holes):
|
||||||
self.hole(x + dx / 2, y + (k + 0.5) * iy, d + 0.05)
|
self.hole(x + dx / 2, y + (k + 0.5) * iy, d + 0.05)
|
||||||
if description:
|
if description:
|
||||||
self.rectangularHole(x + dx / 2, y + dy / 2, dx - 2, dy - 2)
|
self.rectangularHole(x + dx / 2, y + dy / 2, dx - 2, dy - 2, color=Color.ETCHING)
|
||||||
# TODO: make the "hole" green to indicate etching
|
|
||||||
self.text(
|
self.text(
|
||||||
"%.1f" % d,
|
"%.1f" % d,
|
||||||
x + 2,
|
x + 2,
|
||||||
|
@ -75,7 +74,7 @@ class DrillBox(Boxes):
|
||||||
270,
|
270,
|
||||||
align="right",
|
align="right",
|
||||||
fontsize=6,
|
fontsize=6,
|
||||||
color=Color.GREEN,
|
color=Color.ETCHING,
|
||||||
)
|
)
|
||||||
# TODO: make the fontsize dynamic to make the text fit in all cases
|
# TODO: make the fontsize dynamic to make the text fit in all cases
|
||||||
d += self.holeincrement
|
d += self.holeincrement
|
||||||
|
|
|
@ -147,3 +147,20 @@ settings to the user. In the web interface they are folded up. In the
|
||||||
command line interfacce they are grouped together. Users should be
|
command line interfacce they are grouped together. Users should be
|
||||||
aware that not all settings are practical to change. For now Boxes.py
|
aware that not all settings are practical to change. For now Boxes.py
|
||||||
does not allow hiding some settings.
|
does not allow hiding some settings.
|
||||||
|
|
||||||
|
Colors
|
||||||
|
------
|
||||||
|
The generated files uses the following color conventions:
|
||||||
|
|
||||||
|
.. glossary::
|
||||||
|
Black
|
||||||
|
The outer edges of a part
|
||||||
|
Blue
|
||||||
|
Inner edges of a part
|
||||||
|
Red
|
||||||
|
Comments or help lines that are not ment to be cut or etched
|
||||||
|
Green
|
||||||
|
Etchings
|
||||||
|
|
||||||
|
Normaly you will cut things in the order: Green, Blue, Black. If other
|
||||||
|
colors are present, the meaning should hopefully be obvious.
|
Loading…
Reference in New Issue