From 299a6585a73bab175071f3ebaa0c622a0a92c052 Mon Sep 17 00:00:00 2001
From: Marius Stanciu
Tool Tab - Choose an Item in Tools Menu
- -Details:
-Some of the functionality of FlatCAM have been implemented as tools (a sort of plugins).
Most of the tools are accessible through the Tools menu or by using the associated shortcut keys.
-Each such a tool, if it needs an object to be used as a source it will provide the way to select this object(s) through a series of comboboxes. The result of using a tool is either a Geometry, an information that can be used in the app or it can be a file that can be saved.
A list of key shortcuts is available through an menu entry in Help -> Shortcuts List or through it's own key shortcut: '`' (key left to 1).
- - ''' - - tool_title.setText(tool_text) - tool_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) - - self.ui.tool_scroll_area.setWidget(tool_title) +# tool_title = QtWidgets.QTextEdit( +# 'Shortcut Key List') +# tool_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction) +# tool_title.setFrameStyle(QtWidgets.QFrame.NoFrame) +# # font = self.sel_title.font() +# # font.setPointSize(12) +# # self.sel_title.setFont(font) +# +# tool_text = ''' +#Tool Tab - Choose an Item in Tools Menu
+# +#Details:
+# Some of the functionality of FlatCAM have been implemented as tools (a sort of plugins).
Most of the tools are accessible through the Tools menu or by using the associated shortcut keys.
+# Each such a tool, if it needs an object to be used as a source it will provide the way to select this object(s) through a series of comboboxes. The result of using a tool is either a Geometry, an information that can be used in the app or it can be a file that can be saved.
A list of key shortcuts is available through an menu entry in Help -> Shortcuts List or through it's own key shortcut: '`' (key left to 1).
+# +# ''' +# +# tool_title.setText(tool_text) +# tool_title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) +# +# self.ui.tool_scroll_area.setWidget(tool_title) def setup_obj_classes(self): """ diff --git a/FlatCAMGUI.py b/FlatCAMGUI.py index 87436aad..4cd70820 100644 --- a/FlatCAMGUI.py +++ b/FlatCAMGUI.py @@ -3064,7 +3064,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI): ) grid1.addWidget(segy_label, 21, 0) self.segy_entry = FCEntry() - grid1.addWidget(self.segy_entry, 22, 1) + grid1.addWidget(self.segy_entry, 21, 1) self.layout.addStretch() diff --git a/FlatCAMObj.py b/FlatCAMObj.py index cd720a90..d0eea1f8 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -3349,6 +3349,11 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): job_obj.multigeo = True job_obj.cnc_tools.clear() + job_obj.options['xmin'] = xmin + job_obj.options['ymin'] = ymin + job_obj.options['xmax'] = xmax + job_obj.options['ymax'] = ymax + try: job_obj.z_pdepth = float(self.options["z_pdepth"]) except ValueError: @@ -4301,9 +4306,14 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob): self.app.ui.code_editor.clear() # then append the text from GCode to the text editor - for line in self.app.gcode_edited: - proc_line = str(line).strip('\n') - self.app.ui.code_editor.append(proc_line) + try: + for line in self.app.gcode_edited: + proc_line = str(line).strip('\n') + self.app.ui.code_editor.append(proc_line) + except Exception as e: + log.debug('FlatCAMCNNJob.on_modifygcode_button_click() -->%s' % str(e)) + self.app.inform.emit('[ERROR]FlatCAMCNNJob.on_modifygcode_button_click() -->%s' % str(e)) + return self.app.ui.code_editor.moveCursor(QtGui.QTextCursor.Start) diff --git a/ObjectCollection.py b/ObjectCollection.py index ff967a74..f9530f6f 100644 --- a/ObjectCollection.py +++ b/ObjectCollection.py @@ -875,8 +875,8 @@ class ObjectCollection(QtCore.QAbstractItemModel): self.set_inactive(name) def on_list_selection_change(self, current, previous): - FlatCAMApp.App.log.debug("on_list_selection_change()") - FlatCAMApp.App.log.debug("Current: %s, Previous %s" % (str(current), str(previous))) + # FlatCAMApp.App.log.debug("on_list_selection_change()") + # FlatCAMApp.App.log.debug("Current: %s, Previous %s" % (str(current), str(previous))) try: obj = current.indexes()[0].internalPointer().obj diff --git a/README.md b/README.md index 7b09ea0a..9df214d2 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,9 @@ CAD program, and create G-Code for Isolation routing. 6.02.2019 - fixed the units calculators crash FlatCAM when using comma as decimal separator +- done a regression on Tool Tab default text. It somehow delete Tools in certain scenarios so I got rid of it +- fixed bug in multigeometry geometry not having the bounds in self.options and crashing the GCode generation +- fixed bug that crashed whole application in case that the GCode editor is activated on a Tool gcode that is defective. 5.02.3019 diff --git a/camlib.py b/camlib.py index 1178b716..3fe32d44 100644 --- a/camlib.py +++ b/camlib.py @@ -829,7 +829,7 @@ class Geometry(object): for i in current.interiors: geoms.insert(i) else: - print("Current Area is zero") + log.debug("camlib.Geometry.clear_polygon() --> Current Area is zero") break # Optimization: Reduce lifts diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py index 0604d9ac..0beb996b 100644 --- a/flatcamTools/ToolPaint.py +++ b/flatcamTools/ToolPaint.py @@ -839,6 +839,17 @@ class ToolPaint(FlatCAMTool, Gerber): return None geo_obj.solid_geometry = [] + + try: + a, b, c, d = poly.bounds() + geo_obj.options['xmin'] = a + geo_obj.options['ymin'] = b + geo_obj.options['xmax'] = c + geo_obj.options['ymax'] = d + except Exception as e: + log.debug("ToolPaint.paint_poly.gen_paintarea() bounds error --> %s" % str(e)) + return + try: poly_buf = poly.buffer(-paint_margin) if isinstance(poly_buf, MultiPolygon): @@ -988,6 +999,16 @@ class ToolPaint(FlatCAMTool, Gerber): sorted_tools.append(float(self.tools_table.item(row, 1).text())) sorted_tools.sort(reverse=True) + try: + a, b, c, d = obj.bounds() + geo_obj.options['xmin'] = a + geo_obj.options['ymin'] = b + geo_obj.options['xmax'] = c + geo_obj.options['ymax'] = d + except Exception as e: + log.debug("ToolPaint.paint_poly.gen_paintarea() bounds error --> %s" % str(e)) + return + total_geometry = [] current_uid = int(1) geo_obj.solid_geometry = [] @@ -1085,6 +1106,16 @@ class ToolPaint(FlatCAMTool, Gerber): current_uid = int(1) geo_obj.solid_geometry = [] + try: + a, b, c, d = obj.bounds() + geo_obj.options['xmin'] = a + geo_obj.options['ymin'] = b + geo_obj.options['xmax'] = c + geo_obj.options['ymax'] = d + except Exception as e: + log.debug("ToolPaint.paint_poly.gen_paintarea() bounds error --> %s" % str(e)) + return + for tool_dia in sorted_tools: for geo in recurse(obj.solid_geometry): try: