- fixed the Repeated code parsing in Excellon Parse
This commit is contained in:
parent
280eb1dc3a
commit
376c8058d9
|
@ -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
|
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)
|
- 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)
|
match = self.coordsnoperiod_re.search(eline)
|
||||||
if match:
|
if match:
|
||||||
matchr = self.repeat_re.search(eline)
|
matchr = self.repeat_re.search(eline)
|
||||||
if matchr:
|
if matchr: # if we have a repeat command
|
||||||
repeat = int(matchr.group(1))
|
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:
|
try:
|
||||||
x = self.parse_number(match.group(1))
|
x = self.parse_number(match.group(1))
|
||||||
repeating_x = current_x
|
|
||||||
current_x = x
|
current_x = x
|
||||||
except TypeError:
|
except TypeError:
|
||||||
x = current_x
|
x = current_x
|
||||||
repeating_x = 0
|
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
y = self.parse_number(match.group(2))
|
y = self.parse_number(match.group(2))
|
||||||
repeating_y = current_y
|
|
||||||
current_y = y
|
current_y = y
|
||||||
except TypeError:
|
except TypeError:
|
||||||
y = current_y
|
y = current_y
|
||||||
repeating_y = 0
|
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -677,21 +699,9 @@ class Excellon(Geometry):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.match_routing_start is None and self.match_routing_stop is None:
|
if self.match_routing_start is None and self.match_routing_stop is None:
|
||||||
if repeat == 0:
|
|
||||||
# signal that there are drill operations
|
# signal that there are drill operations
|
||||||
self.defaults['excellon_drills'] = True
|
self.defaults['excellon_drills'] = True
|
||||||
self.drills.append({'point': Point((x, y)), 'tool': current_tool})
|
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))
|
# log.debug("{:15} {:8} {:8}".format(eline, x, y))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue