diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 14a05111..23340b0c 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -7193,8 +7193,7 @@ class App(QtCore.QObject): # Clear form self.setup_component_editor() - self.inform.emit('%s: %s' % - (_("Object deleted"), name)) + self.inform.emit('%s: %s' % (_("Object deleted"), name)) def on_set_origin(self): """ @@ -7306,6 +7305,11 @@ class App(QtCore.QObject): def worker_task(): with self.proc_container.new(_("Moving to Origin...")): obj_list = self.collection.get_selected() + + if not obj_list: + self.inform.emit('[ERROR_NOTCL] %s' % _("Failed. No object(s) selected...")) + return + xminlist = list() yminlist = list() diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 870003b9..288ae791 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -4756,7 +4756,11 @@ class FlatCAMGeometry(FlatCAMObj, Geometry): return tooldia = float(tool_dia_item.text()) - new_cutz = (tooldia - vdia) / (2 * math.tan(math.radians(half_vangle))) + try: + new_cutz = (tooldia - vdia) / (2 * math.tan(math.radians(half_vangle))) + except ZeroDivisionError: + new_cutz = self.old_cutz + new_cutz = float('%.*f' % (self.decimals, new_cutz)) * -1.0 # this value has to be negative self.ui.cutz_entry.set_value(new_cutz) diff --git a/README.md b/README.md index 513825ac..a324e0e9 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing. - added a new functionality, a variation of Set Origin named Move to Origin. It will move a selection of objects to origin such as the bottom left corner of the bounding box that fit them all is in origin. - fixed some bugs +- fixed a division by zero error: fixed #377 30.01.2020 diff --git a/flatcamEditors/FlatCAMTextEditor.py b/flatcamEditors/FlatCAMTextEditor.py index 4e1dbe60..fe0b847e 100644 --- a/flatcamEditors/FlatCAMTextEditor.py +++ b/flatcamEditors/FlatCAMTextEditor.py @@ -29,6 +29,8 @@ class TextEditor(QtWidgets.QWidget): super().__init__() self.app = app + self.plain_text = plain_text + self.setSizePolicy( QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding @@ -45,7 +47,7 @@ class TextEditor(QtWidgets.QWidget): self.work_editor_layout.setContentsMargins(2, 2, 2, 2) self.t_frame.setLayout(self.work_editor_layout) - if plain_text: + if self.plain_text: self.editor_class = FCTextAreaLineNumber() self.code_editor = self.editor_class.edit