- fixed a division by zero error: fixed #377

This commit is contained in:
Marius Stanciu 2020-02-01 06:59:15 +02:00 committed by Marius
parent 6eb96264f1
commit 7aea33914c
4 changed files with 15 additions and 4 deletions

View File

@ -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()

View File

@ -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)

View File

@ -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

View File

@ -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