Просмотр исходного кода

- in Copper Thieving Tool added the display of the patterned plated area (approximative area)

Marius Stanciu 6 лет назад
Родитель
Сommit
92ea7e83be
3 измененных файлов с 25 добавлено и 5 удалено
  1. 1 0
      README.md
  2. 5 3
      flatcamGUI/GUIElements.py
  3. 19 2
      flatcamTools/ToolCopperThieving.py

+ 1 - 0
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 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
 - 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
 - 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
 3.12.2019
 
 

+ 5 - 3
flatcamGUI/GUIElements.py

@@ -353,10 +353,11 @@ class IntEntry(QtWidgets.QLineEdit):
 
 
 
 
 class FCEntry(QtWidgets.QLineEdit):
 class FCEntry(QtWidgets.QLineEdit):
-    def __init__(self, parent=None):
+    def __init__(self, decimals=None, parent=None):
         super(FCEntry, self).__init__(parent)
         super(FCEntry, self).__init__(parent)
         self.readyToEdit = True
         self.readyToEdit = True
         self.editingFinished.connect(self.on_edit_finished)
         self.editingFinished.connect(self.on_edit_finished)
+        self.decimals = decimals if decimals is not None else 4
 
 
     def on_edit_finished(self):
     def on_edit_finished(self):
         self.clearFocus()
         self.clearFocus()
@@ -376,9 +377,10 @@ class FCEntry(QtWidgets.QLineEdit):
     def get_value(self):
     def get_value(self):
         return str(self.text())
         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:
         if type(val) is float:
-            self.setText('%.*f' % (decimals, val))
+            self.setText('%.*f' % (decimal_digits, val))
         else:
         else:
             self.setText(str(val))
             self.setText(str(val))
 
 

+ 19 - 2
flatcamTools/ToolCopperThieving.py

@@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore
 
 
 import FlatCAMApp
 import FlatCAMApp
 from FlatCAMTool import FlatCAMTool
 from FlatCAMTool import FlatCAMTool
-from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet
+from flatcamGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry
 from FlatCAMObj import FlatCAMGerber, FlatCAMGeometry, FlatCAMExcellon
 from FlatCAMObj import FlatCAMGerber, FlatCAMGeometry, FlatCAMExcellon
 
 
 import shapely.geometry.base as base
 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_label, 9, 0)
         grid_lay_1.addWidget(self.clearance_ppm_entry, 9, 1)
         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
         # ## Pattern Plating Mask
         self.ppm_button = QtWidgets.QPushButton(_("Generate pattern plating mask"))
         self.ppm_button = QtWidgets.QPushButton(_("Generate pattern plating mask"))
         self.ppm_button.setToolTip(
         self.ppm_button.setToolTip(
@@ -432,7 +444,7 @@ class ToolCopperThieving(FlatCAMTool):
               "the geometries of the copper thieving and/or\n"
               "the geometries of the copper thieving and/or\n"
               "the robber bar if those were generated.")
               "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()
         self.layout.addStretch()
 
 
@@ -1345,6 +1357,11 @@ class ToolCopperThieving(FlatCAMTool):
 
 
                 geo_list.append(app_obj.robber_geo.buffer(ppm_clearance))
                 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.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"))
             app_obj.app.proc_container.update_view_text(' %s' % _("Append source file"))