- Tool Copper Thieving - made sure that the clearance for pattern plating mask is applied also for positive values

- Tool Copper Thieving - when creating pattern plating masks now the user can select to use only the pads and that's useful when the soldermsk Gerber is actually a copper Gerber
- Tool Copper Thieving - changed the units for plated area from mm2 in cm2 when the app units are Metric
- Calculator Tool - Electroplating Calculator - changing the area will update the current value
- GUI Elements FCDoubleSpinner and FCSpinner: modified the context menu to not allow cut/paste/delete/step_up/step_down when the GUI element is set as Read Only
This commit is contained in:
Marius Stanciu
2020-11-21 02:58:17 +02:00
committed by Marius
parent 5f39a7b634
commit 89453e56b4
7 changed files with 125 additions and 33 deletions

View File

@@ -214,7 +214,7 @@ class ToolCalculator(AppTool):
inch_val = float(self.ui.inch_entry.get_value())
self.ui.mm_entry.set_value('%.*f' % (self.decimals, (inch_val * 25.4)))
def on_calculate_eplate(self):
def on_calculate_current(self):
"""
:return:
@@ -229,7 +229,30 @@ class ToolCalculator(AppTool):
[(10cm x 10cm x 2 sides] * 0.001076391] x 20 =~ 4.3 Amps = C
or:
(10cm x 10cm) * 0.0021527820833419] x 20 =~ 4.3 Amps = C
'''
self.ui_disconnect()
area_calc_sel = self.ui.area_sel_radio.get_value()
length = self.ui.pcblength_entry.get_value()
width = self.ui.pcbwidth_entry.get_value()
area = self.ui.area_entry.get_value()
density = self.ui.cdensity_entry.get_value()
if area_calc_sel == 'd':
calculated_current = (length * width * density) * 0.0021527820833419
else:
calculated_current = (area * density) * 0.0021527820833419
self.ui.cvalue_entry.set_value('%.2f' % calculated_current)
self.ui_connect()
def on_calculate_time(self):
"""
:return:
"""
'''
Calculated time for a copper growth of 10 microns is:
[10um / (28um/hr)] x 60 min/hr = 21.42 minutes = TC (at 20ASF)
or:
@@ -239,25 +262,20 @@ class ToolCalculator(AppTool):
(with new_density = 20ASF amd copper groth of 10 um)
'''
self.ui_disconnect()
area_calc_sel = self.ui.area_sel_radio.get_value()
length = self.ui.pcblength_entry.get_value()
width = self.ui.pcbwidth_entry.get_value()
area = self.ui.area_entry.get_value()
density = self.ui.cdensity_entry.get_value()
copper = self.ui.growth_entry.get_value()
growth = self.ui.growth_entry.get_value()
if area_calc_sel == 'd':
calculated_current = (length * width * density) * 0.0021527820833419
else:
calculated_current = (area * density) * 0.0021527820833419
calculated_time = copper * 2.142857142857143 * float(20 / density)
calculated_time = growth * 2.142857142857143 * float(20 / density)
self.ui.cvalue_entry.set_value('%.2f' % calculated_current)
self.ui.time_entry.set_value('%.1f' % calculated_time)
self.app.inform.emit('[success] %s' % _("Done."))
self.ui_connect()
def on_calculate_eplate(self):
self.on_calculate_time()
self.on_calculate_current()
self.app.inform.emit('[success] %s' % _("Done."))
def on_calculate_growth(self):
self.ui_disconnect()
density = self.ui.cdensity_entry.get_value()
@@ -287,11 +305,11 @@ class ToolCalculator(AppTool):
self.ui.cdensity_entry.valueChanged.connect(self.on_calculate_eplate)
self.ui.cdensity_entry.returnPressed.connect(self.on_calculate_eplate)
self.ui.growth_entry.valueChanged.connect(self.on_calculate_eplate)
self.ui.growth_entry.returnPressed.connect(self.on_calculate_eplate)
self.ui.growth_entry.valueChanged.connect(self.on_calculate_time)
self.ui.growth_entry.returnPressed.connect(self.on_calculate_time)
self.ui.cdensity_entry.valueChanged.connect(self.on_calculate_growth)
self.ui.cdensity_entry.returnPressed.connect(self.on_calculate_growth)
self.ui.area_entry.valueChanged.connect(self.on_calculate_current)
self.ui.area_entry.returnPressed.connect(self.on_calculate_current)
self.ui.time_entry.valueChanged.connect(self.on_calculate_growth)
self.ui.time_entry.returnPressed.connect(self.on_calculate_growth)
@@ -308,7 +326,7 @@ class ToolCalculator(AppTool):
self.ui.cutDepth_entry.returnPressed.disconnect()
except (AttributeError, TypeError):
pass
# ##
try:
self.ui.effectiveToolDia_entry.valueChanged.disconnect()
except (AttributeError, TypeError):
@@ -317,6 +335,7 @@ class ToolCalculator(AppTool):
self.ui.effectiveToolDia_entry.returnPressed.disconnect()
except (AttributeError, TypeError):
pass
# ###
try:
self.ui.tipDia_entry.returnPressed.disconnect()
@@ -332,6 +351,7 @@ class ToolCalculator(AppTool):
pass
# Electroplating Calculator
# Density
try:
self.ui.cdensity_entry.valueChanged.disconnect()
except (AttributeError, TypeError):
@@ -340,6 +360,7 @@ class ToolCalculator(AppTool):
self.ui.cdensity_entry.returnPressed.disconnect()
except (AttributeError, TypeError):
pass
# Growth
try:
self.ui.growth_entry.valueChanged.disconnect()
except (AttributeError, TypeError):
@@ -348,14 +369,16 @@ class ToolCalculator(AppTool):
self.ui.growth_entry.returnPressed.disconnect()
except (AttributeError, TypeError):
pass
# Area
try:
self.ui.cdensity_entry.valueChanged.disconnect()
self.ui.area_entry.valueChanged.disconnect()
except (AttributeError, TypeError):
pass
try:
self.ui.cdensity_entry.returnPressed.disconnect()
self.ui.area_entry.returnPressed.disconnect()
except (AttributeError, TypeError):
pass
# Time
try:
self.ui.time_entry.valueChanged.disconnect()
except (AttributeError, TypeError):
@@ -364,6 +387,7 @@ class ToolCalculator(AppTool):
self.ui.time_entry.returnPressed.disconnect()
except (AttributeError, TypeError):
pass
# Calculate
try:
self.ui.calculate_plate_button.clicked.disconnect()
except (AttributeError, TypeError):

View File

@@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui
from camlib import grace
from appTool import AppTool
from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox, FCLabel
from appGUI.GUIElements import FCDoubleSpinner, RadioSet, FCEntry, FCComboBox, FCLabel, FCCheckBox
import shapely.geometry.base as base
from shapely.ops import unary_union
@@ -166,6 +166,7 @@ class ToolCopperThieving(AppTool):
self.ui.rb_margin_entry.set_value(self.app.defaults["tools_copper_thieving_rb_margin"])
self.ui.rb_thickness_entry.set_value(self.app.defaults["tools_copper_thieving_rb_thickness"])
self.ui.only_pads_cb.set_value(self.app.defaults["tools_copper_thieving_only_apds"])
self.ui.clearance_ppm_entry.set_value(self.app.defaults["tools_copper_thieving_mask_clearance"])
self.ui.ppm_choice_radio.set_value(self.app.defaults["tools_copper_thieving_geo_choice"])
@@ -951,7 +952,8 @@ class ToolCopperThieving(AppTool):
def on_new_pattern_plating_object(self):
ppm_clearance = self.ui.clearance_ppm_entry.get_value()
geo_choice = self.ui.ppm_choice_radio.get_value()
rb_thickness = self.rb_thickness
rb_thickness = self.ui.rb_thickness_entry.get_value()
only_pads = self.ui.only_pads_cb.get_value()
# get the Gerber object on which the Copper thieving will be inserted
selection_index = self.ui.sm_object_combo.currentIndex()
@@ -965,15 +967,26 @@ class ToolCopperThieving(AppTool):
return
self.app.proc_container.update_view_text(' %s' % _("Append PP-M geometry"))
geo_list = deepcopy(self.sm_object.solid_geometry)
if isinstance(geo_list, MultiPolygon):
geo_list = list(geo_list.geoms)
geo_list = []
if only_pads is False:
geo_list = deepcopy(self.sm_object.solid_geometry)
if isinstance(geo_list, MultiPolygon):
geo_list = list(geo_list.geoms)
else:
for apid in self.sm_object.apertures:
for k in self.sm_object.apertures[apid]:
if k == 'geometry':
for elem in self.sm_object.apertures[apid]['geometry']:
if 'follow' in elem and isinstance(elem['follow'], Point):
if 'solid' in elem:
geo_list.append(elem['solid'])
# create a copy of the source apertures so we can manipulate them without altering the source object
new_apertures = deepcopy(self.sm_object.apertures)
# if the clearance is negative apply it to the original soldermask geometry too
if ppm_clearance < 0:
# if the clearance is not zero apply it to the original soldermask geometry too
if ppm_clearance != 0:
temp_geo_list = []
for geo in geo_list:
temp_geo_list.append(geo.buffer(ppm_clearance))
@@ -1088,6 +1101,10 @@ class ToolCopperThieving(AppTool):
geo_list.append(robber_solid_geo.buffer(ppm_clearance))
# and then set the total plated area value to the GUI element
# the area is in mm2 when using Metric units, make it in cm2 for Metric units
print(plated_area)
if self.units.lower() == 'mm':
plated_area /= 100
self.ui.plated_area_entry.set_value(plated_area)
new_solid_geometry = MultiPolygon(geo_list).buffer(0.0000001).buffer(-0.0000001)
@@ -1644,6 +1661,13 @@ class ThievingUI:
grid_lay_1.addWidget(self.sm_obj_label, 14, 0, 1, 3)
grid_lay_1.addWidget(self.sm_object_combo, 16, 0, 1, 3)
# Only Pads
self.only_pads_cb = FCCheckBox(_("Only Pads"))
self.only_pads_cb.setToolTip(
_("Select only pads in case the selected object is a copper Gerber.")
)
grid_lay_1.addWidget(self.only_pads_cb, 17, 0, 1, 3)
# Openings CLEARANCE #
self.clearance_ppm_label = FCLabel('%s:' % _("Clearance"))
self.clearance_ppm_label.setToolTip(
@@ -1669,10 +1693,10 @@ class ThievingUI:
"calculated from the soldermask openings.")
)
self.plated_area_entry = FCEntry()
self.plated_area_entry.setDisabled(True)
self.plated_area_entry.setReadOnly(True)
if self.units.upper() == 'MM':
self.units_area_label = FCLabel('%s<sup>2</sup>' % _("mm"))
self.units_area_label = FCLabel('%s<sup>2</sup>' % _("cm"))
else:
self.units_area_label = FCLabel('%s<sup>2</sup>' % _("in"))