diff --git a/README.md b/README.md index e2814834..c936a801 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ CAD program, and create G-Code for Isolation routing. - 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 +- in Copper Thieving Tool added the display of the patterned plated area (approximative area) 3.12.2019 diff --git a/flatcamGUI/GUIElements.py b/flatcamGUI/GUIElements.py index 537210a1..7a5a285c 100644 --- a/flatcamGUI/GUIElements.py +++ b/flatcamGUI/GUIElements.py @@ -353,10 +353,11 @@ class IntEntry(QtWidgets.QLineEdit): class FCEntry(QtWidgets.QLineEdit): - def __init__(self, parent=None): + def __init__(self, decimals=None, parent=None): super(FCEntry, self).__init__(parent) self.readyToEdit = True self.editingFinished.connect(self.on_edit_finished) + self.decimals = decimals if decimals is not None else 4 def on_edit_finished(self): self.clearFocus() @@ -376,9 +377,10 @@ class FCEntry(QtWidgets.QLineEdit): def get_value(self): return str(self.text()) - def set_value(self, val, decimals=4): + def set_value(self, val, decimals=None): + decimal_digits = decimals if decimals is not None else self.decimals if type(val) is float: - self.setText('%.*f' % (decimals, val)) + self.setText('%.*f' % (decimal_digits, val)) else: self.setText(str(val)) diff --git a/flatcamTools/ToolCopperThieving.py b/flatcamTools/ToolCopperThieving.py index 6320d92c..0c111daf 100644 --- a/flatcamTools/ToolCopperThieving.py +++ b/flatcamTools/ToolCopperThieving.py @@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore import FlatCAMApp from FlatCAMTool import FlatCAMTool -from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet +from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry from FlatCAMObj import FlatCAMGerber, FlatCAMGeometry, FlatCAMExcellon import shapely.geometry.base as base @@ -425,6 +425,18 @@ class ToolCopperThieving(FlatCAMTool): grid_lay_1.addWidget(self.clearance_ppm_label, 9, 0) grid_lay_1.addWidget(self.clearance_ppm_entry, 9, 1) + # Plated area + self.plated_area_label = QtWidgets.QLabel('%s:' % _("Plated area")) + self.plated_area_label.setToolTip( + _("The area to be plated by pattern plating.\n" + "Basically is made from the openings in the plating mask.") + ) + self.plated_area_entry = FCEntry() + self.plated_area_entry.setDisabled(True) + + grid_lay_1.addWidget(self.plated_area_label, 10, 0) + grid_lay_1.addWidget(self.plated_area_entry, 10, 1) + # ## Pattern Plating Mask self.ppm_button = QtWidgets.QPushButton(_("Generate pattern plating mask")) self.ppm_button.setToolTip( @@ -432,7 +444,7 @@ class ToolCopperThieving(FlatCAMTool): "the geometries of the copper thieving and/or\n" "the robber bar if those were generated.") ) - grid_lay_1.addWidget(self.ppm_button, 10, 0, 1, 2) + grid_lay_1.addWidget(self.ppm_button, 11, 0, 1, 2) self.layout.addStretch() @@ -1345,6 +1357,11 @@ class ToolCopperThieving(FlatCAMTool): geo_list.append(app_obj.robber_geo.buffer(ppm_clearance)) + plated_area = 0.0 + for geo in geo_list: + plated_area += geo.area + self.plated_area_entry.set_value(plated_area) + app_obj.sm_object.solid_geometry = MultiPolygon(geo_list).buffer(0.0000001).buffer(-0.0000001) app_obj.app.proc_container.update_view_text(' %s' % _("Append source file"))