Sfoglia il codice sorgente

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

Marius Stanciu 6 anni fa
parent
commit
0106d95e84
4 ha cambiato i file con 35 aggiunte e 7 eliminazioni
  1. 3 1
      FlatCAMApp.py
  2. 5 1
      FlatCAMObj.py
  3. 1 0
      README.md
  4. 26 5
      flatcamGUI/FlatCAMGUI.py

+ 3 - 1
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")

+ 5 - 1
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

+ 1 - 0
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
 

+ 26 - 5
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)