From cf7ee8930a0f36f644574a39e99dbfb77480c1a0 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 15 Mar 2022 20:55:30 +0200 Subject: [PATCH] - fixed an issue in Calculators Plugin that could crash the app, in the Electroplating section --- CHANGELOG.md | 4 ++++ appPlugins/ToolCalculators.py | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dec6dc4a..f478d188 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta ================================================= +15.03.2022 + +- fixed an issue in Calculators Plugin that could crash the app, in the Electroplating section + 13.03.2022 - fixed issues when saving the project due of changed serializable attributes diff --git a/appPlugins/ToolCalculators.py b/appPlugins/ToolCalculators.py index 1b309da8..da0e60cf 100644 --- a/appPlugins/ToolCalculators.py +++ b/appPlugins/ToolCalculators.py @@ -4,7 +4,7 @@ # Date: 3/10/2019 # # MIT Licence # # ########################################################## - +import numpy as np from PyQt6 import QtWidgets, QtGui from appTool import AppTool from appGUI.GUIElements import FCSpinner, FCDoubleSpinner, NumericalEvalEntry, FCLabel, RadioSet, FCButton, \ @@ -321,7 +321,10 @@ class ToolCalculator(AppTool): density = self.ui.cdensity_entry.get_value() growth = self.ui.growth_entry.get_value() - calculated_time = growth * 2.142857142857143 * float(20 / density) + try: + calculated_time = growth * 2.142857142857143 * float(20 / density) + except ZeroDivisionError: + calculated_time = 0.0 self.ui.time_entry.set_value('%.1f' % calculated_time) self.ui_connect()