- fixed errors in the Roland preprocessors

- fixed CNCJob plot scaling when using Roland preprocessors
- in Roland preprocessors added the use of spindlespeed
- made sure that the preprocessors that don't use the gcode_header still use the start gcode
This commit is contained in:
Marius Stanciu
2021-07-23 23:39:25 +03:00
committed by Marius
parent db2c70a0a2
commit 4d60e5c197
5 changed files with 47 additions and 26 deletions

View File

@@ -7,6 +7,14 @@ CHANGELOG for FlatCAM beta
=================================================
23.07.2021
- fixed errors in the Roland preprocessors
- fixed CNCJob plot scaling when using Roland preprocessors
- in Roland preprocessors added the use of spindlespeed
- made sure that the preprocessors that don't use the gcode_header still use the start gcode
21.07.2021
- when using the NCCAD9 preprocessor (for Kosy machines) at GCode save the .knc extension will be automatically preselected

View File

@@ -1014,21 +1014,18 @@ class CNCJobObject(FlatCAMObj, CNCjob):
else:
gcode += self.gcode
g = preamble + '\n' + gcode + '\n' + postamble
# g = self.gc_start + '\n' + preamble + '\n' + gcode + '\n' + postamble
g = ''
end_gcode = self.gcode_footer() if self.app.defaults['cncjob_footer'] is True else ''
if preamble != '' and postamble != '':
g = self.gc_start + '\n' + preamble + '\n' + gcode + '\n' + postamble + '\n' + end_gcode
if preamble == '':
g = self.gc_start + '\n' + gcode + '\n' + postamble + '\n' + end_gcode
if postamble == '':
g = self.gc_start + '\n' + preamble + '\n' + gcode + '\n' + end_gcode
if preamble == '' and postamble == '':
g = self.gc_start + '\n' + gcode + '\n' + end_gcode
else:
# search for the GCode beginning which is usually a G20 or G21
# fix so the preamble gets inserted in between the comments header and the actual start of GCODE
# g_idx = gcode.rfind('G20')
#
# # if it did not find 'G20' then search for 'G21'
# if g_idx == -1:
# g_idx = gcode.rfind('G21')
#
# # if it did not find 'G20' and it did not find 'G21' then there is an error and return
# if g_idx == -1:
# self.app.inform.emit('[ERROR_NOTCL] %s' % _("G-code does not have a units code: either G20 or G21"))
# return
# detect if using multi-tool and make the Gcode summation correctly for each case
if self.multitool is True:
# for the case that self.tools is empty: old projects

View File

@@ -6324,8 +6324,8 @@ class CNCjob(Geometry):
match_z = re.search(r"^Z(\s*-?\d+\.\d+?),(\s*\s*-?\d+\.\d+?),(\s*\s*-?\d+\.\d+?)*;$", gline)
if match_z:
command['G'] = 0
command['X'] = float(match_z.group(1).replace(" ", "")) * 0.025
command['Y'] = float(match_z.group(2).replace(" ", "")) * 0.025
command['X'] = float(match_z.group(1).replace(" ", "")) * 0.01
command['Y'] = float(match_z.group(2).replace(" ", "")) * 0.01
command['Z'] = float(match_z.group(3).replace(" ", "")) * 0.025
elif 'hpgl' in self.pp_excellon_name or 'hpgl' in self.pp_geometry_name:

View File

@@ -74,9 +74,9 @@ class Roland_MDX_20(PreProc):
def linear_code(self, p):
if p.units.upper() == 'IN':
z = p.z / 25.4
z = p.z_cut / 25.4
else:
z = p.z
z = p.z_cut
gcode = self.feedrate_code(p) + '\n'
gcode += self.position_code(p).format(**p) + ',' + str(float(z * 40.0)) + ';'
return gcode
@@ -121,10 +121,18 @@ class Roland_MDX_20(PreProc):
return 'V' + str(self.feedrate_format % fr_sec) + ';'
def spindle_code(self, p):
return '!MC1'
speed = int(p.spindlespeed)
if speed > 8388607:
speed = 8388607
if speed < 0:
speed = 0
gcode = '!MC1;\n'
gcode += '!RC%d;' % speed
return gcode
def dwell_code(self, p):
return''
return ''
def spindle_stop_code(self, p):
return '!MC0'
return '!MC0;'

View File

@@ -72,9 +72,9 @@ class Roland_MDX_540(PreProc):
def linear_code(self, p):
if p.units.upper() == 'IN':
z = p.z / 25.4
z = p.z_cut / 25.4
else:
z = p.z
z = p.z_cut
gcode = self.feedrate_code(p) + '\n'
gcode += self.position_code(p).format(**p) + ',' + str(float(z * 100.0)) + ';'
return gcode
@@ -119,10 +119,18 @@ class Roland_MDX_540(PreProc):
return 'V' + str(self.feedrate_format % fr_sec) + ';'
def spindle_code(self, p):
return '!MC1'
speed = int(p.spindlespeed)
if speed > 8388607:
speed = 8388607
if speed < 0:
speed = 0
gcode = '!MC1;\n'
gcode += '!RC%d;' % speed
return gcode
def dwell_code(self, p):
return''
return ''
def spindle_stop_code(self, p):
return '!MC0'
return '!MC0;'