- fixed the Repeated code parsing in Excellon Parse
This commit is contained in:
@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
|
||||
|
||||
=================================================
|
||||
|
||||
4.04.2020
|
||||
|
||||
- fixed the Repeated code parsing in Excellon Parse
|
||||
|
||||
1.04.2020
|
||||
|
||||
- updated the SVG parser to take into consideration the 'Close' svg element and paths that are made from a single line (we may need to switch to svgpathtools module)
|
||||
|
||||
@@ -618,26 +618,48 @@ class Excellon(Geometry):
|
||||
match = self.coordsnoperiod_re.search(eline)
|
||||
if match:
|
||||
matchr = self.repeat_re.search(eline)
|
||||
if matchr:
|
||||
if matchr: # if we have a repeat command
|
||||
repeat = int(matchr.group(1))
|
||||
|
||||
if match.group(1):
|
||||
repeating_x = self.parse_number(match.group(1))
|
||||
else:
|
||||
repeating_x = 0
|
||||
|
||||
if match.group(2):
|
||||
repeating_y = self.parse_number(match.group(2))
|
||||
else:
|
||||
repeating_y = 0
|
||||
|
||||
coordx = current_x
|
||||
coordy = current_y
|
||||
|
||||
while repeat > 0:
|
||||
if repeating_x:
|
||||
coordx += repeating_x
|
||||
if repeating_y:
|
||||
coordy += repeating_y
|
||||
self.drills.append({'point': Point((coordx, coordy)), 'tool': current_tool})
|
||||
|
||||
repeat -= 1
|
||||
current_x = coordx
|
||||
current_y = coordy
|
||||
continue
|
||||
|
||||
else: # those are normal coordinates
|
||||
try:
|
||||
x = self.parse_number(match.group(1))
|
||||
repeating_x = current_x
|
||||
current_x = x
|
||||
except TypeError:
|
||||
x = current_x
|
||||
repeating_x = 0
|
||||
except Exception:
|
||||
return
|
||||
|
||||
try:
|
||||
y = self.parse_number(match.group(2))
|
||||
repeating_y = current_y
|
||||
current_y = y
|
||||
except TypeError:
|
||||
y = current_y
|
||||
repeating_y = 0
|
||||
except Exception:
|
||||
return
|
||||
|
||||
@@ -677,21 +699,9 @@ class Excellon(Geometry):
|
||||
continue
|
||||
|
||||
if self.match_routing_start is None and self.match_routing_stop is None:
|
||||
if repeat == 0:
|
||||
# signal that there are drill operations
|
||||
self.defaults['excellon_drills'] = True
|
||||
self.drills.append({'point': Point((x, y)), 'tool': current_tool})
|
||||
else:
|
||||
coordx = x
|
||||
coordy = y
|
||||
while repeat > 0:
|
||||
if repeating_x:
|
||||
coordx = (repeat * x) + repeating_x
|
||||
if repeating_y:
|
||||
coordy = (repeat * y) + repeating_y
|
||||
self.drills.append({'point': Point((coordx, coordy)), 'tool': current_tool})
|
||||
repeat -= 1
|
||||
repeating_x = repeating_y = 0
|
||||
# log.debug("{:15} {:8} {:8}".format(eline, x, y))
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user