summaryrefslogtreecommitdiff
path: root/gerber/cam.py
diff options
context:
space:
mode:
Diffstat (limited to 'gerber/cam.py')
-rw-r--r--gerber/cam.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/gerber/cam.py b/gerber/cam.py
index c567055..28918cb 100644
--- a/gerber/cam.py
+++ b/gerber/cam.py
@@ -72,9 +72,10 @@ class FileSettings(object):
elif zero_suppression is not None:
if zero_suppression not in ['leading', 'trailing']:
- raise ValueError('Zero suppression must be either leading or \
- trailling')
- self.zero_suppression = zero_suppression
+ # This is a common problem in Eagle files, so just suppress it
+ self.zero_suppression = 'leading'
+ else:
+ self.zero_suppression = zero_suppression
elif zeros is not None:
if zeros not in ['leading', 'trailing']:
@@ -165,6 +166,10 @@ class FileSettings(object):
self.zero_suppression == other.zero_suppression and
self.format == other.format and
self.angle_units == other.angle_units)
+
+ def __str__(self):
+ return ('<Settings: %s %s %s %s %s>' %
+ (self.units, self.notation, self.zero_suppression, self.format, self.angle_units))
class CamFile(object):
@@ -243,7 +248,7 @@ class CamFile(object):
"""
pass
- def render(self, ctx, filename=None):
+ def render(self, ctx, invert=False, filename=None):
""" Generate image of layer.
Parameters
@@ -254,12 +259,18 @@ class CamFile(object):
filename : string <optional>
If provided, save the rendered image to `filename`
"""
+
ctx.set_bounds(self.bounds)
ctx._paint_background()
- if ctx.invert:
- ctx._paint_inverted_layer()
+ if invert:
+ ctx.invert = True
+ ctx._clear_mask()
for p in self.primitives:
ctx.render(p)
+ if invert:
+ ctx.invert = False
+ ctx._render_mask()
+
if filename is not None:
ctx.dump(filename)