Ver Fonte

- fixed Tcl commands that use the overlap parameter to switch from fraction to percentage
- in Transform Tool mae sure that the buffer sub-tool parameters are better explained in tooltips

Marius Stanciu há 6 anos atrás
pai
commit
841e1f3eeb

+ 9 - 10
FlatCAMObj.py

@@ -1269,23 +1269,22 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
         """
 
         if geometry is None:
-            if follow:
-                work_geo = self.follow_geometry
-            else:
-                work_geo = self.solid_geometry
+            work_geo = self.follow_geometry if follow is True else self.solid_geometry
         else:
             work_geo = geometry
 
         if dia is None:
             dia = float(self.options["isotooldia"])
+
         if passes is None:
             passes = int(self.options["isopasses"])
+
         if overlap is None:
             overlap = float(self.options["isooverlap"])
-        if combine is None:
-            combine = self.options["combine_passes"]
-        else:
-            combine = bool(combine)
+
+        overlap /= 100.0
+
+        combine = self.options["combine_passes"] if combine is None else bool(combine)
 
         if milling_type is None:
             milling_type = self.options["milling_type"]
@@ -1316,7 +1315,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
 
                 geo_obj.solid_geometry = []
                 for i in range(passes):
-                    iso_offset = dia * ((2 * i + 1) / 2.0) - (i * (overlap / 100) * dia)
+                    iso_offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
 
                     # if milling type is climb then the move is counter-clockwise around features
                     mill_t = 1 if milling_type == 'cl' else 0
@@ -1417,7 +1416,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
         else:
             for i in range(passes):
 
-                offset = dia * ((2 * i + 1) / 2.0) - (i * (overlap / 100) * dia)
+                offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia)
                 if passes > 1:
                     if outname is None:
                         if self.iso_type == 0:

+ 2 - 0
README.md

@@ -16,6 +16,8 @@ CAD program, and create G-Code for Isolation routing.
 - fixed some decimals issues in NCC Tool, Paint Tool and Excellon Editor (they were still using the harcoded values)
 - some small updates in the NCC Tool
 - changes in the Preferences UI for NCC and Paint Tool in Tool Dia entry field
+- fixed Tcl commands that use the overlap parameter to switch from fraction to percentage
+- in Transform Tool mae sure that the buffer sub-tool parameters are better explained in tooltips
 
 29.12.2019
 

+ 2 - 2
camlib.py

@@ -1326,7 +1326,7 @@ class Geometry(object):
         geoms.get_points = get_pts
 
         # Path margin
-        path_margin = polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle / 4))
+        path_margin = polygon_to_clear.buffer(-tooldia / 2, int(steps_per_circle))
 
         if path_margin.is_empty or path_margin is None:
             return
@@ -1345,7 +1345,7 @@ class Geometry(object):
             # provide the app with a way to process the GUI events when in a blocking loop
             QtWidgets.QApplication.processEvents()
 
-            path = Point(seedpoint).buffer(radius, int(steps_per_circle / 4)).exterior
+            path = Point(seedpoint).buffer(radius, int(steps_per_circle)).exterior
             path = path.intersection(path_margin)
 
             # Touches polygon?

+ 1 - 1
flatcamEditors/FlatCAMGeoEditor.py

@@ -453,7 +453,7 @@ class PaintOptionsTool(FlatCAMTool):
         # Overlap
         ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
         ovlabel.setToolTip(
-            _("How much (fraction) of the tool width to overlap each tool pass.\n"
+            _("How much (percentage) of the tool width to overlap each tool pass.\n"
               "Adjust the value starting with lower values\n"
               "and increasing it if areas that should be painted are still \n"
               "not painted.\n"

+ 1 - 1
flatcamGUI/ObjectUI.py

@@ -388,7 +388,7 @@ class GerberObjectUI(ObjectUI):
         # Pass overlap
         overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
         overlabel.setToolTip(
-            _("How much (fraction) of the tool width to overlap each tool pass.")
+            _("How much (percentage) of the tool width to overlap each tool pass.")
         )
         overlabel.setMinimumWidth(90)
         self.iso_overlap_entry = FCDoubleSpinner(suffix='%')

+ 6 - 5
flatcamGUI/PreferencesUI.py

@@ -2048,7 +2048,7 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
         # Pass overlap
         overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
         overlabel.setToolTip(
-            _("How much (fraction) of the tool width to overlap each tool pass.")
+            _("How much (percentage) of the tool width to overlap each tool pass.")
         )
         self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
         self.iso_overlap_entry.set_precision(self.decimals)
@@ -5157,7 +5157,7 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
         # Overlap Entry
         nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
         nccoverlabel.setToolTip(
-           _("How much (fraction) of the tool width to overlap each tool pass.\n"
+           _("How much (percentage) of the tool width to overlap each tool pass.\n"
              "Adjust the value starting with lower values\n"
              "and increasing it if areas that should be cleared are still \n"
              "not cleared.\n"
@@ -5574,7 +5574,7 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
         # Overlap
         ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
         ovlabel.setToolTip(
-            _("How much (fraction) of the tool width to overlap each tool pass.\n"
+            _("How much (percentage) of the tool width to overlap each tool pass.\n"
               "Adjust the value starting with lower values\n"
               "and increasing it if areas that should be painted are still \n"
               "not painted.\n"
@@ -6418,12 +6418,13 @@ class ToolsTransformPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.buffer_label, 17, 0)
         grid0.addWidget(self.buffer_entry, 17, 1)
 
-        self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
+        self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
         self.buffer_factor_label.setToolTip(
             _("A positive value will create the effect of dilation,\n"
               "while a negative value will create the effect of erosion.\n"
               "Each geometry element of the object will be increased\n"
-              "or decreased by the 'factor'.")
+              "or decreased to fit the 'Value'. Value is a percentage\n"
+              "of the initial dimension.")
         )
 
         self.buffer_factor_entry = FCDoubleSpinner(suffix='%')

+ 2 - 2
flatcamTools/ToolNonCopperClear.py

@@ -318,7 +318,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
         # Overlap Entry
         nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
         nccoverlabel.setToolTip(
-            _("How much (fraction) of the tool width to overlap each tool pass.\n"
+            _("How much (percentage) of the tool width to overlap each tool pass.\n"
               "Adjust the value starting with lower values\n"
               "and increasing it if areas that should be cleared are still \n"
               "not cleared.\n"
@@ -1430,7 +1430,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
         else:
             ncc_select = self.reference_radio.get_value()
 
-        overlap = overlap if overlap is not None else float(self.app.defaults["tools_nccoverlap"])
+        overlap = overlap if overlap is not None else float(self.app.defaults["tools_nccoverlap"]) / 100.0
 
         connect = connect if connect else self.app.defaults["tools_nccconnect"]
         contour = contour if contour else self.app.defaults["tools_ncccontour"]

+ 4 - 4
flatcamTools/ToolPaint.py

@@ -218,7 +218,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         # Overlap
         ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate'))
         ovlabel.setToolTip(
-            _("How much (fraction) of the tool width to overlap each tool pass.\n"
+            _("How much (percentage) of the tool width to overlap each tool pass.\n"
               "Adjust the value starting with lower values\n"
               "and increasing it if areas that should be painted are still \n"
               "not painted.\n"
@@ -1380,7 +1380,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         prog_plot = True if self.app.defaults["tools_paint_plotting"] == 'progressive' else False
 
         name = outname if outname is not None else self.obj_name + "_paint"
-        over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"])
+        over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) / 100.0
         conn = connect if connect is not None else self.app.defaults["tools_pathconnect"]
         cont = contour if contour is not None else self.app.defaults["tools_paintcontour"]
         order = order if order is not None else self.order_radio.get_value()
@@ -1630,7 +1630,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         proc = self.app.proc_container.new(_("Painting polygons..."))
         name = outname if outname is not None else self.obj_name + "_paint"
 
-        over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"])
+        over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) / 100.0
         conn = connect if connect is not None else self.app.defaults["tools_pathconnect"]
         cont = contour if contour is not None else self.app.defaults["tools_paintcontour"]
         order = order if order is not None else self.order_radio.get_value()
@@ -2214,7 +2214,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         proc = self.app.proc_container.new(_("Painting polygons..."))
         name = outname if outname is not None else self.obj_name + "_paint"
 
-        over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"])
+        over = overlap if overlap is not None else float(self.app.defaults["tools_paintoverlap"]) / 100.0
         conn = connect if connect is not None else self.app.defaults["tools_pathconnect"]
         cont = contour if contour is not None else self.app.defaults["tools_paintcontour"]
         order = order if order is not None else self.order_radio.get_value()

+ 3 - 2
flatcamTools/ToolTransform.py

@@ -371,12 +371,13 @@ class ToolTransform(FlatCAMTool):
         grid0.addWidget(self.buffer_entry, 23, 1)
         grid0.addWidget(self.buffer_button, 23, 2)
 
-        self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Factor"))
+        self.buffer_factor_label = QtWidgets.QLabel('%s:' % _("Value"))
         self.buffer_factor_label.setToolTip(
             _("A positive value will create the effect of dilation,\n"
               "while a negative value will create the effect of erosion.\n"
               "Each geometry element of the object will be increased\n"
-              "or decreased by the 'factor'.")
+              "or decreased to fit the 'Value'. Value is a percentage\n"
+              "of the initial dimension.")
         )
 
         self.buffer_factor_entry = FCDoubleSpinner(suffix='%')

+ 3 - 3
tclCommands/TclCommandCopperClear.py

@@ -55,7 +55,7 @@ class TclCommandCopperClear(TclCommand):
             ('name', 'Name of the source Geometry object. String.'),
             ('tooldia', 'Diameter of the tool to be used. Can be a comma separated list of diameters. No space is '
                         'allowed between tool diameters. E.g: correct: 0.5,1 / incorrect: 0.5, 1'),
-            ('overlap', 'Fraction of the tool diameter to overlap cuts. Float number.'),
+            ('overlap', 'Percentage of the tool diameter to overlap cuts. Float number, [0%, 99.9999%]'),
             ('margin', 'Bounding box margin. Float number.'),
             ('order', 'Can have the values: "no", "fwd" and "rev". String.'
                       'It is useful when there are multiple tools in tooldia parameter.'
@@ -106,9 +106,9 @@ class TclCommandCopperClear(TclCommand):
             tooldia = self.app.defaults["tools_ncctools"]
 
         if 'overlap' in args:
-            overlap = float(args['overlap'])
+            overlap = float(args['overlap']) / 100.0
         else:
-            overlap = float(self.app.defaults["tools_nccoverlap"])
+            overlap = float(self.app.defaults["tools_nccoverlap"]) / 100.0
 
         if 'order' in args:
             order = args['order']

+ 1 - 1
tclCommands/TclCommandIsolate.py

@@ -45,7 +45,7 @@ class TclCommandIsolate(TclCommandSignaled):
             ('name', 'Name of the source object.'),
             ('dia', 'Tool diameter.'),
             ('passes', 'Passes of tool width.'),
-            ('overlap', 'Fraction of tool diameter to overlap passes.'),
+            ('overlap', 'Percentage of tool diameter to overlap passes. [0%, 99.9999%'),
             ('combine', 'Combine all passes into one geometry.'),
             ('outname', 'Name of the resulting Geometry object.'),
             ('follow', 'Create a Geometry that follows the Gerber path.'),

+ 4 - 4
tclCommands/TclCommandPaint.py

@@ -56,7 +56,7 @@ class TclCommandPaint(TclCommand):
             ('name', 'Name of the source Geometry object. String.'),
             ('tooldia', 'Diameter of the tool to be used. Can be a comma separated list of diameters. No space is '
                         'allowed between tool diameters. E.g: correct: 0.5,1 / incorrect: 0.5, 1'),
-            ('overlap', 'Fraction of the tool diameter to overlap cuts. Float number.'),
+            ('overlap', 'Percentage of the tool diameter to overlap cuts. Float number, [0%, 99.9999%]'),
             ('margin', 'Bounding box margin. Float number.'),
             ('order', 'Can have the values: "no", "fwd" and "rev". String.'
                       'It is useful when there are multiple tools in tooldia parameter.'
@@ -74,7 +74,7 @@ class TclCommandPaint(TclCommand):
             ('y', 'Y value of coordinate for the selection of a single polygon. Float number.'),
             ('outname', 'Name of the resulting Geometry object. String.'),
         ]),
-        'examples': []
+        'examples': ["paint obj_name -tooldia 0.3 -margin 0.1 -method 'seed' -all True"]
     }
 
     def execute(self, args, unnamed_args):
@@ -103,9 +103,9 @@ class TclCommandPaint(TclCommand):
             tooldia = float(self.app.defaults["tools_paintoverlap"])
 
         if 'overlap' in args:
-            overlap = float(args['overlap'])
+            overlap = float(args['overlap']) / 100.0
         else:
-            overlap = float(self.app.defaults["tools_paintoverlap"])
+            overlap = float(self.app.defaults["tools_paintoverlap"]) / 100.0
 
         if 'order' in args:
             order = args['order']