summaryrefslogtreecommitdiff
path: root/gerber
diff options
context:
space:
mode:
Diffstat (limited to 'gerber')
-rw-r--r--gerber/primitives.py3
-rw-r--r--gerber/render/cairo_backend.py3
-rw-r--r--gerber/rs274x.py6
3 files changed, 8 insertions, 4 deletions
diff --git a/gerber/primitives.py b/gerber/primitives.py
index 81c5837..944e34a 100644
--- a/gerber/primitives.py
+++ b/gerber/primitives.py
@@ -221,13 +221,14 @@ class Line(Primitive):
class Arc(Primitive):
"""
"""
- def __init__(self, start, end, center, direction, aperture, **kwargs):
+ def __init__(self, start, end, center, direction, aperture, quadrant_mode, **kwargs):
super(Arc, self).__init__(**kwargs)
self.start = start
self.end = end
self.center = center
self.direction = direction
self.aperture = aperture
+ self.quadrant_mode = quadrant_mode
self._to_convert = ['start', 'end', 'center', 'aperture']
@property
diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py
index fbc4271..7be7e6a 100644
--- a/gerber/render/cairo_backend.py
+++ b/gerber/render/cairo_backend.py
@@ -76,6 +76,9 @@ class GerberCairoContext(GerberContext):
radius = self.scale[0] * arc.radius
angle1 = arc.start_angle
angle2 = arc.end_angle
+ if angle1 == angle2 and arc.quadrant_mode != 'single-quadrant':
+ # Make the angles slightly different otherwise Cario will draw nothing
+ angle2 -= 0.000000001
if isinstance(arc.aperture, Circle):
width = arc.aperture.diameter if arc.aperture.diameter != 0 else 0.001
else:
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index 12400a1..bac5114 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -496,12 +496,12 @@ class GerberParser(object):
j = 0 if stmt.j is None else stmt.j
center = (start[0] + i, start[1] + j)
if self.region_mode == 'off':
- self.primitives.append(Arc(start, end, center, self.direction, self.apertures[self.aperture], level_polarity=self.level_polarity, units=self.settings.units))
+ self.primitives.append(Arc(start, end, center, self.direction, self.apertures[self.aperture], quadrant_mode=self.quadrant_mode, level_polarity=self.level_polarity, units=self.settings.units))
else:
if self.current_region is None:
- self.current_region = [Arc(start, end, center, self.direction, self.apertures.get(self.aperture, Circle((0,0), 0)), level_polarity=self.level_polarity, units=self.settings.units),]
+ self.current_region = [Arc(start, end, center, self.direction, self.apertures.get(self.aperture, Circle((0,0), 0)), quadrant_mode=self.quadrant_mode, level_polarity=self.level_polarity, units=self.settings.units),]
else:
- self.current_region.append(Arc(start, end, center, self.direction, self.apertures.get(self.aperture, Circle((0,0), 0)), level_polarity=self.level_polarity, units=self.settings.units))
+ self.current_region.append(Arc(start, end, center, self.direction, self.apertures.get(self.aperture, Circle((0,0), 0)), quadrant_mode=self.quadrant_mode, level_polarity=self.level_polarity, units=self.settings.units))
elif self.op == "D02" or self.op == "D2":
pass