From f9c83a5e605979208d8fcbf663d1c2937ac4e12f Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 4 Dec 2019 17:00:36 +0200 Subject: [PATCH] - fixed the overlap parameter all over the app to reflect the change to percentage --- FlatCAMApp.py | 6 ++-- FlatCAMObj.py | 12 ++++--- README.md | 1 + flatcamEditors/FlatCAMGeoEditor.py | 2 +- flatcamGUI/ObjectUI.py | 6 ++-- flatcamGUI/PreferencesUI.py | 58 +++++++++++++++--------------- flatcamTools/ToolNonCopperClear.py | 13 ++----- flatcamTools/ToolPaint.py | 8 ++--- 8 files changed, 50 insertions(+), 56 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 834d7122..e07a1b34 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -522,7 +522,7 @@ class App(QtCore.QObject): # Gerber Options "gerber_isotooldia": 0.1, "gerber_isopasses": 1, - "gerber_isooverlap": 0.1, + "gerber_isooverlap": 10, "gerber_milling_type": "cl", "gerber_combine_passes": False, "gerber_iso_scope": 'all', @@ -712,7 +712,7 @@ class App(QtCore.QObject): # NCC Tool "tools_ncctools": "1.0, 0.5", "tools_nccorder": 'rev', - "tools_nccoverlap": 0.4, + "tools_nccoverlap": 40, "tools_nccmargin": 1.0, "tools_nccmethod": "seed", "tools_nccconnect": True, @@ -743,7 +743,7 @@ class App(QtCore.QObject): # Paint Tool "tools_painttooldia": 0.3, "tools_paintorder": 'rev', - "tools_paintoverlap": 0.2, + "tools_paintoverlap": 20, "tools_paintmargin": 0.0, "tools_paintmethod": "seed", "tools_selectmethod": "all", diff --git a/FlatCAMObj.py b/FlatCAMObj.py index bc12976e..c09fe9b5 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -589,7 +589,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber): "vcutz": -0.05, "isotooldia": 0.016, "isopasses": 1, - "isooverlap": 0.15, + "isooverlap": 15, "milling_type": "cl", "combine_passes": True, "noncoppermargin": 0.0, @@ -1141,11 +1141,15 @@ class FlatCAMGerber(FlatCAMObj, Gerber): Creates an isolation routing geometry object in the project. :param iso_type: type of isolation to be done: 0 = exteriors, 1 = interiors and 2 = both - :param iso_scope: whether to isolate all polygons or single polygpns: 'all' = all, 'single' = one by one, single + :param geometry: specific geometry to isolate :param dia: Tool diameter :param passes: Number of tool widths to cut :param overlap: Overlap between passes in fraction of tool diameter :param outname: Base name of the output object + :param combine: Boolean: if to combine passes in one resulting object in case of multiple passes + :param milling_type: type of milling: conventional or climbing + :param follow: Boolean: if to generate a 'follow' geometry + :param plot: Boolean: if to plot the resulting geometry object :return: None """ @@ -1195,7 +1199,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber): geo_obj.options["cnctooldia"] = str(self.options["isotooldia"]) geo_obj.solid_geometry = [] for i in range(passes): - iso_offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia) + iso_offset = dia * ((2 * i + 1) / 2.0) - (i * (overlap / 100) * dia) # if milling type is climb then the move is counter-clockwise around features mill_t = 1 if milling_type == 'cl' else 0 @@ -1295,7 +1299,7 @@ class FlatCAMGerber(FlatCAMObj, Gerber): else: for i in range(passes): - offset = dia * ((2 * i + 1) / 2.0) - (i * overlap * dia) + offset = dia * ((2 * i + 1) / 2.0) - (i * (overlap / 100) * dia) if passes > 1: if outname is None: if self.iso_type == 0: diff --git a/README.md b/README.md index 57c3ac42..e2814834 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing. - updated the Paint Tool in Geometry Editor to use the FCDoublepinbox - added the possibility for suffix presence on the FCSpinner and FCDoubleSpinner GUI Elements - added the '%' symbol for overlap fields; I still need to divide the conntet by 100 to get the original decimal +- fixed the overlap parameter all over the app to reflect the change to percentage 3.12.2019 diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py index f21a1701..23ccceee 100644 --- a/flatcamEditors/FlatCAMGeoEditor.py +++ b/flatcamEditors/FlatCAMGeoEditor.py @@ -458,7 +458,7 @@ class PaintOptionsTool(FlatCAMTool): "Adjust the value starting with lower values\n" "and increasing it if areas that should be painted are still \n" "not painted.\n" - "Lower values = faster processing, faster execution on PCB.\n" + "Lower values = faster processing, faster execution on CNC.\n" "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) diff --git a/flatcamGUI/ObjectUI.py b/flatcamGUI/ObjectUI.py index 99060535..5eecde4b 100644 --- a/flatcamGUI/ObjectUI.py +++ b/flatcamGUI/ObjectUI.py @@ -371,15 +371,13 @@ 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.\n" - "Example:\n" - "A value here of 0.25 means an overlap of 25%% from the tool diameter found above.") + _("How much (fraction) of the tool width to overlap each tool pass.") ) overlabel.setMinimumWidth(90) self.iso_overlap_entry = FCDoubleSpinner(suffix='%') self.iso_overlap_entry.set_precision(self.decimals) self.iso_overlap_entry.setWrapping(True) - self.iso_overlap_entry.setRange(0.000, 0.999) + self.iso_overlap_entry.setRange(0.0000, 99.9999) self.iso_overlap_entry.setSingleStep(0.1) grid1.addWidget(overlabel, 6, 0) grid1.addWidget(self.iso_overlap_entry, 6, 1, 1, 2) diff --git a/flatcamGUI/PreferencesUI.py b/flatcamGUI/PreferencesUI.py index 00aa2b6e..352ba876 100644 --- a/flatcamGUI/PreferencesUI.py +++ b/flatcamGUI/PreferencesUI.py @@ -1386,6 +1386,7 @@ class GerberOptPrefGroupUI(OptionsGroupUI): def __init__(self, parent=None): # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent) super(GerberOptPrefGroupUI, self).__init__(self) + self.decimals = 4 self.setTitle(str(_("Gerber Options"))) @@ -1407,7 +1408,7 @@ class GerberOptPrefGroupUI(OptionsGroupUI): ) grid0.addWidget(tdlabel, 0, 0) self.iso_tool_dia_entry = FCDoubleSpinner() - self.iso_tool_dia_entry.set_precision(4) + self.iso_tool_dia_entry.set_precision(self.decimals) self.iso_tool_dia_entry.setSingleStep(0.1) self.iso_tool_dia_entry.set_range(-9999, 9999) @@ -1428,14 +1429,12 @@ 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.\n" - "Example:\n" - "A value here of 0.25 means an overlap of 25%% from the tool diameter found above.") + _("How much (fraction) of the tool width to overlap each tool pass.") ) - self.iso_overlap_entry = FCDoubleSpinner() - self.iso_overlap_entry.set_precision(3) + self.iso_overlap_entry = FCDoubleSpinner(suffix='%') + self.iso_overlap_entry.set_precision(self.decimals) self.iso_overlap_entry.setWrapping(True) - self.iso_overlap_entry.setRange(0.000, 0.999) + self.iso_overlap_entry.setRange(0.0000,99.9999) self.iso_overlap_entry.setSingleStep(0.1) grid0.addWidget(overlabel, 2, 0) @@ -1497,7 +1496,7 @@ class GerberOptPrefGroupUI(OptionsGroupUI): ) grid1.addWidget(bmlabel, 0, 0) self.noncopper_margin_entry = FCDoubleSpinner() - self.noncopper_margin_entry.set_precision(4) + self.noncopper_margin_entry.set_precision(self.decimals) self.noncopper_margin_entry.setSingleStep(0.1) self.noncopper_margin_entry.set_range(-9999, 9999) grid1.addWidget(self.noncopper_margin_entry, 0, 1) @@ -1522,7 +1521,7 @@ class GerberOptPrefGroupUI(OptionsGroupUI): "to the nearest polygon.") ) self.bbmargin_entry = FCDoubleSpinner() - self.bbmargin_entry.set_precision(4) + self.bbmargin_entry.set_precision(self.decimals) self.bbmargin_entry.setSingleStep(0.1) self.bbmargin_entry.set_range(-9999, 9999) @@ -1546,6 +1545,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): super(GerberAdvOptPrefGroupUI, self).__init__(self) self.setTitle(str(_("Gerber Adv. Options"))) + self.decimals = 4 # ## Advanced Gerber Parameters self.adv_param_label = QtWidgets.QLabel('%s:' % _('Advanced Options')) @@ -1598,6 +1598,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): _("The tip diameter for V-Shape Tool") ) self.tipdia_spinner = FCDoubleSpinner() + self.tipdia_spinner.set_precision(self.decimals) self.tipdia_spinner.set_range(-99.9999, 99.9999) self.tipdia_spinner.setSingleStep(0.1) self.tipdia_spinner.setWrapping(True) @@ -1624,6 +1625,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): "below the copper surface.") ) self.cutz_spinner = FCDoubleSpinner() + self.cutz_spinner.set_precision(self.decimals) self.cutz_spinner.set_range(-99.9999, -0.0001) self.cutz_spinner.setSingleStep(0.1) self.cutz_spinner.setWrapping(True) @@ -1677,7 +1679,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI): self.simplification_tol_label.setToolTip(_("Tolerance for polygon simplification.")) self.simplification_tol_spinner = FCDoubleSpinner() - self.simplification_tol_spinner.set_precision(5) + self.simplification_tol_spinner.set_precision(self.decimals + 1) self.simplification_tol_spinner.setWrapping(True) self.simplification_tol_spinner.setRange(0.00000, 0.01000) self.simplification_tol_spinner.setSingleStep(0.0001) @@ -1700,6 +1702,7 @@ class GerberExpPrefGroupUI(OptionsGroupUI): super(GerberExpPrefGroupUI, self).__init__(self) self.setTitle(str(_("Gerber Export"))) + self.decimals = 4 # Plot options self.export_options_label = QtWidgets.QLabel("%s:" % _("Export Options")) @@ -1798,6 +1801,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): super(GerberEditorPrefGroupUI, self).__init__(self) self.setTitle(str(_("Gerber Editor"))) + self.decimals = 4 # Advanced Gerber Parameters self.param_label = QtWidgets.QLabel("%s:" % _("Parameters")) @@ -1845,7 +1849,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): self.addsize_entry = FCDoubleSpinner() self.addsize_entry.set_range(0, 100) - self.addsize_entry.set_precision(4) + self.addsize_entry.set_precision(self.decimals) grid0.addWidget(self.addsize_entry_lbl, 2, 0) grid0.addWidget(self.addsize_entry, 2, 1) @@ -1910,7 +1914,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): ) # self.drill_pitch_label.setMinimumWidth(100) self.grb_pitch_entry = FCDoubleSpinner() - self.grb_pitch_entry.set_precision(4) + self.grb_pitch_entry.set_precision(self.decimals) grid0.addWidget(self.grb_pitch_label, 8, 0) grid0.addWidget(self.grb_pitch_entry, 8, 1) @@ -1921,7 +1925,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): _("Angle at which each element in circular array is placed.") ) self.grb_angle_entry = FCDoubleSpinner() - self.grb_angle_entry.set_precision(4) + self.grb_angle_entry.set_precision(self.decimals) self.grb_angle_entry.set_range(-360, 360) self.grb_angle_entry.setSingleStep(5) @@ -1950,7 +1954,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): _("Angle at which each element in circular array is placed.") ) self.grb_circular_angle_entry = FCDoubleSpinner() - self.grb_circular_angle_entry.set_precision(4) + self.grb_circular_angle_entry.set_precision(self.decimals) self.grb_circular_angle_entry.set_range(-360, 360) self.grb_circular_angle_entry.setSingleStep(5) @@ -1967,7 +1971,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): _("Distance at which to buffer the Gerber element.") ) self.grb_buff_entry = FCDoubleSpinner() - self.grb_buff_entry.set_precision(4) + self.grb_buff_entry.set_precision(self.decimals) self.grb_buff_entry.set_range(-9999, 9999) @@ -1983,7 +1987,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): _("Factor to scale the Gerber element.") ) self.grb_scale_entry = FCDoubleSpinner() - self.grb_scale_entry.set_precision(4) + self.grb_scale_entry.set_precision(self.decimals) self.grb_scale_entry.set_range(0, 9999) grid0.addWidget(self.grb_scale_label, 16, 0) @@ -1998,7 +2002,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): _("Threshold value under which the apertures are not marked.") ) self.grb_ma_low_entry = FCDoubleSpinner() - self.grb_ma_low_entry.set_precision(4) + self.grb_ma_low_entry.set_precision(self.decimals) self.grb_ma_low_entry.set_range(0, 9999) grid0.addWidget(self.grb_ma_low_label, 18, 0) @@ -2010,7 +2014,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI): _("Threshold value over which the apertures are not marked.") ) self.grb_ma_high_entry = FCDoubleSpinner() - self.grb_ma_high_entry.set_precision(4) + self.grb_ma_high_entry.set_precision(self.decimals) self.grb_ma_high_entry.set_range(0, 9999) grid0.addWidget(self.grb_ma_high_label, 19, 0) @@ -4032,19 +4036,17 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) nccoverlabel.setToolTip( _("How much (fraction) of the tool width to overlap each tool pass.\n" - "Example:\n" - "A value here of 0.25 means 25%% from the tool diameter found above.\n\n" "Adjust the value starting with lower values\n" "and increasing it if areas that should be cleared are still \n" "not cleared.\n" - "Lower values = faster processing, faster execution on PCB.\n" + "Lower values = faster processing, faster execution on CNC.\n" "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) - self.ncc_overlap_entry = FCDoubleSpinner() + self.ncc_overlap_entry = FCDoubleSpinner(suffix='%') self.ncc_overlap_entry.set_precision(self.decimals) self.ncc_overlap_entry.setWrapping(True) - self.ncc_overlap_entry.setRange(0.000, 0.999) + self.ncc_overlap_entry.setRange(0.0000, 99.9999) self.ncc_overlap_entry.setSingleStep(0.1) grid0.addWidget(nccoverlabel, 8, 0) grid0.addWidget(self.ncc_overlap_entry, 8, 1) @@ -4459,19 +4461,17 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI): ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) ovlabel.setToolTip( _("How much (fraction) of the tool width to overlap each tool pass.\n" - "Example:\n" - "A value here of 0.25 means 25%% from the tool diameter found above.\n\n" "Adjust the value starting with lower values\n" "and increasing it if areas that should be painted are still \n" "not painted.\n" - "Lower values = faster processing, faster execution on PCB.\n" + "Lower values = faster processing, faster execution on CNC.\n" "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) - self.paintoverlap_entry = FCDoubleSpinner() - self.paintoverlap_entry.set_precision(3) + self.paintoverlap_entry = FCDoubleSpinner(suffix='%') + self.paintoverlap_entry.set_precision(self.decimals) self.paintoverlap_entry.setWrapping(True) - self.paintoverlap_entry.setRange(0.000, 0.999) + self.paintoverlap_entry.setRange(0.0000, 99.9999) self.paintoverlap_entry.setSingleStep(0.1) grid0.addWidget(ovlabel, 2, 0) diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py index ed9c57a7..6095e14d 100644 --- a/flatcamTools/ToolNonCopperClear.py +++ b/flatcamTools/ToolNonCopperClear.py @@ -319,12 +319,10 @@ class NonCopperClear(FlatCAMTool, Gerber): nccoverlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) nccoverlabel.setToolTip( _("How much (fraction) of the tool width to overlap each tool pass.\n" - "Example:\n" - "A value here of 0.25 means 25%% from the tool diameter found above.\n\n" "Adjust the value starting with lower values\n" "and increasing it if areas that should be cleared are still \n" "not cleared.\n" - "Lower values = faster processing, faster execution on PCB.\n" + "Lower values = faster processing, faster execution on CNC.\n" "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) @@ -1120,15 +1118,10 @@ class NonCopperClear(FlatCAMTool, Gerber): self.reset_usage() self.app.report_usage("on_paint_button_click") - self.overlap = float(self.ncc_overlap_entry.get_value()) + self.overlap = float(self.ncc_overlap_entry.get_value()) / 100.0 self.grb_circle_steps = int(self.app.defaults["gerber_circle_steps"]) - if self.overlap >= 1 or self.overlap < 0: - self.app.inform.emit('[ERROR_NOTCL] %s' % _("Overlap value must be between " - "0 (inclusive) and 1 (exclusive), ")) - return - self.connect = self.ncc_connect_cb.get_value() self.contour = self.ncc_contour_cb.get_value() self.has_offset = self.ncc_choice_offset_cb.isChecked() @@ -1423,7 +1416,7 @@ class NonCopperClear(FlatCAMTool, Gerber): else: ncc_select = self.reference_radio.get_value() - overlap = overlap if overlap else float(self.app.defaults["tools_nccoverlap"]) + overlap = overlap if overlap is not None else float(self.app.defaults["tools_nccoverlap"]) connect = connect if connect else self.app.defaults["tools_nccconnect"] contour = contour if contour else self.app.defaults["tools_ncccontour"] diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py index 419e33f2..e74cc5eb 100644 --- a/flatcamTools/ToolPaint.py +++ b/flatcamTools/ToolPaint.py @@ -219,19 +219,17 @@ class ToolPaint(FlatCAMTool, Gerber): ovlabel = QtWidgets.QLabel('%s:' % _('Overlap Rate')) ovlabel.setToolTip( _("How much (fraction) of the tool width to overlap each tool pass.\n" - "Example:\n" - "A value here of 0.25 means 25%% from the tool diameter found above.\n\n" "Adjust the value starting with lower values\n" "and increasing it if areas that should be painted are still \n" "not painted.\n" - "Lower values = faster processing, faster execution on PCB.\n" + "Lower values = faster processing, faster execution on CNC.\n" "Higher values = slow processing and slow execution on CNC\n" "due of too many paths.") ) self.paintoverlap_entry = FCDoubleSpinner(suffix='%') self.paintoverlap_entry.set_precision(3) self.paintoverlap_entry.setWrapping(True) - self.paintoverlap_entry.setRange(0.000, 0.999) + self.paintoverlap_entry.setRange(0.0000, 99.9999) self.paintoverlap_entry.setSingleStep(0.1) grid3.addWidget(ovlabel, 1, 0) grid3.addWidget(self.paintoverlap_entry, 1, 1) @@ -956,7 +954,7 @@ class ToolPaint(FlatCAMTool, Gerber): # ##################################################### self.app.inform.emit(_("Paint Tool. Reading parameters.")) - self.overlap = float(self.paintoverlap_entry.get_value()) + self.overlap = float(self.paintoverlap_entry.get_value()) / 100.0 self.connect = self.pathconnect_cb.get_value() self.contour = self.paintcontour_cb.get_value()