diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 1cbb90dc..7a4b6496 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -859,6 +859,14 @@ class App(QtCore.QObject): "tools_qrcode_rounded": self.ui.tools2_defaults_form.tools2_qrcode_group.bb_radio, "tools_qrcode_fill_color": self.ui.tools2_defaults_form.tools2_qrcode_group.fill_color_entry, "tools_qrcode_back_color": self.ui.tools2_defaults_form.tools2_qrcode_group.back_color_entry, + "tools_qrcode_sel_limit": self.ui.tools2_defaults_form.tools2_qrcode_group.sel_limit_entry, + + # Copper Fill Tool + "tools_copperfill_clearance": self.ui.tools2_defaults_form.tools2_cfill_group.clearance_entry, + "tools_copperfill_margin": self.ui.tools2_defaults_form.tools2_cfill_group.margin_entry, + "tools_copperfill_reference": self.ui.tools2_defaults_form.tools2_cfill_group.reference_radio, + "tools_copperfill_box_type": self.ui.tools2_defaults_form.tools2_cfill_group.bbox_type_radio, + "tools_copperfill_circle_steps": self.ui.tools2_defaults_form.tools2_cfill_group.circlesteps_entry, # Utilities # File associations @@ -1329,6 +1337,14 @@ class App(QtCore.QObject): "tools_qrcode_rounded": 's', "tools_qrcode_fill_color": '#000000', "tools_qrcode_back_color": '#FFFFFF', + "tools_qrcode_sel_limit": 330, + + # Copper Fill Tool + "tools_copperfill_clearance": 0.01, + "tools_copperfill_margin": 0.039, + "tools_copperfill_reference": 'itself', + "tools_copperfill_box_type": 'rect', + "tools_copperfill_circle_steps": 128, # Utilities # file associations diff --git a/README.md b/README.md index 6549ab7a..a182ea89 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ CAD program, and create G-Code for Isolation routing. - added a new FlatCAM Tool: Copper Fill Tool. It will pour copper into a Gerber filling all empty space with copper, at a clearance distance of the Gerber features - Copper Fill Tool: added possibility to select between a bounding box rectangular or convex hull when the reference is the geometry of the source Gerber object - Copper Fill Tool: cleanup on not regular tool exit +- Copper Fill Tool: added GUI category in Edit -> Preferences window +- QRCode Tool: added a selection limit parameter to control the selection shape vs utility geo 24.10.2019 diff --git a/flatcamGUI/PreferencesUI.py b/flatcamGUI/PreferencesUI.py index 679296fb..e0edfb7a 100644 --- a/flatcamGUI/PreferencesUI.py +++ b/flatcamGUI/PreferencesUI.py @@ -219,6 +219,9 @@ class Tools2PreferencesUI(QtWidgets.QWidget): self.tools2_qrcode_group = Tools2QRCodePrefGroupUI() self.tools2_qrcode_group.setMinimumWidth(220) + self.tools2_cfill_group = Tools2CFillPrefGroupUI() + self.tools2_cfill_group.setMinimumWidth(220) + self.vlay = QtWidgets.QVBoxLayout() self.vlay.addWidget(self.tools2_checkrules_group) self.vlay.addWidget(self.tools2_optimal_group) @@ -226,13 +229,11 @@ class Tools2PreferencesUI(QtWidgets.QWidget): self.vlay1 = QtWidgets.QVBoxLayout() self.vlay1.addWidget(self.tools2_qrcode_group) - self.vlay2 = QtWidgets.QVBoxLayout() - + self.vlay2.addWidget(self.tools2_cfill_group) self.vlay3 = QtWidgets.QVBoxLayout() - self.layout.addLayout(self.vlay) self.layout.addLayout(self.vlay1) self.layout.addLayout(self.vlay2) @@ -5563,6 +5564,115 @@ class Tools2QRCodePrefGroupUI(OptionsGroupUI): grid_lay.addWidget(self.back_color_label, 10, 0) grid_lay.addWidget(back_color_widget, 10, 1) + # Selection Limit + self.sel_limit_label = QtWidgets.QLabel('%s:' % _("Selection limit")) + self.sel_limit_label.setToolTip( + _("Set the number of selected geometry\n" + "items above which the utility geometry\n" + "becomes just a selection rectangle.\n" + "Increases the performance when moving a\n" + "large number of geometric elements.") + ) + self.sel_limit_entry = FCSpinner() + self.sel_limit_entry.set_range(0, 9999) + + grid_lay.addWidget(self.sel_limit_label, 11, 0) + grid_lay.addWidget(self.sel_limit_entry, 11, 1) + # self.layout.addStretch() + + +class Tools2CFillPrefGroupUI(OptionsGroupUI): + def __init__(self, parent=None): + + super(Tools2CFillPrefGroupUI, self).__init__(self) + + self.setTitle(str(_("Copper Fill Tool Options"))) + self.decimals = 4 + + # ## Grid Layout + grid_lay = QtWidgets.QGridLayout() + self.layout.addLayout(grid_lay) + grid_lay.setColumnStretch(0, 0) + grid_lay.setColumnStretch(1, 1) + + # ## Parameters + self.cflabel = QtWidgets.QLabel('%s' % _('Parameters')) + self.cflabel.setToolTip( + _("A tool to generate a Copper fill that can be added\n" + "to a selected Gerber file.") + ) + grid_lay.addWidget(self.cflabel, 0, 0, 1, 2) + + # CIRCLE STEPS - to be used when buffering + self.circle_steps_lbl = QtWidgets.QLabel('%s:' % _("Circle Steps")) + self.circle_steps_lbl.setToolTip( + _("Number of steps (lines) used to interpolate circles.") + ) + + self.circlesteps_entry = FCSpinner() + self.circlesteps_entry.set_range(1, 9999) + + grid_lay.addWidget(self.circle_steps_lbl, 1, 0) + grid_lay.addWidget(self.circlesteps_entry, 1, 1) + + # CLEARANCE # + self.clearance_label = QtWidgets.QLabel('%s:' % _("Clearance")) + self.clearance_label.setToolTip( + _("This set the distance between the copper fill components\n" + "(the polygon fill may be split in multiple polygons)\n" + "and the copper traces in the Gerber file.") + ) + self.clearance_entry = FCDoubleSpinner() + self.clearance_entry.setMinimum(0.00001) + self.clearance_entry.set_precision(self.decimals) + self.clearance_entry.setSingleStep(0.1) + + grid_lay.addWidget(self.clearance_label, 2, 0) + grid_lay.addWidget(self.clearance_entry, 2, 1) + + # MARGIN # + self.margin_label = QtWidgets.QLabel('%s:' % _("Margin")) + self.margin_label.setToolTip( + _("Bounding box margin.") + ) + self.margin_entry = FCDoubleSpinner() + self.margin_entry.setMinimum(0.0) + self.margin_entry.set_precision(self.decimals) + self.margin_entry.setSingleStep(0.1) + + grid_lay.addWidget(self.margin_label, 3, 0) + grid_lay.addWidget(self.margin_entry, 3, 1) + + # Reference # + self.reference_radio = RadioSet([ + {'label': _('Itself'), 'value': 'itself'}, + {"label": _("Area Selection"), "value": "area"}, + {'label': _("Reference Object"), 'value': 'box'} + ], orientation='vertical', stretch=False) + self.reference_label = QtWidgets.QLabel(_("Reference:")) + self.reference_label.setToolTip( + _("- 'Itself' - the copper fill extent is based on the object that is copper cleared.\n " + "- 'Area Selection' - left mouse click to start selection of the area to be filled.\n" + "- 'Reference Object' - will do copper filling within the area specified by another object.") + ) + grid_lay.addWidget(self.reference_label, 4, 0) + grid_lay.addWidget(self.reference_radio, 4, 1) + + # Bounding Box Type # + self.bbox_type_radio = RadioSet([ + {'label': _('Rectangular'), 'value': 'rect'}, + {"label": _("Minimal"), "value": "min"} + ], stretch=False) + self.bbox_type_label = QtWidgets.QLabel(_("Box Type:")) + self.bbox_type_label.setToolTip( + _("- 'Rectangular' - the bounding box will be of rectangular shape.\n " + "- 'Minimal' - the bounding box will be the convex hull shape.") + ) + grid_lay.addWidget(self.bbox_type_label, 5, 0) + grid_lay.addWidget(self.bbox_type_radio, 5, 1) + + self.layout.addStretch() + class FAExcPrefGroupUI(OptionsGroupUI): def __init__(self, parent=None): diff --git a/flatcamTools/ToolCopperFill.py b/flatcamTools/ToolCopperFill.py index 6410a20b..16c52b5f 100644 --- a/flatcamTools/ToolCopperFill.py +++ b/flatcamTools/ToolCopperFill.py @@ -247,16 +247,12 @@ class ToolCopperFill(FlatCAMTool): def set_tool_ui(self): self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value() - # self.clearance_entry.set_value(float(self.app.defaults["tools_copperfill_clearance"])) - # self.margin_entry.set_value(float(self.app.defaults["tools_copperfill_margin"])) - # self.reference_radio.set_value(self.app.defaults["tools_copperfill_reference"]) - # self.geo_steps_per_circle = int(self.app.defaults["tools_copperfill_circle_steps"]) - # self.bbox_type_radio.set_value(self.app.defaults["tools_copperfill_box_type"]) + self.clearance_entry.set_value(float(self.app.defaults["tools_copperfill_clearance"])) + self.margin_entry.set_value(float(self.app.defaults["tools_copperfill_margin"])) + self.reference_radio.set_value(self.app.defaults["tools_copperfill_reference"]) + self.bbox_type_radio.set_value(self.app.defaults["tools_copperfill_box_type"]) - self.clearance_entry.set_value(0.5) - self.margin_entry.set_value(1.0) - self.reference_radio.set_value('itself') - self.bbox_type_radio.set_value('rect') + self.geo_steps_per_circle = int(self.app.defaults["tools_copperfill_circle_steps"]) self.area_method = False diff --git a/flatcamTools/ToolQRCode.py b/flatcamTools/ToolQRCode.py index bfeb7cdf..f4f87dd9 100644 --- a/flatcamTools/ToolQRCode.py +++ b/flatcamTools/ToolQRCode.py @@ -562,8 +562,8 @@ class QRCode(FlatCAMTool): offset_geo = list() # I use the len of self.qrcode_geometry instead of the utility one because the complexity of the polygons is - # better seen in this - if len(self.qrcode_geometry) <= 330: + # better seen in this (bit what if the sel.qrcode_geometry is just one geo element? len will fail ... + if len(self.qrcode_geometry) <= self.app.defaults["tools_qrcode_sel_limit"]: try: for poly in self.qrcode_utility_geometry: offset_geo.append(translate(poly.exterior, xoff=pos[0], yoff=pos[1])) diff --git a/share/qrcode32.png b/share/qrcode32.png index e2856f8c..1c12a716 100644 Binary files a/share/qrcode32.png and b/share/qrcode32.png differ