From 0106d95e84f94b64c9850f2b345e4d91d29dde37 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 6 May 2019 22:33:45 +0300 Subject: [PATCH] - added a new parameter in the Edit -> Preferences -> App Preferences named Geo Tolerance. This parameter control the level of geometric detail throughout FlatCAM. It directly influence the effect of Circle Steps parameter. --- FlatCAMApp.py | 4 +++- FlatCAMObj.py | 6 +++++- README.md | 1 + flatcamGUI/FlatCAMGUI.py | 31 ++++++++++++++++++++++++++----- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index f00974e8..64c3f2e1 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -322,6 +322,7 @@ class App(QtCore.QObject): "global_project_autohide": self.ui.general_defaults_form.general_app_group.project_autohide_cb, "global_toggle_tooltips": self.ui.general_defaults_form.general_app_group.toggle_tooltips_cb, "global_worker_number": self.ui.general_defaults_form.general_app_group.worker_number_sb, + "global_tolerance": self.ui.general_defaults_form.general_app_group.tol_entry, "global_compression_level": self.ui.general_defaults_form.general_app_group.compress_combo, "global_save_compressed": self.ui.general_defaults_form.general_app_group.save_type_cb, @@ -594,6 +595,7 @@ class App(QtCore.QObject): "global_project_autohide": True, "global_toggle_tooltips": True, "global_worker_number": 2, + "global_tolerance": 0.01, "global_compression_level": 3, "global_save_compressed": True, @@ -3710,7 +3712,7 @@ class App(QtCore.QObject): self.defaults_read_form() def on_toggle_units_click(self): - if self.options["units"] == 'MM': + if self.defaults["units"] == 'MM': self.ui.general_defaults_form.general_app_group.units_radio.set_value("IN") else: self.ui.general_defaults_form.general_app_group.units_radio.set_value("MM") diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 39a1dcfd..7733cf3e 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -81,7 +81,11 @@ class FlatCAMObj(QtCore.QObject): self.muted_ui = False self.deleted = False - self._drawing_tolerance = 0.01 + try: + self._drawing_tolerance = float(self.app.defaults["global_tolerance"]) if \ + self.app.defaults["global_tolerance"] else 0.01 + except ValueError: + self._drawing_tolerance = 0.01 self.isHovering = False self.notHovering = True diff --git a/README.md b/README.md index d4c633d4..2d405f75 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing. - made units change from Edit -> Toggle Units not to affect the preferences - remade the way the aperture marks are plotted in Gerber Object - fixed some bugs related to moving an Gerber object with the aperture table in view +- added a new parameter in the Edit -> Preferences -> App Preferences named Geo Tolerance. This parameter control the level of geometric detail throughout FlatCAM. It directly influence the effect of Circle Steps parameter. 5.05.2019 diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index f5e8fd3e..c1ed9edf 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2286,11 +2286,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # Change Units if key == QtCore.Qt.Key_Q: - if self.app.defaults["units"] == 'MM': - self.app.ui.general_defaults_form.general_app_group.units_radio.set_value("IN") - else: - self.app.ui.general_defaults_form.general_app_group.units_radio.set_value("MM") - self.app.on_toggle_units(no_pref=True) + # if self.app.defaults["units"] == 'MM': + # self.app.ui.general_defaults_form.general_app_group.units_radio.set_value("IN") + # else: + # self.app.ui.general_defaults_form.general_app_group.units_radio.set_value("MM") + # self.app.on_toggle_units(no_pref=True) + self.app.on_toggle_units_click() # Rotate Object by 90 degree CW if key == QtCore.Qt.Key_R: @@ -3866,6 +3867,25 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): ) self.worker_number_sb.set_range(2, 16) + # Geometric tolerance + tol_label = QtWidgets.QLabel("Geo Tolerance:") + tol_label.setToolTip(_( + "This value can counter the effect of the Circle Steps\n" + "parameter. Default value is 0.01.\n" + "A lower value will increase the detail both in image\n" + "and in Gcode for the circles, with a higher cost in\n" + "performance. Higher value will provide more\n" + "performance at the expense of level of detail." + )) + self.tol_entry = FCEntry() + self.tol_entry.setToolTip(_( + "This value can counter the effect of the Circle Steps\n" + "parameter. Default value is 0.01.\n" + "A lower value will increase the detail both in image\n" + "and in Gcode for the circles, with a higher cost in\n" + "performance. Higher value will provide more\n" + "performance at the expense of level of detail." + )) # Just to add empty rows self.spacelabel = QtWidgets.QLabel('') @@ -3886,6 +3906,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI): self.form_box.addRow(self.project_autohide_label, self.project_autohide_cb) self.form_box.addRow(self.toggle_tooltips_label, self.toggle_tooltips_cb) self.form_box.addRow(self.worker_number_label, self.worker_number_sb) + self.form_box.addRow(tol_label, self.tol_entry) self.form_box.addRow(self.spacelabel, self.spacelabel)