- added a protection when trying to edit a Geometry object that have multiple tools but no tool is selected
This commit is contained in:
parent
850b80bb41
commit
24d639e1de
|
@ -13,6 +13,7 @@ CHANGELOG for FlatCAM beta
|
|||
- renamed the GeoEditor class/file to AppGeoEditor from FlatCAMGeoEditor making it easier to see in the IDE tree structure
|
||||
- some refactoring that lead to a working solution when using the Python 3.8 + PyQt 5.15
|
||||
- more refactoring in the app Editors
|
||||
- added a protection when trying to edit a Geometry object that have multiple tools but no tool is selected
|
||||
|
||||
7.06.2020
|
||||
|
||||
|
|
|
@ -1759,7 +1759,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
:param tools_dict: a dictionary that holds the whole data needed to create the Gcode
|
||||
(including the solid_geometry)
|
||||
:param tools_in_use: the tools that are used, needed by some preprocessors
|
||||
:type tools_in_use list of lists, each list in the list is made out of row elements of tools table from appGUI
|
||||
:type tools_in_use list of lists, each list in the list is made out of row elements of tools table from GUI
|
||||
:param segx: number of segments on the X axis, for auto-levelling
|
||||
:param segy: number of segments on the Y axis, for auto-levelling
|
||||
:param plot: if True the generated object will be plotted; if False will not be plotted
|
||||
|
@ -2103,11 +2103,11 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
else:
|
||||
self.app.app_obj.new_object("cncjob", outname, job_init_multi_geometry, plot=plot)
|
||||
|
||||
def generatecncjob(self, outname=None, dia=None, offset=None, z_cut=None, z_move=None,
|
||||
feedrate=None, feedrate_z=None, feedrate_rapid=None, spindlespeed=None, dwell=None, dwelltime=None,
|
||||
multidepth=None, dpp=None, toolchange=None, toolchangez=None, toolchangexy=None,
|
||||
extracut=None, extracut_length=None, startz=None, endz=None, endxy=None, pp=None, segx=None, segy=None,
|
||||
use_thread=True, plot=True):
|
||||
def generatecncjob(self, outname=None, dia=None, offset=None, z_cut=None, z_move=None, feedrate=None,
|
||||
feedrate_z=None, feedrate_rapid=None, spindlespeed=None, dwell=None, dwelltime=None,
|
||||
multidepth=None, dpp=None, toolchange=None, toolchangez=None, toolchangexy=None,
|
||||
extracut=None, extracut_length=None, startz=None, endz=None, endxy=None, pp=None,
|
||||
segx=None, segy=None, use_thread=True, plot=True):
|
||||
"""
|
||||
Only used by the TCL Command Cncjob.
|
||||
Creates a CNCJob out of this Geometry object. The actual
|
||||
|
@ -2833,6 +2833,38 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
|
||||
geo_final.options.update(new_options)
|
||||
geo_final.solid_geometry = new_solid_geometry
|
||||
|
||||
# merge the geometries of the tools that share the same tool diameter and the same tool_type and the same type
|
||||
final_tools = {}
|
||||
same_dia = {}
|
||||
same_type = {}
|
||||
same_tool_type = {}
|
||||
|
||||
# find tools that have the same diameter and group them by diameter
|
||||
for k, v in new_tools.items():
|
||||
if v['tooldia'] not in same_dia:
|
||||
same_dia[v['tooldia']] = [k]
|
||||
else:
|
||||
same_dia[v['tooldia']].append(k)
|
||||
|
||||
# find tools that have the same type and group them by type
|
||||
for k, v in new_tools.items():
|
||||
if v['type'] not in same_type:
|
||||
same_type[v['type']] = [k]
|
||||
else:
|
||||
same_type[v['type']].append(k)
|
||||
|
||||
# find tools that have the same tool_type and group them by tool_type
|
||||
for k, v in new_tools.items():
|
||||
if v['tool_type'] not in same_tool_type:
|
||||
same_tool_type[v['tool_type']] = [k]
|
||||
else:
|
||||
same_tool_type[v['tool_type']].append(k)
|
||||
|
||||
print(same_dia)
|
||||
print(same_type)
|
||||
print(same_tool_type)
|
||||
|
||||
geo_final.tools = new_tools
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -2154,6 +2154,10 @@ class App(QtCore.QObject):
|
|||
"is not possible.\n"
|
||||
"Edit only one geometry at a time."))
|
||||
|
||||
if not sel_rows:
|
||||
self.inform.emit('[WARNING_NOTCL] %s.' % _("No Tool Selected"))
|
||||
return
|
||||
|
||||
# determine the tool dia of the selected tool
|
||||
selected_tooldia = float(edited_object.ui.geo_tools_table.item(sel_rows[0], 1).text())
|
||||
|
||||
|
|
Loading…
Reference in New Issue