- work in progress to Toolchange_Custom code replacememnt -> finished the parse and replace function
This commit is contained in:
@@ -1343,9 +1343,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
||||
|
||||
self.multigeo = True
|
||||
|
||||
# search for toolchange parameters in the Toolchange Custom Code
|
||||
self.re_toolchange_custom = re.compile(r'^.*%([a-zA-Z0-9]+)%.*')
|
||||
|
||||
# Attributes to be included in serialization
|
||||
# Always append to it because it carries contents
|
||||
# from predecessors.
|
||||
@@ -2256,17 +2253,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
|
||||
self.ui.feedrate_probe_entry.setVisible(False)
|
||||
self.ui.feedrate_probe_label.hide()
|
||||
|
||||
def parse_custom_toolchange_code(self, data):
|
||||
|
||||
toolchange_gcode = ''
|
||||
|
||||
lines = StringIO(data)
|
||||
for line in lines:
|
||||
match = self.re_toolchange_custom.search(line)
|
||||
if match:
|
||||
command = match.group(1)
|
||||
print(globals()[command])
|
||||
|
||||
def on_create_cncjob_button_click(self, *args):
|
||||
self.app.report_usage("excellon_on_create_cncjob_button")
|
||||
self.read_form()
|
||||
@@ -2759,9 +2745,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
||||
# the default value is False
|
||||
self.multigeo = False
|
||||
|
||||
# search for toolchange parameters in the Toolchange Custom Code
|
||||
self.re_toolchange_custom = re.compile(r'^.*%([a-zA-Z0-9]+)%.*')
|
||||
|
||||
# flag to store if the geometry is part of a special group of geometries that can't be processed by the default
|
||||
# engine of FlatCAM. Most likely are generated by some of tools and are special cases of geometries.
|
||||
self. special_group = None
|
||||
@@ -3866,17 +3849,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
|
||||
self.ui.feedrate_probe_entry.setVisible(False)
|
||||
self.ui.feedrate_probe_label.hide()
|
||||
|
||||
def parse_custom_toolchange_code(self, data):
|
||||
|
||||
toolchange_gcode = ''
|
||||
|
||||
lines = StringIO(data)
|
||||
for line in lines:
|
||||
match = self.re_toolchange_custom.search(line)
|
||||
if match:
|
||||
command = match.group(1)
|
||||
print(globals()[command])
|
||||
|
||||
def on_generatecnc_button_click(self, *args):
|
||||
|
||||
self.app.report_usage("geometry_on_generatecnc_button")
|
||||
@@ -5388,6 +5360,13 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||
|
||||
g = gcode[:g_idx] + preamble + '\n' + gcode[g_idx:] + postamble
|
||||
|
||||
# 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:
|
||||
# match = self.re_toolchange.search(g)
|
||||
if 'M6' in g:
|
||||
m6_code = self.parse_custom_toolchange_code(self.ui.toolchange_text.get_value())
|
||||
g = g.replace('M6', m6_code)
|
||||
|
||||
# lines = StringIO(self.gcode)
|
||||
lines = StringIO(g)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user