Преглед изворни кода

- in Paint Tool Preferences allowed to add a list of initial tools separated by comma
- in Geometry Paint Tool fixed the Overlap rate to work between 0 and 99.9999%

Marius Stanciu пре 6 година
родитељ
комит
7bd441eccc
4 измењених фајлова са 30 додато и 17 уклоњено
  1. 2 0
      README.md
  2. 8 10
      flatcamEditors/FlatCAMGeoEditor.py
  3. 12 5
      flatcamGUI/PreferencesUI.py
  4. 8 2
      flatcamTools/ToolPaint.py

+ 2 - 0
README.md

@@ -16,6 +16,8 @@ CAD program, and create G-Code for Isolation routing.
 - the Gerber apertures marking shapes storage is now built only once because the more are built the more sluggish is the interface
 - added a new function called by shortcut key combo CTRL+G when the current widget in Plot Area is an Code Editor. It will jump to the specified line in the text.
 - fixed a small where the app tried to hide a label that I've removed previously
+- in Paint Tool Preferences allowed to add a list of initial tools separated by comma
+- in Geometry Paint Tool fixed the Overlap rate to work between 0 and 99.9999%
 
 28.12.2019
 

+ 8 - 10
flatcamEditors/FlatCAMGeoEditor.py

@@ -441,8 +441,7 @@ class PaintOptionsTool(FlatCAMTool):
         # Tool dia
         ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
         ptdlabel.setToolTip(
-           _("Diameter of the tool to\n"
-             "be used in the operation.")
+           _("Diameter of the tool to be used in the operation.")
         )
         grid.addWidget(ptdlabel, 0, 0)
 
@@ -463,10 +462,10 @@ class PaintOptionsTool(FlatCAMTool):
               "due of too many paths.")
         )
         self.paintoverlap_entry = FCDoubleSpinner(suffix='%')
-        self.paintoverlap_entry.set_range(0.0000, 1.0000)
+        self.paintoverlap_entry.set_range(0.0000, 99.9999)
         self.paintoverlap_entry.set_precision(self.decimals)
         self.paintoverlap_entry.setWrapping(True)
-        self.paintoverlap_entry.setSingleStep(0.1)
+        self.paintoverlap_entry.setSingleStep(1)
 
         grid.addWidget(ovlabel, 1, 0)
         grid.addWidget(self.paintoverlap_entry, 1, 1)
@@ -525,7 +524,6 @@ class PaintOptionsTool(FlatCAMTool):
         # Buttons
         hlay = QtWidgets.QHBoxLayout()
         self.layout.addLayout(hlay)
-        hlay.addStretch()
         self.paint_button = QtWidgets.QPushButton(_("Paint"))
         hlay.addWidget(self.paint_button)
 
@@ -584,9 +582,9 @@ class PaintOptionsTool(FlatCAMTool):
                                  _("Paint cancelled. No shape selected."))
             return
 
-        tooldia = float(self.painttooldia_entry.get_value())
-        overlap = float(self.paintoverlap_entry.get_value())
-        margin = float(self.paintmargin_entry.get_value())
+        tooldia = self.painttooldia_entry.get_value()
+        overlap = self.paintoverlap_entry.get_value() / 100.0
+        margin = self.paintmargin_entry.get_value()
 
         method = self.paintmethod_combo.get_value()
         contour = self.paintcontour_cb.get_value()
@@ -4749,9 +4747,9 @@ class FlatCAMGeoEditor(QtCore.QObject):
 
     def paint(self, tooldia, overlap, margin, connect, contour, method):
 
-        if overlap >= 1:
+        if overlap >= 100:
             self.app.inform.emit('[ERROR_NOTCL] %s' %
-                                 _("Could not do Paint. Overlap value has to be less than 1.00 (100%%)."))
+                                 _("Could not do Paint. Overlap value has to be less than 100%%."))
             return
 
         self.paint_tooldia = tooldia

+ 12 - 5
flatcamGUI/PreferencesUI.py

@@ -2520,7 +2520,9 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
 
         self.adddim_label = QtWidgets.QLabel('%s:' % _('Aperture Dimensions'))
         self.adddim_label.setToolTip(
-            _("Diameters of the cutting tools, separated by ','")
+            _("Diameters of the cutting tools, separated by comma.\n"
+              "The value of the diameter has to use the dot decimals separator.\n"
+              "Valid values: 0.3, 1.0")
         )
         grid0.addWidget(self.adddim_label, 5, 0)
         self.adddim_entry = FCEntry()
@@ -3873,7 +3875,9 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
         # Tooldia
         tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
         tdlabel.setToolTip(
-            _("Diameters of the cutting tools, separated by ','")
+            _("Diameters of the cutting tools, separated by comma.\n"
+              "The value of the diameter has to use the dot decimals separator.\n"
+              "Valid values: 0.3, 1.0")
         )
         self.cnctooldia_entry = FCEntry()
 
@@ -5025,7 +5029,9 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
 
         ncctdlabel = QtWidgets.QLabel('%s:' % _('Tools dia'))
         ncctdlabel.setToolTip(
-            _("Diameters of the cutting tools, separated by ','")
+            _("Diameters of the cutting tools, separated by comma.\n"
+              "The value of the diameter has to use the dot decimals separator.\n"
+              "Valid values: 0.3, 1.0")
         )
         grid0.addWidget(ncctdlabel, 0, 0)
         self.ncc_tool_dia_entry = FCEntry()
@@ -5533,8 +5539,9 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
         # Tool dia
         ptdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
         ptdlabel.setToolTip(
-            _("Diameter of the tool to\n"
-              "be used in the operation.")
+            _("Diameters of the cutting tools, separated by comma.\n"
+              "The value of the diameter has to use the dot decimals separator.\n"
+              "Valid values: 0.3, 1.0")
         )
         grid0.addWidget(ptdlabel, 0, 0)
 

+ 8 - 2
flatcamTools/ToolPaint.py

@@ -637,7 +637,7 @@ class ToolPaint(FlatCAMTool, Gerber):
             "toolchangexy": self.app.defaults["geometry_toolchangexy"],
             "startz": self.app.defaults["geometry_startz"],
 
-            "tooldia": float(self.app.defaults["tools_painttooldia"]),
+            "tooldia": self.app.defaults["tools_painttooldia"],
             "paintmargin": float(self.app.defaults["tools_paintmargin"]),
             "paintmethod": self.app.defaults["tools_paintmethod"],
             "selectmethod": self.app.defaults["tools_selectmethod"],
@@ -646,9 +646,15 @@ class ToolPaint(FlatCAMTool, Gerber):
             "paintoverlap": self.app.defaults["tools_paintoverlap"]
         })
 
+        try:
+            diameters = [float(self.app.defaults["tools_painttooldia"])]
+        except (ValueError, TypeError):
+            diameters = [eval(x) for x in self.app.defaults["tools_painttooldia"].split(",") if x != '']
+
         # call on self.on_tool_add() counts as an call to self.build_ui()
         # through this, we add a initial row / tool in the tool_table
-        self.on_tool_add(float(self.app.defaults["tools_painttooldia"]), muted=True)
+        for dia in diameters:
+            self.on_tool_add(dia, muted=True)
 
         # if the Paint Method is "Single" disable the tool table context menu
         if self.default_data["selectmethod"] == "single":