- Levelling Tool - disable the UI if the Gcode is not segmented for autolevelling (perhaps recreate the GCode as segmented?)

- in camlib.CNCjob class fixed the linear2gcode_extra() method to be able to do GCode segmentation.
This commit is contained in:
Marius Stanciu
2021-01-04 16:52:23 +02:00
committed by Marius
parent e726899167
commit 2aab71e037
4 changed files with 27 additions and 3 deletions

View File

@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
=================================================
4.01.2020
- Levelling Tool - disable the UI if the Gcode is not segmented for autolevelling (perhaps recreate the GCode as segmented?)
- in camlib.CNCjob class fixed the linear2gcode_extra() method to be able to do GCode segmentation.
3.01.2021
- fixed the Tcl Commands: new_geometry, new_gerber and new_excellon to create correct objects. New Geometry object created with the new_geometry Tcl command accept now the usage of add_circle/polygon/polyline/rectangle Tcl commands

View File

@@ -1968,6 +1968,11 @@ class ToolDrilling(AppTool, Excellon):
job_obj.fr_decimals = int(self.app.defaults["cncjob_fr_decimals"])
job_obj.multitool = True
# it does not matter for the Excellon codes because we are not going to autolevel GCode out of Excellon
# but it is here for uniformity between the Geometry and Excellon objects
job_obj.segx = self.app.defaults["geometry_segx"]
job_obj.segy = self.app.defaults["geometry_segy"]
# first drill point
job_obj.xy_toolchange = self.app.defaults["tools_drill_toolchangexy"]
x_tc, y_tc = [0, 0]

View File

@@ -293,7 +293,7 @@ class ToolLevelling(AppTool, CNCjob):
self.ui.al_method_radio.set_value('v')
target_obj = self.app.collection.get_by_name(self.ui.object_combo.get_value())
if target_obj:
if target_obj and target_obj.is_segmented_gcode is True:
self.ui.al_frame.setDisabled(False)
self.ui.al_mode_radio.set_value(target_obj.options['tools_al_mode'])
self.on_controller_change()
@@ -327,7 +327,7 @@ class ToolLevelling(AppTool, CNCjob):
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Could not retrieve object"), str(obj_name)))
return
if target_obj is None:
if target_obj is None or target_obj.is_segmented_gcode is False:
self.ui.al_frame.setDisabled(True)
else:
self.ui.al_frame.setDisabled(False)

View File

@@ -2769,6 +2769,9 @@ class CNCjob(Geometry):
# search for toolchange code: M6
self.re_toolchange = re.compile(r'^\s*(M6)$')
# tells if the generated Gcode is segmented for autolevelling
self.is_segmented_gcode = False
# Attributes to be included in serialization
# Always append to it because it carries contents
# from Geometry.
@@ -3122,6 +3125,12 @@ class CNCjob(Geometry):
"""
log.debug("Creating CNC Job from Excellon for tool: %s" % str(tool))
# detect if GCode is segmented for autolevelling or not
# it does not matter for the Excellon codes because we are not going to autolevel GCode out of Excellon
# but it is here for uniformity between the Geometry and Excellon objects
if self.segx > 0 and self.segy > 0 and self.is_segmented_gcode is False:
self.is_segmented_gcode = True
self.exc_tools = deepcopy(tools)
t_gcode = ''
@@ -6912,6 +6921,10 @@ class CNCjob(Geometry):
if len(coords) < 2 or self.segx <= 0 and self.segy <= 0:
return list(coords)
# flag that the generated gcode was segmented for autolevelling
if self.is_segmented_gcode is False:
self.is_segmented_gcode = True
path = [coords[0]]
# break the line in either x or y dimension only
@@ -7155,7 +7168,8 @@ class CNCjob(Geometry):
gcode = ""
path = list(target_linear.coords)
# path = list(target_linear.coords)
path = self.segment(target_linear.coords)
p = self.pp_geometry
self.coordinates_type = self.app.defaults["cncjob_coords_type"]