summaryrefslogtreecommitdiff
path: root/gerber
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-05-28 17:03:40 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-05-28 17:03:40 +0800
commitea97d9d0376db6ff7afcc7669eec84a228f8d201 (patch)
tree624bf71a375f1d52798d4cd76f3de6cad839e834 /gerber
parent5a20b2b92dc7ab82e1f196d1efbf4bb52a163720 (diff)
downloadgerbonara-ea97d9d0376db6ff7afcc7669eec84a228f8d201.tar.gz
gerbonara-ea97d9d0376db6ff7afcc7669eec84a228f8d201.tar.bz2
gerbonara-ea97d9d0376db6ff7afcc7669eec84a228f8d201.zip
Fix issue with switching between ROUT and normal drill modes
Diffstat (limited to 'gerber')
-rw-r--r--gerber/render/excellon_backend.py10
-rw-r--r--gerber/render/rs274x_backend.py13
2 files changed, 16 insertions, 7 deletions
diff --git a/gerber/render/excellon_backend.py b/gerber/render/excellon_backend.py
index c477036..da5b22b 100644
--- a/gerber/render/excellon_backend.py
+++ b/gerber/render/excellon_backend.py
@@ -142,9 +142,9 @@ class ExcellonContext(GerberContext):
self.handled_tools.add(tool)
self.header.append(ExcellonTool.from_tool(tool))
- if tool != self.cur_tool:
- self.body.append(ToolSelectionStmt(tool.number))
- self.cur_tool = tool
+ if tool != self.cur_tool:
+ self.body.append(ToolSelectionStmt(tool.number))
+ self.cur_tool = tool
# Two types of drilling - normal drill and slots
if slot.hit.slot_type == DrillSlot.TYPE_ROUT:
@@ -172,8 +172,8 @@ class ExcellonContext(GerberContext):
point = self._simplify_point(slot.end)
self._pos = slot.end
self.body.append(CoordinateStmt.from_point(point, mode="LINEAR"))
-
- self.drill_down = ExcellonContext.MODE_SLOT
+
+ self.drill_mode = ExcellonContext.MODE_SLOT
else:
# This is a G85 slot, so do this in normally drilling mode
diff --git a/gerber/render/rs274x_backend.py b/gerber/render/rs274x_backend.py
index 2ca7014..bb784b1 100644
--- a/gerber/render/rs274x_backend.py
+++ b/gerber/render/rs274x_backend.py
@@ -331,7 +331,11 @@ class Rs274xContext(GerberContext):
def _hash_amacro(self, amgroup):
'''Calculate a very quick hash code for deciding if we should even check AM groups for comparision'''
- hash = ''
+ # We always start with an X because this forms part of the name
+ # Basically, in some cases, the name might start with a C, R, etc. That can appear
+ # to conflict with normal aperture definitions. Technically, it shouldn't because normal
+ # aperture definitions should have a comma, but in some cases the commit is omitted
+ hash = 'X'
for primitive in amgroup.primitives:
hash += primitive.__class__.__name__[0]
@@ -348,6 +352,11 @@ class Rs274xContext(GerberContext):
hash += str(primitive.height * 1000000)[0:2]
elif isinstance(primitive, Circle):
hash += str(primitive.diameter * 1000000)[0:2]
+
+ if len(hash) > 20:
+ # The hash might actually get quite complex, so stop before
+ # it gets too long
+ break
return hash
@@ -361,7 +370,7 @@ class Rs274xContext(GerberContext):
if macroinfo:
- # We hae a definition, but check that the groups actually are the same
+ # We have a definition, but check that the groups actually are the same
for macro in macroinfo:
# Macros should have positions, right? But if the macro is selected for non-flashes