Fix issue with switching between ROUT and normal drill modes

This commit is contained in:
Garret Fick 2016-05-28 17:03:40 +08:00
parent 5a20b2b92d
commit ea97d9d037
2 changed files with 16 additions and 7 deletions

View file

@ -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

View file

@ -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