- fixed GCode generated with HPGL preprocessor to output only integer coordinates
- fixed the HPGL2 import parsing for absolute linear movements
This commit is contained in:
parent
0574f7a039
commit
f857326687
|
@ -6760,15 +6760,46 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
|||
|
||||
end_gcode = self.gcode_footer() if self.app.defaults['cncjob_footer'] is True else ''
|
||||
|
||||
try:
|
||||
g_idx = gcode.index('G94')
|
||||
g = self.gcode_header() + gcode[:g_idx + 3] + '\n\n' + preamble + '\n' + \
|
||||
gcode[(g_idx + 3):] + postamble + end_gcode
|
||||
except ValueError:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' %
|
||||
_("G-code does not have a G94 code and we will not include the code in the "
|
||||
"'Prepend to GCode' text box"))
|
||||
g = self.gcode_header() + '\n' + gcode + postamble + end_gcode
|
||||
# detect if using a HPGL preprocessor
|
||||
hpgl = False
|
||||
if self.cnc_tools:
|
||||
for key in self.cnc_tools:
|
||||
if 'ppname_g' in self.cnc_tools[key]['data']:
|
||||
if 'hpgl' in self.cnc_tools[key]['data']['ppname_g']:
|
||||
hpgl = True
|
||||
break
|
||||
elif self.exc_cnc_tools:
|
||||
for key in self.cnc_tools:
|
||||
if 'ppname_e' in self.cnc_tools[key]['data']:
|
||||
if 'hpgl' in self.cnc_tools[key]['data']['ppname_e']:
|
||||
hpgl = True
|
||||
break
|
||||
|
||||
if hpgl:
|
||||
processed_gcode = ''
|
||||
pa_re = re.compile(r"^PA\s*(-?\d+\.\d*),?\s*(-?\d+\.\d*)*;?$")
|
||||
for gline in gcode.splitlines():
|
||||
match = pa_re.search(gline)
|
||||
if match:
|
||||
x_int = int(float(match.group(1)))
|
||||
y_int = int(float(match.group(2)))
|
||||
new_line = 'PA%d,%d;\n' % (x_int, y_int)
|
||||
processed_gcode += new_line
|
||||
else:
|
||||
processed_gcode += gline + '\n'
|
||||
|
||||
gcode = processed_gcode
|
||||
g = self.gcode_header() + '\n' + preamble + '\n' + gcode + postamble + end_gcode
|
||||
else:
|
||||
try:
|
||||
g_idx = gcode.index('G94')
|
||||
g = self.gcode_header() + gcode[:g_idx + 3] + '\n\n' + preamble + '\n' + \
|
||||
gcode[(g_idx + 3):] + postamble + end_gcode
|
||||
except ValueError:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' %
|
||||
_("G-code does not have a G94 code and we will not include the code in the "
|
||||
"'Prepend to GCode' text box"))
|
||||
g = self.gcode_header() + '\n' + gcode + postamble + end_gcode
|
||||
|
||||
# if toolchange custom is used, replace M6 code with the code from the Toolchange Custom Text box
|
||||
if self.ui.toolchange_cb.get_value() is True:
|
||||
|
|
|
@ -20,7 +20,8 @@ CAD program, and create G-Code for Isolation routing.
|
|||
- updated the preprocessor files
|
||||
- fixed the HPGL preprocessor
|
||||
- fixed the CNCJob geometry created with HPGL preprocessor
|
||||
|
||||
- fixed GCode generated with HPGL preprocessor to output only integer coordinates
|
||||
- fixed the HPGL2 import parsing for absolute linear movements
|
||||
|
||||
15.12.2019
|
||||
|
||||
|
|
|
@ -111,9 +111,9 @@ class HPGL2:
|
|||
self.initialize_re = re.compile(r'^(IN);?$')
|
||||
|
||||
# Absolute linear interpolation
|
||||
self.abs_move_re = re.compile(r"^PA\s*(-?\d+\.?\d+?),?\s*(-?\d+\.?\d+?)*;?$")
|
||||
self.abs_move_re = re.compile(r"^PA\s*(-?\d+\.?\d*),?\s*(-?\d+\.?\d*)*;?$")
|
||||
# Relative linear interpolation
|
||||
self.rel_move_re = re.compile(r"^PR\s*(-?\d+\.\d+?),?\s*(-?\d+\.\d+?)*;?$")
|
||||
self.rel_move_re = re.compile(r"^PR\s*(-?\d+\.?\d*),?\s*(-?\d+\.?\d*)*;?$")
|
||||
|
||||
# Circular interpolation with radius
|
||||
self.circ_re = re.compile(r"^CI\s*(\+?\d+\.?\d+?)?\s*;?\s*$")
|
||||
|
|
Loading…
Reference in New Issue