- fixed the Voronoi generation in the Autolevelling Tool (removed the Foronoi package due of issues and now using the embedded functionality from Shapely)

- fixed the enable of Levelling Tool only for CNCJob objects that were made from geometries that were segmented
This commit is contained in:
Marius Stanciu
2023-01-17 01:02:52 +02:00
parent 853b273e79
commit 220157641d
2 changed files with 26 additions and 24 deletions

View File

@@ -11,6 +11,8 @@ CHANGELOG for FlatCAM Evo beta
- fixed a decoding error in the Excellon parser - fixed a decoding error in the Excellon parser
- some PEP8 fixes - some PEP8 fixes
- fixed the Voronoi generation in the Autolevelling Tool (removed the Foronoi package due of issues and now using the embedded functionality from Shapely)
- fixed the enable of Levelling Tool only for CNCJob objects that were made from geometries that were segmented
15.01.2023 15.01.2023

View File

@@ -118,7 +118,7 @@ class ToolLevelling(AppTool, CNCjob):
AppTool.install(self, icon, separator, shortcut='', **kwargs) AppTool.install(self, icon, separator, shortcut='', **kwargs)
def run(self, toggle=True): def run(self, toggle=True):
self.app.defaults.report_usage("ToolFollow()") self.app.defaults.report_usage("ToolLevelling()")
if toggle: if toggle:
# if the splitter is hidden, display it # if the splitter is hidden, display it
@@ -294,18 +294,8 @@ class ToolLevelling(AppTool, CNCjob):
self.ui.al_columns_entry.setDisabled(True) self.ui.al_columns_entry.setDisabled(True)
self.ui.al_columns_label.setDisabled(True) self.ui.al_columns_label.setDisabled(True)
self.ui.al_method_lbl.setDisabled(True) self.ui.al_method_lbl.setDisabled(True)
self.ui.al_method_radio.setDisabled(True)
self.ui.al_method_radio.set_value('v') self.ui.al_method_radio.set_value('v')
self.ui.al_method_radio.setDisabled(True)
if loaded_obj and loaded_obj.is_segmented_gcode is True and loaded_obj.obj_options["type"] == 'Geometry':
self.ui.al_frame.setDisabled(False)
self.ui.al_mode_radio.set_value(loaded_obj.obj_options['tools_al_mode'])
self.on_controller_change()
self.on_mode_radio(val=loaded_obj.obj_options['tools_al_mode'])
self.on_method_radio(val=loaded_obj.obj_options['tools_al_method'])
else:
self.ui.al_frame.setDisabled(True)
# Show/Hide Advanced Options # Show/Hide Advanced Options
app_mode = self.app.options["global_app_level"] app_mode = self.app.options["global_app_level"]
@@ -319,6 +309,16 @@ class ToolLevelling(AppTool, CNCjob):
self.build_tool_ui() self.build_tool_ui()
if loaded_obj and loaded_obj.is_segmented_gcode is True and loaded_obj.obj_options["type"] == 'Geometry':
self.ui.al_frame.setDisabled(False)
self.ui.al_mode_radio.set_value(loaded_obj.obj_options['tools_al_mode'])
self.on_controller_change()
self.on_mode_radio(val=loaded_obj.obj_options['tools_al_mode'])
self.on_method_radio(val=loaded_obj.obj_options['tools_al_method'])
else:
self.ui.al_frame.setDisabled(True)
def on_object_changed(self): def on_object_changed(self):
# load the object # load the object
@@ -342,8 +342,7 @@ class ToolLevelling(AppTool, CNCjob):
pool=self.app.pool) pool=self.app.pool)
else: else:
self.probing_shapes = ShapeCollectionLegacy(obj=self, app=self.app, name=obj_name + "_probing_shapes") self.probing_shapes = ShapeCollectionLegacy(obj=self, app=self.app, name=obj_name + "_probing_shapes")
return else:
self.ui.al_frame.setDisabled(True) self.ui.al_frame.setDisabled(True)
def on_object_selection_changed(self, current, previous): def on_object_selection_changed(self, current, previous):
@@ -997,13 +996,13 @@ class ToolLevelling(AppTool, CNCjob):
self.build_al_table() self.build_al_table()
if val == "manual": if val == "manual":
self.ui.al_method_radio.set_value('v')
self.ui.al_rows_entry.setDisabled(True) self.ui.al_rows_entry.setDisabled(True)
self.ui.al_rows_label.setDisabled(True) self.ui.al_rows_label.setDisabled(True)
self.ui.al_columns_entry.setDisabled(True) self.ui.al_columns_entry.setDisabled(True)
self.ui.al_columns_label.setDisabled(True) self.ui.al_columns_label.setDisabled(True)
self.ui.al_method_lbl.setDisabled(True) self.ui.al_method_lbl.setDisabled(True)
self.ui.al_method_radio.setDisabled(True) self.ui.al_method_radio.setDisabled(True)
self.ui.al_method_radio.set_value('v')
else: else:
self.ui.al_rows_entry.setDisabled(False) self.ui.al_rows_entry.setDisabled(False)
self.ui.al_rows_label.setDisabled(False) self.ui.al_rows_label.setDisabled(False)
@@ -1792,6 +1791,7 @@ class LevelUI:
self.al_box = QtWidgets.QVBoxLayout() self.al_box = QtWidgets.QVBoxLayout()
self.al_box.setContentsMargins(0, 0, 0, 0) self.al_box.setContentsMargins(0, 0, 0, 0)
self.al_frame.setLayout(self.al_box) self.al_frame.setLayout(self.al_box)
self.al_frame.setDisabled(True)
grid0 = GLay(v_spacing=5, h_spacing=3) grid0 = GLay(v_spacing=5, h_spacing=3)
self.al_box.addLayout(grid0) self.al_box.addLayout(grid0)
@@ -1814,7 +1814,7 @@ class LevelUI:
# Tool Table Frame # Tool Table Frame
# ############################################################################################################# # #############################################################################################################
tt_frame = FCFrame() tt_frame = FCFrame()
self.tools_box.addWidget(tt_frame) self.al_box.addWidget(tt_frame)
# Grid Layout # Grid Layout
tool_grid = GLay(v_spacing=5, h_spacing=3, c_stretch=[0, 0]) tool_grid = GLay(v_spacing=5, h_spacing=3, c_stretch=[0, 0])
@@ -1844,10 +1844,10 @@ class LevelUI:
"either through a file or directly, with the intent to get the height map\n" "either through a file or directly, with the intent to get the height map\n"
"that is to modify the original GCode to level the cutting height.") "that is to modify the original GCode to level the cutting height.")
) )
self.tools_box.addWidget(self.probe_gc_label) self.al_box.addWidget(self.probe_gc_label)
tp_frame = FCFrame() tp_frame = FCFrame()
self.tools_box.addWidget(tp_frame) self.al_box.addWidget(tp_frame)
# Grid Layout # Grid Layout
param_grid = GLay(v_spacing=5, h_spacing=3) param_grid = GLay(v_spacing=5, h_spacing=3)
@@ -1950,7 +1950,7 @@ class LevelUI:
param_grid.addWidget(self.al_rows_entry, 14, 1) param_grid.addWidget(self.al_rows_entry, 14, 1)
self.al_add_button = FCButton(_("Add Probe Points")) self.al_add_button = FCButton(_("Add Probe Points"))
self.tools_box.addWidget(self.al_add_button) self.al_box.addWidget(self.al_add_button)
# ############################################################################################################# # #############################################################################################################
# Controller Frame # Controller Frame
@@ -1960,10 +1960,10 @@ class LevelUI:
_("The kind of controller for which to generate\n" _("The kind of controller for which to generate\n"
"height map gcode.") "height map gcode.")
) )
self.tools_box.addWidget(self.al_controller_label) self.al_box.addWidget(self.al_controller_label)
self.c_frame = FCFrame() self.c_frame = FCFrame()
self.tools_box.addWidget(self.c_frame) self.al_box.addWidget(self.c_frame)
ctrl_grid = GLay(v_spacing=5, h_spacing=3) ctrl_grid = GLay(v_spacing=5, h_spacing=3)
self.c_frame.setLayout(ctrl_grid) self.c_frame.setLayout(ctrl_grid)
@@ -2306,7 +2306,7 @@ class LevelUI:
# height_lay.addStretch() # height_lay.addStretch()
height_lay.addWidget(self.view_h_gcode_button) height_lay.addWidget(self.view_h_gcode_button)
self.tools_box.addLayout(height_lay) self.al_box.addLayout(height_lay)
self.import_heights_button = FCButton(_("Import Height Map")) self.import_heights_button = FCButton(_("Import Height Map"))
self.import_heights_button.setToolTip( self.import_heights_button.setToolTip(
@@ -2315,7 +2315,7 @@ class LevelUI:
"over the original GCode therefore\n" "over the original GCode therefore\n"
"doing autolevelling.") "doing autolevelling.")
) )
self.tools_box.addWidget(self.import_heights_button) self.al_box.addWidget(self.import_heights_button)
# self.h_gcode_button.hide() # self.h_gcode_button.hide()
# self.import_heights_button.hide() # self.import_heights_button.hide()