Merged in marius_stanciu/flatcam_beta/Beta (pull request #260)
Beta - some fixes to the hpgl preprocessor
This commit is contained in:
commit
999837a9cd
|
@ -6760,6 +6760,37 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
|
|
||||||
end_gcode = self.gcode_footer() if self.app.defaults['cncjob_footer'] is True else ''
|
end_gcode = self.gcode_footer() if self.app.defaults['cncjob_footer'] is True else ''
|
||||||
|
|
||||||
|
# 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:
|
try:
|
||||||
g_idx = gcode.index('G94')
|
g_idx = gcode.index('G94')
|
||||||
g = self.gcode_header() + gcode[:g_idx + 3] + '\n\n' + preamble + '\n' + \
|
g = self.gcode_header() + gcode[:g_idx + 3] + '\n\n' + preamble + '\n' + \
|
||||||
|
|
|
@ -20,7 +20,8 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
- updated the preprocessor files
|
- updated the preprocessor files
|
||||||
- fixed the HPGL preprocessor
|
- fixed the HPGL preprocessor
|
||||||
- fixed the CNCJob geometry created with 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
|
15.12.2019
|
||||||
|
|
||||||
|
|
|
@ -111,9 +111,9 @@ class HPGL2:
|
||||||
self.initialize_re = re.compile(r'^(IN);?$')
|
self.initialize_re = re.compile(r'^(IN);?$')
|
||||||
|
|
||||||
# Absolute linear interpolation
|
# 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
|
# 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
|
# Circular interpolation with radius
|
||||||
self.circ_re = re.compile(r"^CI\s*(\+?\d+\.?\d+?)?\s*;?\s*$")
|
self.circ_re = re.compile(r"^CI\s*(\+?\d+\.?\d+?)?\s*;?\s*$")
|
||||||
|
|
Loading…
Reference in New Issue