|
|
@@ -8,7 +8,7 @@
|
|
|
from PyQt5 import QtWidgets, QtGui
|
|
|
|
|
|
from appTool import AppTool
|
|
|
-from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCComboBox
|
|
|
+from appGUI.GUIElements import FCDoubleSpinner, FCCheckBox, OptionalInputSection, FCComboBox, FCLabel, FCButton
|
|
|
from copy import deepcopy
|
|
|
|
|
|
from appPool import *
|
|
|
@@ -30,8 +30,6 @@ log = logging.getLogger('base')
|
|
|
|
|
|
class RulesCheck(AppTool):
|
|
|
|
|
|
- toolName = _("Check Rules")
|
|
|
-
|
|
|
tool_finished = QtCore.pyqtSignal(list)
|
|
|
|
|
|
def __init__(self, app):
|
|
|
@@ -39,1596 +37,1632 @@ class RulesCheck(AppTool):
|
|
|
|
|
|
AppTool.__init__(self, app)
|
|
|
|
|
|
- # ## Title
|
|
|
- title_label = QtWidgets.QLabel("%s" % self.toolName)
|
|
|
- title_label.setStyleSheet("""
|
|
|
- QLabel
|
|
|
- {
|
|
|
- font-size: 16px;
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
- """)
|
|
|
- self.layout.addWidget(title_label)
|
|
|
-
|
|
|
- # Form Layout
|
|
|
- self.grid_layout = QtWidgets.QGridLayout()
|
|
|
- self.layout.addLayout(self.grid_layout)
|
|
|
-
|
|
|
- self.grid_layout.setColumnStretch(0, 0)
|
|
|
- self.grid_layout.setColumnStretch(1, 3)
|
|
|
- self.grid_layout.setColumnStretch(2, 0)
|
|
|
+ # #############################################################################
|
|
|
+ # ######################### Tool GUI ##########################################
|
|
|
+ # #############################################################################
|
|
|
+ self.ui = RulesUI(layout=self.layout, app=self.app)
|
|
|
+ self.toolName = self.ui.toolName
|
|
|
|
|
|
- self.gerber_title_lbl = QtWidgets.QLabel('<b>%s</b>:' % _("GERBER"))
|
|
|
- self.gerber_title_lbl.setToolTip(
|
|
|
- _("Gerber objects for which to check rules.")
|
|
|
- )
|
|
|
+ # #######################################################
|
|
|
+ # ################ SIGNALS ##############################
|
|
|
+ # #######################################################
|
|
|
+ self.ui.copper_t_cb.stateChanged.connect(lambda st: self.ui.copper_t_object.setDisabled(not st))
|
|
|
+ self.ui.copper_b_cb.stateChanged.connect(lambda st: self.ui.copper_b_object.setDisabled(not st))
|
|
|
|
|
|
- self.all_obj_cb = FCCheckBox()
|
|
|
+ self.ui.sm_t_cb.stateChanged.connect(lambda st: self.ui.sm_t_object.setDisabled(not st))
|
|
|
+ self.ui.sm_b_cb.stateChanged.connect(lambda st: self.ui.sm_b_object.setDisabled(not st))
|
|
|
|
|
|
- self.grid_layout.addWidget(self.gerber_title_lbl, 0, 0, 1, 2)
|
|
|
- self.grid_layout.addWidget(self.all_obj_cb, 0, 2)
|
|
|
+ self.ui.ss_t_cb.stateChanged.connect(lambda st: self.ui.ss_t_object.setDisabled(not st))
|
|
|
+ self.ui.ss_b_cb.stateChanged.connect(lambda st: self.ui.ss_b_object.setDisabled(not st))
|
|
|
|
|
|
- # Copper Top object
|
|
|
- self.copper_t_object = FCComboBox()
|
|
|
- self.copper_t_object.setModel(self.app.collection)
|
|
|
- self.copper_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- self.copper_t_object.is_last = True
|
|
|
- self.copper_t_object.obj_type = "Gerber"
|
|
|
+ self.ui.out_cb.stateChanged.connect(lambda st: self.ui.outline_object.setDisabled(not st))
|
|
|
|
|
|
- self.copper_t_object_lbl = QtWidgets.QLabel('%s:' % _("Top"))
|
|
|
- self.copper_t_object_lbl.setToolTip(
|
|
|
- _("The Top Gerber Copper object for which rules are checked.")
|
|
|
- )
|
|
|
+ self.ui.e1_cb.stateChanged.connect(lambda st: self.ui.e1_object.setDisabled(not st))
|
|
|
+ self.ui.e2_cb.stateChanged.connect(lambda st: self.ui.e2_object.setDisabled(not st))
|
|
|
|
|
|
- self.copper_t_cb = FCCheckBox()
|
|
|
+ self.ui.all_obj_cb.stateChanged.connect(self.ui.on_all_objects_cb_changed)
|
|
|
+ self.ui.all_cb.stateChanged.connect(self.ui.on_all_cb_changed)
|
|
|
+ self.ui.run_button.clicked.connect(self.execute)
|
|
|
|
|
|
- self.grid_layout.addWidget(self.copper_t_object_lbl, 1, 0)
|
|
|
- self.grid_layout.addWidget(self.copper_t_object, 1, 1)
|
|
|
- self.grid_layout.addWidget(self.copper_t_cb, 1, 2)
|
|
|
+ self.ui.reset_button.clicked.connect(self.set_tool_ui)
|
|
|
+
|
|
|
+ # Custom Signals
|
|
|
+ self.tool_finished.connect(self.on_tool_finished)
|
|
|
|
|
|
- # Copper Bottom object
|
|
|
- self.copper_b_object = FCComboBox()
|
|
|
- self.copper_b_object.setModel(self.app.collection)
|
|
|
- self.copper_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- self.copper_b_object.is_last = True
|
|
|
- self.copper_b_object.obj_type = "Gerber"
|
|
|
+ # list to hold the temporary objects
|
|
|
+ self.objs = []
|
|
|
|
|
|
- self.copper_b_object_lbl = QtWidgets.QLabel('%s:' % _("Bottom"))
|
|
|
- self.copper_b_object_lbl.setToolTip(
|
|
|
- _("The Bottom Gerber Copper object for which rules are checked.")
|
|
|
- )
|
|
|
+ # final name for the panel object
|
|
|
+ self.outname = ""
|
|
|
|
|
|
- self.copper_b_cb = FCCheckBox()
|
|
|
+ # flag to signal the constrain was activated
|
|
|
+ self.constrain_flag = False
|
|
|
|
|
|
- self.grid_layout.addWidget(self.copper_b_object_lbl, 2, 0)
|
|
|
- self.grid_layout.addWidget(self.copper_b_object, 2, 1)
|
|
|
- self.grid_layout.addWidget(self.copper_b_cb, 2, 2)
|
|
|
+ # Multiprocessing Process Pool
|
|
|
+ self.pool = self.app.pool
|
|
|
+ self.results = None
|
|
|
|
|
|
- # SolderMask Top object
|
|
|
- self.sm_t_object = FCComboBox()
|
|
|
- self.sm_t_object.setModel(self.app.collection)
|
|
|
- self.sm_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- self.sm_t_object.is_last = True
|
|
|
- self.sm_t_object.obj_type = "Gerber"
|
|
|
+ self.decimals = 4
|
|
|
|
|
|
- self.sm_t_object_lbl = QtWidgets.QLabel('%s:' % _("SM Top"))
|
|
|
- self.sm_t_object_lbl.setToolTip(
|
|
|
- _("The Top Gerber Solder Mask object for which rules are checked.")
|
|
|
- )
|
|
|
+ # def on_object_loaded(self, index, row):
|
|
|
+ # print(index.internalPointer().child_items[row].obj.options['name'], index.data())
|
|
|
|
|
|
- self.sm_t_cb = FCCheckBox()
|
|
|
+ def run(self, toggle=True):
|
|
|
+ self.app.defaults.report_usage("ToolRulesCheck()")
|
|
|
|
|
|
- self.grid_layout.addWidget(self.sm_t_object_lbl, 3, 0)
|
|
|
- self.grid_layout.addWidget(self.sm_t_object, 3, 1)
|
|
|
- self.grid_layout.addWidget(self.sm_t_cb, 3, 2)
|
|
|
+ if toggle:
|
|
|
+ # if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
|
|
+ if self.app.ui.splitter.sizes()[0] == 0:
|
|
|
+ self.app.ui.splitter.setSizes([1, 1])
|
|
|
+ else:
|
|
|
+ try:
|
|
|
+ if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
|
|
+ # if tab is populated with the tool but it does not have the focus, focus on it
|
|
|
+ if not self.app.ui.notebook.currentWidget() is self.app.ui.tool_tab:
|
|
|
+ # focus on Tool Tab
|
|
|
+ self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
|
|
|
+ else:
|
|
|
+ self.app.ui.splitter.setSizes([0, 1])
|
|
|
+ except AttributeError:
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ if self.app.ui.splitter.sizes()[0] == 0:
|
|
|
+ self.app.ui.splitter.setSizes([1, 1])
|
|
|
|
|
|
- # SolderMask Bottom object
|
|
|
- self.sm_b_object = FCComboBox()
|
|
|
- self.sm_b_object.setModel(self.app.collection)
|
|
|
- self.sm_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- self.sm_b_object.is_last = True
|
|
|
- self.sm_b_object.obj_type = "Gerber"
|
|
|
+ AppTool.run(self)
|
|
|
+ self.set_tool_ui()
|
|
|
|
|
|
- self.sm_b_object_lbl = QtWidgets.QLabel('%s:' % _("SM Bottom"))
|
|
|
- self.sm_b_object_lbl.setToolTip(
|
|
|
- _("The Bottom Gerber Solder Mask object for which rules are checked.")
|
|
|
- )
|
|
|
+ self.app.ui.notebook.setTabText(2, _("Rules Tool"))
|
|
|
|
|
|
- self.sm_b_cb = FCCheckBox()
|
|
|
+ def install(self, icon=None, separator=None, **kwargs):
|
|
|
+ AppTool.install(self, icon, separator, shortcut='Alt+R', **kwargs)
|
|
|
|
|
|
- self.grid_layout.addWidget(self.sm_b_object_lbl, 4, 0)
|
|
|
- self.grid_layout.addWidget(self.sm_b_object, 4, 1)
|
|
|
- self.grid_layout.addWidget(self.sm_b_cb, 4, 2)
|
|
|
+ def set_tool_ui(self):
|
|
|
|
|
|
- # SilkScreen Top object
|
|
|
- self.ss_t_object = FCComboBox()
|
|
|
- self.ss_t_object.setModel(self.app.collection)
|
|
|
- self.ss_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- self.ss_t_object.is_last = True
|
|
|
- self.ss_t_object.obj_type = "Gerber"
|
|
|
+ # all object combobox default as disabled
|
|
|
+ self.ui.copper_t_object.setDisabled(True)
|
|
|
+ self.ui.copper_b_object.setDisabled(True)
|
|
|
+
|
|
|
+ self.ui.sm_t_object.setDisabled(True)
|
|
|
+ self.ui.sm_b_object.setDisabled(True)
|
|
|
+
|
|
|
+ self.ui.ss_t_object.setDisabled(True)
|
|
|
+ self.ui.ss_b_object.setDisabled(True)
|
|
|
+
|
|
|
+ self.ui.outline_object.setDisabled(True)
|
|
|
+
|
|
|
+ self.ui.e1_object.setDisabled(True)
|
|
|
+ self.ui.e2_object.setDisabled(True)
|
|
|
+
|
|
|
+ self.ui.trace_size_cb.set_value(self.app.defaults["tools_cr_trace_size"])
|
|
|
+ self.ui.trace_size_entry.set_value(float(self.app.defaults["tools_cr_trace_size_val"]))
|
|
|
+ self.ui.clearance_copper2copper_cb.set_value(self.app.defaults["tools_cr_c2c"])
|
|
|
+ self.ui.clearance_copper2copper_entry.set_value(float(self.app.defaults["tools_cr_c2c_val"]))
|
|
|
+ self.ui.clearance_copper2ol_cb.set_value(self.app.defaults["tools_cr_c2o"])
|
|
|
+ self.ui.clearance_copper2ol_entry.set_value(float(self.app.defaults["tools_cr_c2o_val"]))
|
|
|
+ self.ui.clearance_silk2silk_cb.set_value(self.app.defaults["tools_cr_s2s"])
|
|
|
+ self.ui.clearance_silk2silk_entry.set_value(float(self.app.defaults["tools_cr_s2s_val"]))
|
|
|
+ self.ui.clearance_silk2sm_cb.set_value(self.app.defaults["tools_cr_s2sm"])
|
|
|
+ self.ui.clearance_silk2sm_entry.set_value(float(self.app.defaults["tools_cr_s2sm_val"]))
|
|
|
+ self.ui.clearance_silk2ol_cb.set_value(self.app.defaults["tools_cr_s2o"])
|
|
|
+ self.ui.clearance_silk2ol_entry.set_value(float(self.app.defaults["tools_cr_s2o_val"]))
|
|
|
+ self.ui.clearance_sm2sm_cb.set_value(self.app.defaults["tools_cr_sm2sm"])
|
|
|
+ self.ui.clearance_sm2sm_entry.set_value(float(self.app.defaults["tools_cr_sm2sm_val"]))
|
|
|
+ self.ui.ring_integrity_cb.set_value(self.app.defaults["tools_cr_ri"])
|
|
|
+ self.ui.ring_integrity_entry.set_value(float(self.app.defaults["tools_cr_ri_val"]))
|
|
|
+ self.ui.clearance_d2d_cb.set_value(self.app.defaults["tools_cr_h2h"])
|
|
|
+ self.ui.clearance_d2d_entry.set_value(float(self.app.defaults["tools_cr_h2h_val"]))
|
|
|
+ self.ui.drill_size_cb.set_value(self.app.defaults["tools_cr_dh"])
|
|
|
+ self.ui.drill_size_entry.set_value(float(self.app.defaults["tools_cr_dh_val"]))
|
|
|
|
|
|
- self.ss_t_object_lbl = QtWidgets.QLabel('%s:' % _("Silk Top"))
|
|
|
- self.ss_t_object_lbl.setToolTip(
|
|
|
- _("The Top Gerber Silkscreen object for which rules are checked.")
|
|
|
- )
|
|
|
+ self.reset_fields()
|
|
|
|
|
|
- self.ss_t_cb = FCCheckBox()
|
|
|
+ @staticmethod
|
|
|
+ def check_inside_gerber_clearance(gerber_obj, size, rule):
|
|
|
+ log.debug("RulesCheck.check_inside_gerber_clearance()")
|
|
|
|
|
|
- self.grid_layout.addWidget(self.ss_t_object_lbl, 5, 0)
|
|
|
- self.grid_layout.addWidget(self.ss_t_object, 5, 1)
|
|
|
- self.grid_layout.addWidget(self.ss_t_cb, 5, 2)
|
|
|
+ rule_title = rule
|
|
|
|
|
|
- # SilkScreen Bottom object
|
|
|
- self.ss_b_object = FCComboBox()
|
|
|
- self.ss_b_object.setModel(self.app.collection)
|
|
|
- self.ss_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- self.ss_b_object.is_last = True
|
|
|
- self.ss_b_object.obj_type = "Gerber"
|
|
|
+ violations = []
|
|
|
+ obj_violations = {}
|
|
|
+ obj_violations.update({
|
|
|
+ 'name': '',
|
|
|
+ 'points': list()
|
|
|
+ })
|
|
|
|
|
|
- self.ss_b_object_lbl = QtWidgets.QLabel('%s:' % _("Silk Bottom"))
|
|
|
- self.ss_b_object_lbl.setToolTip(
|
|
|
- _("The Bottom Gerber Silkscreen object for which rules are checked.")
|
|
|
- )
|
|
|
+ if not gerber_obj:
|
|
|
+ return 'Fail. Not enough Gerber objects to check Gerber 2 Gerber clearance'
|
|
|
|
|
|
- self.ss_b_cb = FCCheckBox()
|
|
|
+ obj_violations['name'] = gerber_obj['name']
|
|
|
|
|
|
- self.grid_layout.addWidget(self.ss_b_object_lbl, 6, 0)
|
|
|
- self.grid_layout.addWidget(self.ss_b_object, 6, 1)
|
|
|
- self.grid_layout.addWidget(self.ss_b_cb, 6, 2)
|
|
|
+ solid_geo = []
|
|
|
+ clear_geo = []
|
|
|
+ for apid in gerber_obj['apertures']:
|
|
|
+ if 'geometry' in gerber_obj['apertures'][apid]:
|
|
|
+ geometry = gerber_obj['apertures'][apid]['geometry']
|
|
|
+ for geo_el in geometry:
|
|
|
+ if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
+ solid_geo.append(geo_el['solid'])
|
|
|
+ if 'clear' in geo_el and geo_el['clear'] is not None:
|
|
|
+ clear_geo.append(geo_el['clear'])
|
|
|
|
|
|
- # Outline object
|
|
|
- self.outline_object = FCComboBox()
|
|
|
- self.outline_object.setModel(self.app.collection)
|
|
|
- self.outline_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- self.outline_object.is_last = True
|
|
|
- self.outline_object.obj_type = "Gerber"
|
|
|
+ if clear_geo:
|
|
|
+ total_geo = []
|
|
|
+ for geo_c in clear_geo:
|
|
|
+ for geo_s in solid_geo:
|
|
|
+ if geo_c.within(geo_s):
|
|
|
+ total_geo.append(geo_s.difference(geo_c))
|
|
|
+ else:
|
|
|
+ total_geo = MultiPolygon(solid_geo)
|
|
|
+ total_geo = total_geo.buffer(0.000001)
|
|
|
|
|
|
- self.outline_object_lbl = QtWidgets.QLabel('%s:' % _("Outline"))
|
|
|
- self.outline_object_lbl.setToolTip(
|
|
|
- _("The Gerber Outline (Cutout) object for which rules are checked.")
|
|
|
- )
|
|
|
+ if isinstance(total_geo, Polygon):
|
|
|
+ obj_violations['points'] = ['Failed. Only one polygon.']
|
|
|
+ return rule_title, [obj_violations]
|
|
|
+ else:
|
|
|
+ iterations = len(total_geo)
|
|
|
+ iterations = (iterations * (iterations - 1)) / 2
|
|
|
+ log.debug("RulesCheck.check_gerber_clearance(). Iterations: %s" % str(iterations))
|
|
|
|
|
|
- self.out_cb = FCCheckBox()
|
|
|
+ min_dict = {}
|
|
|
+ idx = 1
|
|
|
+ for geo in total_geo:
|
|
|
+ for s_geo in total_geo[idx:]:
|
|
|
+ # minimize the number of distances by not taking into considerations those that are too small
|
|
|
+ dist = geo.distance(s_geo)
|
|
|
+ if float(dist) < float(size):
|
|
|
+ loc_1, loc_2 = nearest_points(geo, s_geo)
|
|
|
|
|
|
- self.grid_layout.addWidget(self.outline_object_lbl, 7, 0)
|
|
|
- self.grid_layout.addWidget(self.outline_object, 7, 1)
|
|
|
- self.grid_layout.addWidget(self.out_cb, 7, 2)
|
|
|
+ dx = loc_1.x - loc_2.x
|
|
|
+ dy = loc_1.y - loc_2.y
|
|
|
+ loc = min(loc_1.x, loc_2.x) + (abs(dx) / 2), min(loc_1.y, loc_2.y) + (abs(dy) / 2)
|
|
|
|
|
|
- self.grid_layout.addWidget(QtWidgets.QLabel(""), 8, 0, 1, 3)
|
|
|
+ if dist in min_dict:
|
|
|
+ min_dict[dist].append(loc)
|
|
|
+ else:
|
|
|
+ min_dict[dist] = [loc]
|
|
|
+ idx += 1
|
|
|
+ points_list = set()
|
|
|
+ for dist in min_dict.keys():
|
|
|
+ for location in min_dict[dist]:
|
|
|
+ points_list.add(location)
|
|
|
|
|
|
- self.excellon_title_lbl = QtWidgets.QLabel('<b>%s</b>:' % _("EXCELLON"))
|
|
|
- self.excellon_title_lbl.setToolTip(
|
|
|
- _("Excellon objects for which to check rules.")
|
|
|
- )
|
|
|
+ obj_violations['points'] = list(points_list)
|
|
|
+ violations.append(deepcopy(obj_violations))
|
|
|
|
|
|
- self.grid_layout.addWidget(self.excellon_title_lbl, 9, 0, 1, 3)
|
|
|
+ return rule_title, violations
|
|
|
|
|
|
- # Excellon 1 object
|
|
|
- self.e1_object = FCComboBox()
|
|
|
- self.e1_object.setModel(self.app.collection)
|
|
|
- self.e1_object.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
|
|
|
- self.e1_object.is_last = True
|
|
|
- self.e1_object.obj_type = "Excellon"
|
|
|
+ @staticmethod
|
|
|
+ def check_gerber_clearance(gerber_list, size, rule):
|
|
|
+ log.debug("RulesCheck.check_gerber_clearance()")
|
|
|
+ rule_title = rule
|
|
|
|
|
|
- self.e1_object_lbl = QtWidgets.QLabel('%s:' % _("Excellon 1"))
|
|
|
- self.e1_object_lbl.setToolTip(
|
|
|
- _("Excellon object for which to check rules.\n"
|
|
|
- "Holds the plated holes or a general Excellon file content.")
|
|
|
- )
|
|
|
+ violations = []
|
|
|
+ obj_violations = {}
|
|
|
+ obj_violations.update({
|
|
|
+ 'name': '',
|
|
|
+ 'points': list()
|
|
|
+ })
|
|
|
|
|
|
- self.e1_cb = FCCheckBox()
|
|
|
+ if len(gerber_list) == 2:
|
|
|
+ gerber_1 = gerber_list[0]
|
|
|
+ # added it so I won't have errors of using before declaring
|
|
|
+ gerber_2 = {}
|
|
|
|
|
|
- self.grid_layout.addWidget(self.e1_object_lbl, 10, 0)
|
|
|
- self.grid_layout.addWidget(self.e1_object, 10, 1)
|
|
|
- self.grid_layout.addWidget(self.e1_cb, 10, 2)
|
|
|
+ gerber_3 = gerber_list[1]
|
|
|
+ elif len(gerber_list) == 3:
|
|
|
+ gerber_1 = gerber_list[0]
|
|
|
+ gerber_2 = gerber_list[1]
|
|
|
+ gerber_3 = gerber_list[2]
|
|
|
+ else:
|
|
|
+ return 'Fail. Not enough Gerber objects to check Gerber 2 Gerber clearance'
|
|
|
|
|
|
- # Excellon 2 object
|
|
|
- self.e2_object = FCComboBox()
|
|
|
- self.e2_object.setModel(self.app.collection)
|
|
|
- self.e2_object.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
|
|
|
- self.e2_object.is_last = True
|
|
|
- self.e2_object.obj_type = "Excellon"
|
|
|
+ total_geo_grb_1 = []
|
|
|
+ for apid in gerber_1['apertures']:
|
|
|
+ if 'geometry' in gerber_1['apertures'][apid]:
|
|
|
+ geometry = gerber_1['apertures'][apid]['geometry']
|
|
|
+ for geo_el in geometry:
|
|
|
+ if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
+ total_geo_grb_1.append(geo_el['solid'])
|
|
|
|
|
|
- self.e2_object_lbl = QtWidgets.QLabel('%s:' % _("Excellon 2"))
|
|
|
- self.e2_object_lbl.setToolTip(
|
|
|
- _("Excellon object for which to check rules.\n"
|
|
|
- "Holds the non-plated holes.")
|
|
|
- )
|
|
|
+ if len(gerber_list) == 3:
|
|
|
+ # add the second Gerber geometry to the first one if it exists
|
|
|
+ for apid in gerber_2['apertures']:
|
|
|
+ if 'geometry' in gerber_2['apertures'][apid]:
|
|
|
+ geometry = gerber_2['apertures'][apid]['geometry']
|
|
|
+ for geo_el in geometry:
|
|
|
+ if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
+ total_geo_grb_1.append(geo_el['solid'])
|
|
|
|
|
|
- self.e2_cb = FCCheckBox()
|
|
|
+ total_geo_grb_3 = []
|
|
|
+ for apid in gerber_3['apertures']:
|
|
|
+ if 'geometry' in gerber_3['apertures'][apid]:
|
|
|
+ geometry = gerber_3['apertures'][apid]['geometry']
|
|
|
+ for geo_el in geometry:
|
|
|
+ if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
+ total_geo_grb_3.append(geo_el['solid'])
|
|
|
|
|
|
- self.grid_layout.addWidget(self.e2_object_lbl, 11, 0)
|
|
|
- self.grid_layout.addWidget(self.e2_object, 11, 1)
|
|
|
- self.grid_layout.addWidget(self.e2_cb, 11, 2)
|
|
|
+ total_geo_grb_1 = MultiPolygon(total_geo_grb_1)
|
|
|
+ total_geo_grb_1 = total_geo_grb_1.buffer(0)
|
|
|
|
|
|
- self.grid_layout.addWidget(QtWidgets.QLabel(""), 12, 0, 1, 3)
|
|
|
+ total_geo_grb_3 = MultiPolygon(total_geo_grb_3)
|
|
|
+ total_geo_grb_3 = total_geo_grb_3.buffer(0)
|
|
|
|
|
|
- # Control All
|
|
|
- self.all_cb = FCCheckBox('%s' % _("All Rules"))
|
|
|
- self.all_cb.setToolTip(
|
|
|
- _("This check/uncheck all the rules below.")
|
|
|
- )
|
|
|
- self.all_cb.setStyleSheet(
|
|
|
- """
|
|
|
- QCheckBox {font-weight: bold; color: green}
|
|
|
- """
|
|
|
- )
|
|
|
- self.layout.addWidget(self.all_cb)
|
|
|
+ if isinstance(total_geo_grb_1, Polygon):
|
|
|
+ len_1 = 1
|
|
|
+ total_geo_grb_1 = [total_geo_grb_1]
|
|
|
+ else:
|
|
|
+ len_1 = len(total_geo_grb_1)
|
|
|
|
|
|
- # Form Layout
|
|
|
- self.form_layout_1 = QtWidgets.QFormLayout()
|
|
|
- self.layout.addLayout(self.form_layout_1)
|
|
|
+ if isinstance(total_geo_grb_3, Polygon):
|
|
|
+ len_3 = 1
|
|
|
+ total_geo_grb_3 = [total_geo_grb_3]
|
|
|
+ else:
|
|
|
+ len_3 = len(total_geo_grb_3)
|
|
|
|
|
|
- self.form_layout_1.addRow(QtWidgets.QLabel(""))
|
|
|
+ iterations = len_1 * len_3
|
|
|
+ log.debug("RulesCheck.check_gerber_clearance(). Iterations: %s" % str(iterations))
|
|
|
|
|
|
- # Trace size
|
|
|
- self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size"))
|
|
|
- self.trace_size_cb.setToolTip(
|
|
|
- _("This checks if the minimum size for traces is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.trace_size_cb)
|
|
|
+ min_dict = {}
|
|
|
+ for geo in total_geo_grb_1:
|
|
|
+ for s_geo in total_geo_grb_3:
|
|
|
+ # minimize the number of distances by not taking into considerations those that are too small
|
|
|
+ dist = geo.distance(s_geo)
|
|
|
+ if float(dist) < float(size):
|
|
|
+ loc_1, loc_2 = nearest_points(geo, s_geo)
|
|
|
|
|
|
- # Trace size value
|
|
|
- self.trace_size_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.trace_size_entry.set_range(0.00001, 999.99999)
|
|
|
- self.trace_size_entry.set_precision(self.decimals)
|
|
|
- self.trace_size_entry.setSingleStep(0.1)
|
|
|
+ dx = loc_1.x - loc_2.x
|
|
|
+ dy = loc_1.y - loc_2.y
|
|
|
+ loc = min(loc_1.x, loc_2.x) + (abs(dx) / 2), min(loc_1.y, loc_2.y) + (abs(dy) / 2)
|
|
|
|
|
|
- self.trace_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.trace_size_lbl.setToolTip(
|
|
|
- _("Minimum acceptable trace size.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry)
|
|
|
+ if dist in min_dict:
|
|
|
+ min_dict[dist].append(loc)
|
|
|
+ else:
|
|
|
+ min_dict[dist] = [loc]
|
|
|
|
|
|
- self.ts = OptionalInputSection(self.trace_size_cb, [self.trace_size_lbl, self.trace_size_entry])
|
|
|
+ points_list = set()
|
|
|
+ for dist in min_dict.keys():
|
|
|
+ for location in min_dict[dist]:
|
|
|
+ points_list.add(location)
|
|
|
|
|
|
- # Copper2copper clearance
|
|
|
- self.clearance_copper2copper_cb = FCCheckBox('%s:' % _("Copper to Copper clearance"))
|
|
|
- self.clearance_copper2copper_cb.setToolTip(
|
|
|
- _("This checks if the minimum clearance between copper\n"
|
|
|
- "features is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_copper2copper_cb)
|
|
|
+ name_list = []
|
|
|
+ if gerber_1:
|
|
|
+ name_list.append(gerber_1['name'])
|
|
|
+ if gerber_2:
|
|
|
+ name_list.append(gerber_2['name'])
|
|
|
+ if gerber_3:
|
|
|
+ name_list.append(gerber_3['name'])
|
|
|
|
|
|
- # Copper2copper clearance value
|
|
|
- self.clearance_copper2copper_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.clearance_copper2copper_entry.set_range(0.00001, 999.99999)
|
|
|
- self.clearance_copper2copper_entry.set_precision(self.decimals)
|
|
|
- self.clearance_copper2copper_entry.setSingleStep(0.1)
|
|
|
+ obj_violations['name'] = name_list
|
|
|
+ obj_violations['points'] = list(points_list)
|
|
|
+ violations.append(deepcopy(obj_violations))
|
|
|
|
|
|
- self.clearance_copper2copper_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.clearance_copper2copper_lbl.setToolTip(
|
|
|
- _("Minimum acceptable clearance value.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry)
|
|
|
+ return rule_title, violations
|
|
|
|
|
|
- self.c2c = OptionalInputSection(
|
|
|
- self.clearance_copper2copper_cb, [self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry])
|
|
|
+ @staticmethod
|
|
|
+ def check_holes_size(elements, size):
|
|
|
+ log.debug("RulesCheck.check_holes_size()")
|
|
|
|
|
|
- # Copper2outline clearance
|
|
|
- self.clearance_copper2ol_cb = FCCheckBox('%s:' % _("Copper to Outline clearance"))
|
|
|
- self.clearance_copper2ol_cb.setToolTip(
|
|
|
- _("This checks if the minimum clearance between copper\n"
|
|
|
- "features and the outline is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_copper2ol_cb)
|
|
|
+ rule = _("Hole Size")
|
|
|
|
|
|
- # Copper2outline clearance value
|
|
|
- self.clearance_copper2ol_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.clearance_copper2ol_entry.set_range(0.00001, 999.99999)
|
|
|
- self.clearance_copper2ol_entry.set_precision(self.decimals)
|
|
|
- self.clearance_copper2ol_entry.setSingleStep(0.1)
|
|
|
+ violations = []
|
|
|
+ obj_violations = {}
|
|
|
+ obj_violations.update({
|
|
|
+ 'name': '',
|
|
|
+ 'dia': list()
|
|
|
+ })
|
|
|
|
|
|
- self.clearance_copper2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.clearance_copper2ol_lbl.setToolTip(
|
|
|
- _("Minimum acceptable clearance value.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry)
|
|
|
+ for elem in elements:
|
|
|
+ dia_list = []
|
|
|
|
|
|
- self.c2ol = OptionalInputSection(
|
|
|
- self.clearance_copper2ol_cb, [self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry])
|
|
|
+ name = elem['name']
|
|
|
+ for tool in elem['tools']:
|
|
|
+ tool_dia = float('%.*f' % (4, float(elem['tools'][tool]['C'])))
|
|
|
+ if tool_dia < float(size):
|
|
|
+ dia_list.append(tool_dia)
|
|
|
+ obj_violations['name'] = name
|
|
|
+ obj_violations['dia'] = dia_list
|
|
|
+ violations.append(deepcopy(obj_violations))
|
|
|
|
|
|
- # Silkscreen2silkscreen clearance
|
|
|
- self.clearance_silk2silk_cb = FCCheckBox('%s:' % _("Silk to Silk Clearance"))
|
|
|
- self.clearance_silk2silk_cb.setToolTip(
|
|
|
- _("This checks if the minimum clearance between silkscreen\n"
|
|
|
- "features and silkscreen features is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_silk2silk_cb)
|
|
|
+ return rule, violations
|
|
|
|
|
|
- # Copper2silkscreen clearance value
|
|
|
- self.clearance_silk2silk_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.clearance_silk2silk_entry.set_range(0.00001, 999.99999)
|
|
|
- self.clearance_silk2silk_entry.set_precision(self.decimals)
|
|
|
- self.clearance_silk2silk_entry.setSingleStep(0.1)
|
|
|
+ @staticmethod
|
|
|
+ def check_holes_clearance(elements, size):
|
|
|
+ log.debug("RulesCheck.check_holes_clearance()")
|
|
|
+ rule = _("Hole to Hole Clearance")
|
|
|
|
|
|
- self.clearance_silk2silk_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.clearance_silk2silk_lbl.setToolTip(
|
|
|
- _("Minimum acceptable clearance value.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry)
|
|
|
+ violations = []
|
|
|
+ obj_violations = {}
|
|
|
+ obj_violations.update({
|
|
|
+ 'name': '',
|
|
|
+ 'points': list()
|
|
|
+ })
|
|
|
|
|
|
- self.s2s = OptionalInputSection(
|
|
|
- self.clearance_silk2silk_cb, [self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry])
|
|
|
+ total_geo = []
|
|
|
+ for elem in elements:
|
|
|
+ for tool in elem['tools']:
|
|
|
+ if 'solid_geometry' in elem['tools'][tool]:
|
|
|
+ geometry = elem['tools'][tool]['solid_geometry']
|
|
|
+ for geo in geometry:
|
|
|
+ total_geo.append(geo)
|
|
|
|
|
|
- # Silkscreen2soldermask clearance
|
|
|
- self.clearance_silk2sm_cb = FCCheckBox('%s:' % _("Silk to Solder Mask Clearance"))
|
|
|
- self.clearance_silk2sm_cb.setToolTip(
|
|
|
- _("This checks if the minimum clearance between silkscreen\n"
|
|
|
- "features and soldermask features is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_silk2sm_cb)
|
|
|
+ min_dict = {}
|
|
|
+ idx = 1
|
|
|
+ for geo in total_geo:
|
|
|
+ for s_geo in total_geo[idx:]:
|
|
|
|
|
|
- # Silkscreen2soldermask clearance value
|
|
|
- self.clearance_silk2sm_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.clearance_silk2sm_entry.set_range(0.00001, 999.99999)
|
|
|
- self.clearance_silk2sm_entry.set_precision(self.decimals)
|
|
|
- self.clearance_silk2sm_entry.setSingleStep(0.1)
|
|
|
+ # minimize the number of distances by not taking into considerations those that are too small
|
|
|
+ dist = geo.distance(s_geo)
|
|
|
+ loc_1, loc_2 = nearest_points(geo, s_geo)
|
|
|
|
|
|
- self.clearance_silk2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.clearance_silk2sm_lbl.setToolTip(
|
|
|
- _("Minimum acceptable clearance value.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry)
|
|
|
+ dx = loc_1.x - loc_2.x
|
|
|
+ dy = loc_1.y - loc_2.y
|
|
|
+ loc = min(loc_1.x, loc_2.x) + (abs(dx) / 2), min(loc_1.y, loc_2.y) + (abs(dy) / 2)
|
|
|
|
|
|
- self.s2sm = OptionalInputSection(
|
|
|
- self.clearance_silk2sm_cb, [self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry])
|
|
|
+ if dist in min_dict:
|
|
|
+ min_dict[dist].append(loc)
|
|
|
+ else:
|
|
|
+ min_dict[dist] = [loc]
|
|
|
+ idx += 1
|
|
|
|
|
|
- # Silk2outline clearance
|
|
|
- self.clearance_silk2ol_cb = FCCheckBox('%s:' % _("Silk to Outline Clearance"))
|
|
|
- self.clearance_silk2ol_cb.setToolTip(
|
|
|
- _("This checks if the minimum clearance between silk\n"
|
|
|
- "features and the outline is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_silk2ol_cb)
|
|
|
+ points_list = set()
|
|
|
+ for dist in min_dict.keys():
|
|
|
+ if float(dist) < size:
|
|
|
+ for location in min_dict[dist]:
|
|
|
+ points_list.add(location)
|
|
|
|
|
|
- # Silk2outline clearance value
|
|
|
- self.clearance_silk2ol_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.clearance_silk2ol_entry.set_range(0.00001, 999.99999)
|
|
|
- self.clearance_silk2ol_entry.set_precision(self.decimals)
|
|
|
- self.clearance_silk2ol_entry.setSingleStep(0.1)
|
|
|
+ name_list = []
|
|
|
+ for elem in elements:
|
|
|
+ name_list.append(elem['name'])
|
|
|
|
|
|
- self.clearance_silk2ol_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.clearance_silk2ol_lbl.setToolTip(
|
|
|
- _("Minimum acceptable clearance value.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry)
|
|
|
+ obj_violations['name'] = name_list
|
|
|
+ obj_violations['points'] = list(points_list)
|
|
|
+ violations.append(deepcopy(obj_violations))
|
|
|
|
|
|
- self.s2ol = OptionalInputSection(
|
|
|
- self.clearance_silk2ol_cb, [self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry])
|
|
|
+ return rule, violations
|
|
|
|
|
|
- # Soldermask2soldermask clearance
|
|
|
- self.clearance_sm2sm_cb = FCCheckBox('%s:' % _("Minimum Solder Mask Sliver"))
|
|
|
- self.clearance_sm2sm_cb.setToolTip(
|
|
|
- _("This checks if the minimum clearance between soldermask\n"
|
|
|
- "features and soldermask features is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_sm2sm_cb)
|
|
|
+ @staticmethod
|
|
|
+ def check_traces_size(elements, size):
|
|
|
+ log.debug("RulesCheck.check_traces_size()")
|
|
|
|
|
|
- # Soldermask2soldermask clearance value
|
|
|
- self.clearance_sm2sm_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.clearance_sm2sm_entry.set_range(0.00001, 999.99999)
|
|
|
- self.clearance_sm2sm_entry.set_precision(self.decimals)
|
|
|
- self.clearance_sm2sm_entry.setSingleStep(0.1)
|
|
|
+ rule = _("Trace Size")
|
|
|
|
|
|
- self.clearance_sm2sm_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.clearance_sm2sm_lbl.setToolTip(
|
|
|
- _("Minimum acceptable clearance value.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry)
|
|
|
+ violations = []
|
|
|
+ obj_violations = {}
|
|
|
+ obj_violations.update({
|
|
|
+ 'name': '',
|
|
|
+ 'size': list(),
|
|
|
+ 'points': list()
|
|
|
+ })
|
|
|
|
|
|
- self.sm2sm = OptionalInputSection(
|
|
|
- self.clearance_sm2sm_cb, [self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry])
|
|
|
+ for elem in elements:
|
|
|
+ dia_list = []
|
|
|
+ points_list = []
|
|
|
+ name = elem['name']
|
|
|
|
|
|
- # Ring integrity check
|
|
|
- self.ring_integrity_cb = FCCheckBox('%s:' % _("Minimum Annular Ring"))
|
|
|
- self.ring_integrity_cb.setToolTip(
|
|
|
- _("This checks if the minimum copper ring left by drilling\n"
|
|
|
- "a hole into a pad is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.ring_integrity_cb)
|
|
|
+ for apid in elem['apertures']:
|
|
|
+ try:
|
|
|
+ tool_dia = float(elem['apertures'][apid]['size'])
|
|
|
+ if tool_dia < float(size) and tool_dia != 0.0:
|
|
|
+ dia_list.append(tool_dia)
|
|
|
+ for geo_el in elem['apertures'][apid]['geometry']:
|
|
|
+ if 'solid' in geo_el.keys():
|
|
|
+ geo = geo_el['solid']
|
|
|
+ pt = geo.representative_point()
|
|
|
+ points_list.append((pt.x, pt.y))
|
|
|
+ except Exception:
|
|
|
+ # An exception will be raised for the 'size' key in case of apertures of type AM (macro) which does
|
|
|
+ # not have the size key
|
|
|
+ pass
|
|
|
|
|
|
- # Ring integrity value
|
|
|
- self.ring_integrity_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.ring_integrity_entry.set_range(0.00001, 999.99999)
|
|
|
- self.ring_integrity_entry.set_precision(self.decimals)
|
|
|
- self.ring_integrity_entry.setSingleStep(0.1)
|
|
|
+ obj_violations['name'] = name
|
|
|
+ obj_violations['size'] = dia_list
|
|
|
+ obj_violations['points'] = points_list
|
|
|
+ violations.append(deepcopy(obj_violations))
|
|
|
+ return rule, violations
|
|
|
|
|
|
- self.ring_integrity_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.ring_integrity_lbl.setToolTip(
|
|
|
- _("Minimum acceptable ring value.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry)
|
|
|
+ @staticmethod
|
|
|
+ def check_gerber_annular_ring(obj_list, size, rule):
|
|
|
+ rule_title = rule
|
|
|
|
|
|
- self.anr = OptionalInputSection(
|
|
|
- self.ring_integrity_cb, [self.ring_integrity_lbl, self.ring_integrity_entry])
|
|
|
+ violations = []
|
|
|
+ obj_violations = {}
|
|
|
+ obj_violations.update({
|
|
|
+ 'name': '',
|
|
|
+ 'points': list()
|
|
|
+ })
|
|
|
|
|
|
- self.form_layout_1.addRow(QtWidgets.QLabel(""))
|
|
|
+ # added it so I won't have errors of using before declaring
|
|
|
+ gerber_obj = {}
|
|
|
+ gerber_extra_obj = {}
|
|
|
+ exc_obj = {}
|
|
|
+ exc_extra_obj = {}
|
|
|
|
|
|
- # Hole2Hole clearance
|
|
|
- self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance"))
|
|
|
- self.clearance_d2d_cb.setToolTip(
|
|
|
- _("This checks if the minimum clearance between a drill hole\n"
|
|
|
- "and another drill hole is met.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_d2d_cb)
|
|
|
+ if len(obj_list) == 2:
|
|
|
+ gerber_obj = obj_list[0]
|
|
|
+ exc_obj = obj_list[1]
|
|
|
+ if 'apertures' in gerber_obj and 'tools' in exc_obj:
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return 'Fail. At least one Gerber and one Excellon object is required to check Minimum Annular Ring'
|
|
|
+ elif len(obj_list) == 3:
|
|
|
+ o1 = obj_list[0]
|
|
|
+ o2 = obj_list[1]
|
|
|
+ o3 = obj_list[2]
|
|
|
+ if 'apertures' in o1 and 'apertures' in o2:
|
|
|
+ gerber_obj = o1
|
|
|
+ gerber_extra_obj = o2
|
|
|
+ exc_obj = o3
|
|
|
+ elif 'tools' in o2 and 'tools' in o3:
|
|
|
+ gerber_obj = o1
|
|
|
+ exc_obj = o2
|
|
|
+ exc_extra_obj = o3
|
|
|
+ elif len(obj_list) == 4:
|
|
|
+ gerber_obj = obj_list[0]
|
|
|
+ gerber_extra_obj = obj_list[1]
|
|
|
+ exc_obj = obj_list[2]
|
|
|
+ exc_extra_obj = obj_list[3]
|
|
|
+ else:
|
|
|
+ return 'Fail. Not enough objects to check Minimum Annular Ring'
|
|
|
|
|
|
- # Hole2Hole clearance value
|
|
|
- self.clearance_d2d_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.clearance_d2d_entry.set_range(0.00001, 999.99999)
|
|
|
- self.clearance_d2d_entry.set_precision(self.decimals)
|
|
|
- self.clearance_d2d_entry.setSingleStep(0.1)
|
|
|
+ total_geo_grb = []
|
|
|
+ for apid in gerber_obj['apertures']:
|
|
|
+ if 'geometry' in gerber_obj['apertures'][apid]:
|
|
|
+ geometry = gerber_obj['apertures'][apid]['geometry']
|
|
|
+ for geo_el in geometry:
|
|
|
+ if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
+ total_geo_grb.append(geo_el['solid'])
|
|
|
|
|
|
- self.clearance_d2d_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.clearance_d2d_lbl.setToolTip(
|
|
|
- _("Minimum acceptable clearance value.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry)
|
|
|
+ if len(obj_list) == 3 and gerber_extra_obj:
|
|
|
+ # add the second Gerber geometry to the first one if it exists
|
|
|
+ for apid in gerber_extra_obj['apertures']:
|
|
|
+ if 'geometry' in gerber_extra_obj['apertures'][apid]:
|
|
|
+ geometry = gerber_extra_obj['apertures'][apid]['geometry']
|
|
|
+ for geo_el in geometry:
|
|
|
+ if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
+ total_geo_grb.append(geo_el['solid'])
|
|
|
|
|
|
- self.d2d = OptionalInputSection(
|
|
|
- self.clearance_d2d_cb, [self.clearance_d2d_lbl, self.clearance_d2d_entry])
|
|
|
+ total_geo_grb = MultiPolygon(total_geo_grb)
|
|
|
+ total_geo_grb = total_geo_grb.buffer(0)
|
|
|
|
|
|
- # Drill holes size check
|
|
|
- self.drill_size_cb = FCCheckBox('%s:' % _("Hole Size"))
|
|
|
- self.drill_size_cb.setToolTip(
|
|
|
- _("This checks if the drill holes\n"
|
|
|
- "sizes are above the threshold.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.drill_size_cb)
|
|
|
+ total_geo_exc = []
|
|
|
+ for tool in exc_obj['tools']:
|
|
|
+ if 'solid_geometry' in exc_obj['tools'][tool]:
|
|
|
+ geometry = exc_obj['tools'][tool]['solid_geometry']
|
|
|
+ for geo in geometry:
|
|
|
+ total_geo_exc.append(geo)
|
|
|
|
|
|
- # Drile holes value
|
|
|
- self.drill_size_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
- self.drill_size_entry.set_range(0.00001, 999.99999)
|
|
|
- self.drill_size_entry.set_precision(self.decimals)
|
|
|
- self.drill_size_entry.setSingleStep(0.1)
|
|
|
+ if len(obj_list) == 3 and exc_extra_obj:
|
|
|
+ # add the second Excellon geometry to the first one if it exists
|
|
|
+ for tool in exc_extra_obj['tools']:
|
|
|
+ if 'solid_geometry' in exc_extra_obj['tools'][tool]:
|
|
|
+ geometry = exc_extra_obj['tools'][tool]['solid_geometry']
|
|
|
+ for geo in geometry:
|
|
|
+ total_geo_exc.append(geo)
|
|
|
|
|
|
- self.drill_size_lbl = QtWidgets.QLabel('%s:' % _("Min value"))
|
|
|
- self.drill_size_lbl.setToolTip(
|
|
|
- _("Minimum acceptable drill size.")
|
|
|
- )
|
|
|
- self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry)
|
|
|
+ if isinstance(total_geo_grb, Polygon):
|
|
|
+ len_1 = 1
|
|
|
+ total_geo_grb = [total_geo_grb]
|
|
|
+ else:
|
|
|
+ len_1 = len(total_geo_grb)
|
|
|
|
|
|
- self.ds = OptionalInputSection(
|
|
|
- self.drill_size_cb, [self.drill_size_lbl, self.drill_size_entry])
|
|
|
+ if isinstance(total_geo_exc, Polygon):
|
|
|
+ len_2 = 1
|
|
|
+ total_geo_exc = [total_geo_exc]
|
|
|
+ else:
|
|
|
+ len_2 = len(total_geo_exc)
|
|
|
|
|
|
- # Buttons
|
|
|
- hlay_2 = QtWidgets.QHBoxLayout()
|
|
|
- self.layout.addLayout(hlay_2)
|
|
|
+ iterations = len_1 * len_2
|
|
|
+ log.debug("RulesCheck.check_gerber_annular_ring(). Iterations: %s" % str(iterations))
|
|
|
|
|
|
- # hlay_2.addStretch()
|
|
|
- self.run_button = QtWidgets.QPushButton(_("Run Rules Check"))
|
|
|
- self.run_button.setToolTip(
|
|
|
- _("Panelize the specified object around the specified box.\n"
|
|
|
- "In other words it creates multiple copies of the source object,\n"
|
|
|
- "arranged in a 2D array of rows and columns.")
|
|
|
- )
|
|
|
- self.run_button.setStyleSheet("""
|
|
|
- QPushButton
|
|
|
- {
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
- """)
|
|
|
- hlay_2.addWidget(self.run_button)
|
|
|
+ min_dict = {}
|
|
|
+ dist = None
|
|
|
+ for geo in total_geo_grb:
|
|
|
+ for s_geo in total_geo_exc:
|
|
|
+ try:
|
|
|
+ # minimize the number of distances by not taking into considerations those that are too small
|
|
|
+ dist = abs(geo.exterior.distance(s_geo))
|
|
|
+ except Exception as e:
|
|
|
+ log.debug("RulesCheck.check_gerber_annular_ring() --> %s" % str(e))
|
|
|
|
|
|
- self.layout.addStretch()
|
|
|
+ if dist > 0:
|
|
|
+ if float(dist) < float(size):
|
|
|
+ loc_1, loc_2 = nearest_points(geo.exterior, s_geo)
|
|
|
|
|
|
- # ## Reset Tool
|
|
|
- self.reset_button = QtWidgets.QPushButton(_("Reset Tool"))
|
|
|
- self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png'))
|
|
|
- self.reset_button.setToolTip(
|
|
|
- _("Will reset the tool parameters.")
|
|
|
- )
|
|
|
- self.reset_button.setStyleSheet("""
|
|
|
- QPushButton
|
|
|
- {
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
- """)
|
|
|
- self.layout.addWidget(self.reset_button)
|
|
|
+ dx = loc_1.x - loc_2.x
|
|
|
+ dy = loc_1.y - loc_2.y
|
|
|
+ loc = min(loc_1.x, loc_2.x) + (abs(dx) / 2), min(loc_1.y, loc_2.y) + (abs(dy) / 2)
|
|
|
|
|
|
- # #######################################################
|
|
|
- # ################ SIGNALS ##############################
|
|
|
- # #######################################################
|
|
|
- self.copper_t_cb.stateChanged.connect(lambda st: self.copper_t_object.setDisabled(not st))
|
|
|
- self.copper_b_cb.stateChanged.connect(lambda st: self.copper_b_object.setDisabled(not st))
|
|
|
+ if dist in min_dict:
|
|
|
+ min_dict[dist].append(loc)
|
|
|
+ else:
|
|
|
+ min_dict[dist] = [loc]
|
|
|
+ else:
|
|
|
+ if dist in min_dict:
|
|
|
+ min_dict[dist].append(s_geo.representative_point())
|
|
|
+ else:
|
|
|
+ min_dict[dist] = [s_geo.representative_point()]
|
|
|
|
|
|
- self.sm_t_cb.stateChanged.connect(lambda st: self.sm_t_object.setDisabled(not st))
|
|
|
- self.sm_b_cb.stateChanged.connect(lambda st: self.sm_b_object.setDisabled(not st))
|
|
|
+ points_list = []
|
|
|
+ for dist in min_dict.keys():
|
|
|
+ for location in min_dict[dist]:
|
|
|
+ points_list.append(location)
|
|
|
|
|
|
- self.ss_t_cb.stateChanged.connect(lambda st: self.ss_t_object.setDisabled(not st))
|
|
|
- self.ss_b_cb.stateChanged.connect(lambda st: self.ss_b_object.setDisabled(not st))
|
|
|
+ name_list = []
|
|
|
+ try:
|
|
|
+ if gerber_obj:
|
|
|
+ name_list.append(gerber_obj['name'])
|
|
|
+ except KeyError:
|
|
|
+ pass
|
|
|
+ try:
|
|
|
+ if gerber_extra_obj:
|
|
|
+ name_list.append(gerber_extra_obj['name'])
|
|
|
+ except KeyError:
|
|
|
+ pass
|
|
|
+
|
|
|
+ try:
|
|
|
+ if exc_obj:
|
|
|
+ name_list.append(exc_obj['name'])
|
|
|
+ except KeyError:
|
|
|
+ pass
|
|
|
|
|
|
- self.out_cb.stateChanged.connect(lambda st: self.outline_object.setDisabled(not st))
|
|
|
+ try:
|
|
|
+ if exc_extra_obj:
|
|
|
+ name_list.append(exc_extra_obj['name'])
|
|
|
+ except KeyError:
|
|
|
+ pass
|
|
|
|
|
|
- self.e1_cb.stateChanged.connect(lambda st: self.e1_object.setDisabled(not st))
|
|
|
- self.e2_cb.stateChanged.connect(lambda st: self.e2_object.setDisabled(not st))
|
|
|
+ obj_violations['name'] = name_list
|
|
|
+ obj_violations['points'] = points_list
|
|
|
+ violations.append(deepcopy(obj_violations))
|
|
|
+ return rule_title, violations
|
|
|
|
|
|
- self.all_obj_cb.stateChanged.connect(self.on_all_objects_cb_changed)
|
|
|
- self.all_cb.stateChanged.connect(self.on_all_cb_changed)
|
|
|
- self.run_button.clicked.connect(self.execute)
|
|
|
- # self.app.collection.rowsInserted.connect(self.on_object_loaded)
|
|
|
+ def execute(self):
|
|
|
+ self.results = []
|
|
|
|
|
|
- self.tool_finished.connect(self.on_tool_finished)
|
|
|
- self.reset_button.clicked.connect(self.set_tool_ui)
|
|
|
+ log.debug("RuleCheck() executing")
|
|
|
|
|
|
- # list to hold the temporary objects
|
|
|
- self.objs = []
|
|
|
+ def worker_job(app_obj):
|
|
|
+ self.app.proc_container.new(_("Working..."))
|
|
|
|
|
|
- # final name for the panel object
|
|
|
- self.outname = ""
|
|
|
+ # RULE: Check Trace Size
|
|
|
+ if self.ui.trace_size_cb.get_value():
|
|
|
+ copper_list = []
|
|
|
+ copper_name_1 = self.ui.copper_t_object.currentText()
|
|
|
+ if copper_name_1 != '' and self.ui.copper_t_cb.get_value():
|
|
|
+ elem_dict = {}
|
|
|
+ elem_dict['name'] = deepcopy(copper_name_1)
|
|
|
+ elem_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_name_1).apertures)
|
|
|
+ copper_list.append(elem_dict)
|
|
|
|
|
|
- # flag to signal the constrain was activated
|
|
|
- self.constrain_flag = False
|
|
|
+ copper_name_2 = self.ui.copper_b_object.currentText()
|
|
|
+ if copper_name_2 != '' and self.ui.copper_b_cb.get_value():
|
|
|
+ elem_dict = {}
|
|
|
+ elem_dict['name'] = deepcopy(copper_name_2)
|
|
|
+ elem_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_name_2).apertures)
|
|
|
+ copper_list.append(elem_dict)
|
|
|
|
|
|
- # Multiprocessing Process Pool
|
|
|
- self.pool = self.app.pool
|
|
|
- self.results = None
|
|
|
+ trace_size = float(self.ui.trace_size_entry.get_value())
|
|
|
+ self.results.append(self.pool.apply_async(self.check_traces_size, args=(copper_list, trace_size)))
|
|
|
|
|
|
- self.decimals = 4
|
|
|
+ # RULE: Check Copper to Copper Clearance
|
|
|
+ if self.ui.clearance_copper2copper_cb.get_value():
|
|
|
|
|
|
- # def on_object_loaded(self, index, row):
|
|
|
- # print(index.internalPointer().child_items[row].obj.options['name'], index.data())
|
|
|
+ try:
|
|
|
+ copper_copper_clearance = float(self.ui.clearance_copper2copper_entry.get_value())
|
|
|
+ except Exception as e:
|
|
|
+ log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Copper to Copper clearance"),
|
|
|
+ _("Value is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- def on_all_cb_changed(self, state):
|
|
|
- cb_items = [self.form_layout_1.itemAt(i).widget() for i in range(self.form_layout_1.count())
|
|
|
- if isinstance(self.form_layout_1.itemAt(i).widget(), FCCheckBox)]
|
|
|
+ if self.copper_t_cb.get_value():
|
|
|
+ copper_t_obj = self.ui.copper_t_object.currentText()
|
|
|
+ copper_t_dict = {}
|
|
|
|
|
|
- for cb in cb_items:
|
|
|
- if state:
|
|
|
- cb.setChecked(True)
|
|
|
- else:
|
|
|
- cb.setChecked(False)
|
|
|
+ if copper_t_obj != '':
|
|
|
+ copper_t_dict['name'] = deepcopy(copper_t_obj)
|
|
|
+ copper_t_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_t_obj).apertures)
|
|
|
|
|
|
- def on_all_objects_cb_changed(self, state):
|
|
|
- cb_items = [self.grid_layout.itemAt(i).widget() for i in range(self.grid_layout.count())
|
|
|
- if isinstance(self.grid_layout.itemAt(i).widget(), FCCheckBox)]
|
|
|
+ self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
+ args=(copper_t_dict,
|
|
|
+ copper_copper_clearance,
|
|
|
+ _("TOP -> Copper to Copper clearance"))))
|
|
|
+ if self.ui.copper_b_cb.get_value():
|
|
|
+ copper_b_obj = self.ui.copper_b_object.currentText()
|
|
|
+ copper_b_dict = {}
|
|
|
+ if copper_b_obj != '':
|
|
|
+ copper_b_dict['name'] = deepcopy(copper_b_obj)
|
|
|
+ copper_b_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_b_obj).apertures)
|
|
|
|
|
|
- for cb in cb_items:
|
|
|
- if state:
|
|
|
- cb.setChecked(True)
|
|
|
- else:
|
|
|
- cb.setChecked(False)
|
|
|
+ self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
+ args=(copper_b_dict,
|
|
|
+ copper_copper_clearance,
|
|
|
+ _("BOTTOM -> Copper to Copper clearance"))))
|
|
|
|
|
|
- def run(self, toggle=True):
|
|
|
- self.app.defaults.report_usage("ToolRulesCheck()")
|
|
|
+ if self.ui.copper_t_cb.get_value() is False and self.ui.copper_b_cb.get_value() is False:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Copper to Copper clearance"),
|
|
|
+ _("At least one Gerber object has to be selected for this rule but none is selected.")))
|
|
|
+ return
|
|
|
|
|
|
- if toggle:
|
|
|
- # if the splitter is hidden, display it, else hide it but only if the current widget is the same
|
|
|
- if self.app.ui.splitter.sizes()[0] == 0:
|
|
|
- self.app.ui.splitter.setSizes([1, 1])
|
|
|
- else:
|
|
|
- try:
|
|
|
- if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
|
|
|
- # if tab is populated with the tool but it does not have the focus, focus on it
|
|
|
- if not self.app.ui.notebook.currentWidget() is self.app.ui.tool_tab:
|
|
|
- # focus on Tool Tab
|
|
|
- self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
|
|
|
- else:
|
|
|
- self.app.ui.splitter.setSizes([0, 1])
|
|
|
- except AttributeError:
|
|
|
- pass
|
|
|
- else:
|
|
|
- if self.app.ui.splitter.sizes()[0] == 0:
|
|
|
- self.app.ui.splitter.setSizes([1, 1])
|
|
|
+ # RULE: Check Copper to Outline Clearance
|
|
|
+ if self.ui.clearance_copper2ol_cb.get_value() and self.ui.out_cb.get_value():
|
|
|
+ top_dict = {}
|
|
|
+ bottom_dict = {}
|
|
|
+ outline_dict = {}
|
|
|
|
|
|
- AppTool.run(self)
|
|
|
- self.set_tool_ui()
|
|
|
+ copper_top = self.ui.copper_t_object.currentText()
|
|
|
+ if copper_top != '' and self.ui.copper_t_cb.get_value():
|
|
|
+ top_dict['name'] = deepcopy(copper_top)
|
|
|
+ top_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_top).apertures)
|
|
|
|
|
|
- self.app.ui.notebook.setTabText(2, _("Rules Tool"))
|
|
|
+ copper_bottom = self.ui.copper_b_object.currentText()
|
|
|
+ if copper_bottom != '' and self.ui.copper_b_cb.get_value():
|
|
|
+ bottom_dict['name'] = deepcopy(copper_bottom)
|
|
|
+ bottom_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_bottom).apertures)
|
|
|
|
|
|
- def install(self, icon=None, separator=None, **kwargs):
|
|
|
- AppTool.install(self, icon, separator, shortcut='Alt+R', **kwargs)
|
|
|
+ copper_outline = self.ui.outline_object.currentText()
|
|
|
+ if copper_outline != '' and self.ui.out_cb.get_value():
|
|
|
+ outline_dict['name'] = deepcopy(copper_outline)
|
|
|
+ outline_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_outline).apertures)
|
|
|
|
|
|
- def set_tool_ui(self):
|
|
|
+ try:
|
|
|
+ copper_outline_clearance = float(self.ui.clearance_copper2ol_entry.get_value())
|
|
|
+ except Exception as e:
|
|
|
+ log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Copper to Outline clearance"),
|
|
|
+ _("Value is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- # all object combobox default as disabled
|
|
|
- self.copper_t_object.setDisabled(True)
|
|
|
- self.copper_b_object.setDisabled(True)
|
|
|
-
|
|
|
- self.sm_t_object.setDisabled(True)
|
|
|
- self.sm_b_object.setDisabled(True)
|
|
|
-
|
|
|
- self.ss_t_object.setDisabled(True)
|
|
|
- self.ss_b_object.setDisabled(True)
|
|
|
-
|
|
|
- self.outline_object.setDisabled(True)
|
|
|
-
|
|
|
- self.e1_object.setDisabled(True)
|
|
|
- self.e2_object.setDisabled(True)
|
|
|
-
|
|
|
- self.trace_size_cb.set_value(self.app.defaults["tools_cr_trace_size"])
|
|
|
- self.trace_size_entry.set_value(float(self.app.defaults["tools_cr_trace_size_val"]))
|
|
|
- self.clearance_copper2copper_cb.set_value(self.app.defaults["tools_cr_c2c"])
|
|
|
- self.clearance_copper2copper_entry.set_value(float(self.app.defaults["tools_cr_c2c_val"]))
|
|
|
- self.clearance_copper2ol_cb.set_value(self.app.defaults["tools_cr_c2o"])
|
|
|
- self.clearance_copper2ol_entry.set_value(float(self.app.defaults["tools_cr_c2o_val"]))
|
|
|
- self.clearance_silk2silk_cb.set_value(self.app.defaults["tools_cr_s2s"])
|
|
|
- self.clearance_silk2silk_entry.set_value(float(self.app.defaults["tools_cr_s2s_val"]))
|
|
|
- self.clearance_silk2sm_cb.set_value(self.app.defaults["tools_cr_s2sm"])
|
|
|
- self.clearance_silk2sm_entry.set_value(float(self.app.defaults["tools_cr_s2sm_val"]))
|
|
|
- self.clearance_silk2ol_cb.set_value(self.app.defaults["tools_cr_s2o"])
|
|
|
- self.clearance_silk2ol_entry.set_value(float(self.app.defaults["tools_cr_s2o_val"]))
|
|
|
- self.clearance_sm2sm_cb.set_value(self.app.defaults["tools_cr_sm2sm"])
|
|
|
- self.clearance_sm2sm_entry.set_value(float(self.app.defaults["tools_cr_sm2sm_val"]))
|
|
|
- self.ring_integrity_cb.set_value(self.app.defaults["tools_cr_ri"])
|
|
|
- self.ring_integrity_entry.set_value(float(self.app.defaults["tools_cr_ri_val"]))
|
|
|
- self.clearance_d2d_cb.set_value(self.app.defaults["tools_cr_h2h"])
|
|
|
- self.clearance_d2d_entry.set_value(float(self.app.defaults["tools_cr_h2h_val"]))
|
|
|
- self.drill_size_cb.set_value(self.app.defaults["tools_cr_dh"])
|
|
|
- self.drill_size_entry.set_value(float(self.app.defaults["tools_cr_dh_val"]))
|
|
|
+ if not top_dict and not bottom_dict or not outline_dict:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Copper to Outline clearance"),
|
|
|
+ _("One of the copper Gerber objects or the Outline Gerber object is not valid.")))
|
|
|
+ return
|
|
|
+ objs = []
|
|
|
+ if top_dict:
|
|
|
+ objs.append(top_dict)
|
|
|
+ if bottom_dict:
|
|
|
+ objs.append(bottom_dict)
|
|
|
|
|
|
- self.reset_fields()
|
|
|
+ if outline_dict:
|
|
|
+ objs.append(outline_dict)
|
|
|
+ else:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Copper to Outline clearance"),
|
|
|
+ _("Outline Gerber object presence is mandatory for this rule but it is not selected.")))
|
|
|
+ return
|
|
|
|
|
|
- @staticmethod
|
|
|
- def check_inside_gerber_clearance(gerber_obj, size, rule):
|
|
|
- log.debug("RulesCheck.check_inside_gerber_clearance()")
|
|
|
+ self.results.append(self.pool.apply_async(self.check_gerber_clearance,
|
|
|
+ args=(objs,
|
|
|
+ copper_outline_clearance,
|
|
|
+ _("Copper to Outline clearance"))))
|
|
|
|
|
|
- rule_title = rule
|
|
|
+ # RULE: Check Silk to Silk Clearance
|
|
|
+ if self.ui.clearance_silk2silk_cb.get_value():
|
|
|
+ silk_dict = {}
|
|
|
|
|
|
- violations = []
|
|
|
- obj_violations = {}
|
|
|
- obj_violations.update({
|
|
|
- 'name': '',
|
|
|
- 'points': list()
|
|
|
- })
|
|
|
+ try:
|
|
|
+ silk_silk_clearance = float(self.ui.clearance_silk2silk_entry.get_value())
|
|
|
+ except Exception as e:
|
|
|
+ log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Silk to Silk clearance"),
|
|
|
+ _("Value is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- if not gerber_obj:
|
|
|
- return 'Fail. Not enough Gerber objects to check Gerber 2 Gerber clearance'
|
|
|
+ if self.ss_t_cb.get_value():
|
|
|
+ silk_obj = self.ui.ss_t_object.currentText()
|
|
|
+ if silk_obj != '':
|
|
|
+ silk_dict['name'] = deepcopy(silk_obj)
|
|
|
+ silk_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_obj).apertures)
|
|
|
|
|
|
- obj_violations['name'] = gerber_obj['name']
|
|
|
+ self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
+ args=(silk_dict,
|
|
|
+ silk_silk_clearance,
|
|
|
+ _("TOP -> Silk to Silk clearance"))))
|
|
|
+ if self.ui.ss_b_cb.get_value():
|
|
|
+ silk_obj = self.ui.ss_b_object.currentText()
|
|
|
+ if silk_obj != '':
|
|
|
+ silk_dict['name'] = deepcopy(silk_obj)
|
|
|
+ silk_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_obj).apertures)
|
|
|
|
|
|
- solid_geo = []
|
|
|
- clear_geo = []
|
|
|
- for apid in gerber_obj['apertures']:
|
|
|
- if 'geometry' in gerber_obj['apertures'][apid]:
|
|
|
- geometry = gerber_obj['apertures'][apid]['geometry']
|
|
|
- for geo_el in geometry:
|
|
|
- if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
- solid_geo.append(geo_el['solid'])
|
|
|
- if 'clear' in geo_el and geo_el['clear'] is not None:
|
|
|
- clear_geo.append(geo_el['clear'])
|
|
|
+ self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
+ args=(silk_dict,
|
|
|
+ silk_silk_clearance,
|
|
|
+ _("BOTTOM -> Silk to Silk clearance"))))
|
|
|
|
|
|
- if clear_geo:
|
|
|
- total_geo = []
|
|
|
- for geo_c in clear_geo:
|
|
|
- for geo_s in solid_geo:
|
|
|
- if geo_c.within(geo_s):
|
|
|
- total_geo.append(geo_s.difference(geo_c))
|
|
|
- else:
|
|
|
- total_geo = MultiPolygon(solid_geo)
|
|
|
- total_geo = total_geo.buffer(0.000001)
|
|
|
+ if self.ui.ss_t_cb.get_value() is False and self.ui.ss_b_cb.get_value() is False:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Silk to Silk clearance"),
|
|
|
+ _("At least one Gerber object has to be selected for this rule but none is selected.")))
|
|
|
+ return
|
|
|
|
|
|
- if isinstance(total_geo, Polygon):
|
|
|
- obj_violations['points'] = ['Failed. Only one polygon.']
|
|
|
- return rule_title, [obj_violations]
|
|
|
- else:
|
|
|
- iterations = len(total_geo)
|
|
|
- iterations = (iterations * (iterations - 1)) / 2
|
|
|
- log.debug("RulesCheck.check_gerber_clearance(). Iterations: %s" % str(iterations))
|
|
|
+ # RULE: Check Silk to Solder Mask Clearance
|
|
|
+ if self.ui.clearance_silk2sm_cb.get_value():
|
|
|
+ silk_t_dict = {}
|
|
|
+ sm_t_dict = {}
|
|
|
+ silk_b_dict = {}
|
|
|
+ sm_b_dict = {}
|
|
|
|
|
|
- min_dict = {}
|
|
|
- idx = 1
|
|
|
- for geo in total_geo:
|
|
|
- for s_geo in total_geo[idx:]:
|
|
|
- # minimize the number of distances by not taking into considerations those that are too small
|
|
|
- dist = geo.distance(s_geo)
|
|
|
- if float(dist) < float(size):
|
|
|
- loc_1, loc_2 = nearest_points(geo, s_geo)
|
|
|
+ top_ss = False
|
|
|
+ bottom_ss = False
|
|
|
+ top_sm = False
|
|
|
+ bottom_sm = False
|
|
|
|
|
|
- dx = loc_1.x - loc_2.x
|
|
|
- dy = loc_1.y - loc_2.y
|
|
|
- loc = min(loc_1.x, loc_2.x) + (abs(dx) / 2), min(loc_1.y, loc_2.y) + (abs(dy) / 2)
|
|
|
+ silk_top = self.ui.ss_t_object.currentText()
|
|
|
+ if silk_top != '' and self.ui.ss_t_cb.get_value():
|
|
|
+ silk_t_dict['name'] = deepcopy(silk_top)
|
|
|
+ silk_t_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_top).apertures)
|
|
|
+ top_ss = True
|
|
|
|
|
|
- if dist in min_dict:
|
|
|
- min_dict[dist].append(loc)
|
|
|
- else:
|
|
|
- min_dict[dist] = [loc]
|
|
|
- idx += 1
|
|
|
- points_list = set()
|
|
|
- for dist in min_dict.keys():
|
|
|
- for location in min_dict[dist]:
|
|
|
- points_list.add(location)
|
|
|
+ silk_bottom = self.ui.ss_b_object.currentText()
|
|
|
+ if silk_bottom != '' and self.ui.ss_b_cb.get_value():
|
|
|
+ silk_b_dict['name'] = deepcopy(silk_bottom)
|
|
|
+ silk_b_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_bottom).apertures)
|
|
|
+ bottom_ss = True
|
|
|
|
|
|
- obj_violations['points'] = list(points_list)
|
|
|
- violations.append(deepcopy(obj_violations))
|
|
|
+ sm_top = self.ui.sm_t_object.currentText()
|
|
|
+ if sm_top != '' and self.ui.sm_t_cb.get_value():
|
|
|
+ sm_t_dict['name'] = deepcopy(sm_top)
|
|
|
+ sm_t_dict['apertures'] = deepcopy(self.app.collection.get_by_name(sm_top).apertures)
|
|
|
+ top_sm = True
|
|
|
|
|
|
- return rule_title, violations
|
|
|
+ sm_bottom = self.ui.sm_b_object.currentText()
|
|
|
+ if sm_bottom != '' and self.ui.sm_b_cb.get_value():
|
|
|
+ sm_b_dict['name'] = deepcopy(sm_bottom)
|
|
|
+ sm_b_dict['apertures'] = deepcopy(self.app.collection.get_by_name(sm_bottom).apertures)
|
|
|
+ bottom_sm = True
|
|
|
|
|
|
- @staticmethod
|
|
|
- def check_gerber_clearance(gerber_list, size, rule):
|
|
|
- log.debug("RulesCheck.check_gerber_clearance()")
|
|
|
- rule_title = rule
|
|
|
+ try:
|
|
|
+ silk_sm_clearance = float(self.ui.clearance_silk2sm_entry.get_value())
|
|
|
+ except Exception as e:
|
|
|
+ log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Silk to Solder Mask Clearance"),
|
|
|
+ _("Value is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- violations = []
|
|
|
- obj_violations = {}
|
|
|
- obj_violations.update({
|
|
|
- 'name': '',
|
|
|
- 'points': list()
|
|
|
- })
|
|
|
+ if (not silk_t_dict and not silk_b_dict) or (not sm_t_dict and not sm_b_dict):
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Silk to Solder Mask Clearance"),
|
|
|
+ _("One or more of the Gerber objects is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- if len(gerber_list) == 2:
|
|
|
- gerber_1 = gerber_list[0]
|
|
|
- # added it so I won't have errors of using before declaring
|
|
|
- gerber_2 = {}
|
|
|
+ if top_ss is True and top_sm is True:
|
|
|
+ objs = [silk_t_dict, sm_t_dict]
|
|
|
+ self.results.append(self.pool.apply_async(self.check_gerber_clearance,
|
|
|
+ args=(objs,
|
|
|
+ silk_sm_clearance,
|
|
|
+ _("TOP -> Silk to Solder Mask Clearance"))))
|
|
|
+ elif bottom_ss is True and bottom_sm is True:
|
|
|
+ objs = [silk_b_dict, sm_b_dict]
|
|
|
+ self.results.append(self.pool.apply_async(self.check_gerber_clearance,
|
|
|
+ args=(objs,
|
|
|
+ silk_sm_clearance,
|
|
|
+ _("BOTTOM -> Silk to Solder Mask Clearance"))))
|
|
|
+ else:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Silk to Solder Mask Clearance"),
|
|
|
+ _("Both Silk and Solder Mask Gerber objects has to be either both Top or both Bottom.")))
|
|
|
+ return
|
|
|
|
|
|
- gerber_3 = gerber_list[1]
|
|
|
- elif len(gerber_list) == 3:
|
|
|
- gerber_1 = gerber_list[0]
|
|
|
- gerber_2 = gerber_list[1]
|
|
|
- gerber_3 = gerber_list[2]
|
|
|
- else:
|
|
|
- return 'Fail. Not enough Gerber objects to check Gerber 2 Gerber clearance'
|
|
|
+ # RULE: Check Silk to Outline Clearance
|
|
|
+ if self.ui.clearance_silk2ol_cb.get_value():
|
|
|
+ top_dict = {}
|
|
|
+ bottom_dict = {}
|
|
|
+ outline_dict = {}
|
|
|
|
|
|
- total_geo_grb_1 = []
|
|
|
- for apid in gerber_1['apertures']:
|
|
|
- if 'geometry' in gerber_1['apertures'][apid]:
|
|
|
- geometry = gerber_1['apertures'][apid]['geometry']
|
|
|
- for geo_el in geometry:
|
|
|
- if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
- total_geo_grb_1.append(geo_el['solid'])
|
|
|
+ silk_top = self.ui.ss_t_object.currentText()
|
|
|
+ if silk_top != '' and self.ui.ss_t_cb.get_value():
|
|
|
+ top_dict['name'] = deepcopy(silk_top)
|
|
|
+ top_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_top).apertures)
|
|
|
|
|
|
- if len(gerber_list) == 3:
|
|
|
- # add the second Gerber geometry to the first one if it exists
|
|
|
- for apid in gerber_2['apertures']:
|
|
|
- if 'geometry' in gerber_2['apertures'][apid]:
|
|
|
- geometry = gerber_2['apertures'][apid]['geometry']
|
|
|
- for geo_el in geometry:
|
|
|
- if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
- total_geo_grb_1.append(geo_el['solid'])
|
|
|
+ silk_bottom = self.ui.ss_b_object.currentText()
|
|
|
+ if silk_bottom != '' and self.ui.ss_b_cb.get_value():
|
|
|
+ bottom_dict['name'] = deepcopy(silk_bottom)
|
|
|
+ bottom_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_bottom).apertures)
|
|
|
|
|
|
- total_geo_grb_3 = []
|
|
|
- for apid in gerber_3['apertures']:
|
|
|
- if 'geometry' in gerber_3['apertures'][apid]:
|
|
|
- geometry = gerber_3['apertures'][apid]['geometry']
|
|
|
- for geo_el in geometry:
|
|
|
- if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
- total_geo_grb_3.append(geo_el['solid'])
|
|
|
+ copper_outline = self.ui.outline_object.currentText()
|
|
|
+ if copper_outline != '' and self.ui.out_cb.get_value():
|
|
|
+ outline_dict['name'] = deepcopy(copper_outline)
|
|
|
+ outline_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_outline).apertures)
|
|
|
|
|
|
- total_geo_grb_1 = MultiPolygon(total_geo_grb_1)
|
|
|
- total_geo_grb_1 = total_geo_grb_1.buffer(0)
|
|
|
+ try:
|
|
|
+ copper_outline_clearance = float(self.ui.clearance_copper2ol_entry.get_value())
|
|
|
+ except Exception as e:
|
|
|
+ log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Silk to Outline Clearance"),
|
|
|
+ _("Value is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- total_geo_grb_3 = MultiPolygon(total_geo_grb_3)
|
|
|
- total_geo_grb_3 = total_geo_grb_3.buffer(0)
|
|
|
+ if not top_dict and not bottom_dict or not outline_dict:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Silk to Outline Clearance"),
|
|
|
+ _("One of the Silk Gerber objects or the Outline Gerber object is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- if isinstance(total_geo_grb_1, Polygon):
|
|
|
- len_1 = 1
|
|
|
- total_geo_grb_1 = [total_geo_grb_1]
|
|
|
- else:
|
|
|
- len_1 = len(total_geo_grb_1)
|
|
|
+ objs = []
|
|
|
+ if top_dict:
|
|
|
+ objs.append(top_dict)
|
|
|
+ if bottom_dict:
|
|
|
+ objs.append(bottom_dict)
|
|
|
|
|
|
- if isinstance(total_geo_grb_3, Polygon):
|
|
|
- len_3 = 1
|
|
|
- total_geo_grb_3 = [total_geo_grb_3]
|
|
|
- else:
|
|
|
- len_3 = len(total_geo_grb_3)
|
|
|
+ if outline_dict:
|
|
|
+ objs.append(outline_dict)
|
|
|
+ else:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Silk to Outline Clearance"),
|
|
|
+ _("Outline Gerber object presence is mandatory for this rule but it is not selected.")))
|
|
|
+ return
|
|
|
|
|
|
- iterations = len_1 * len_3
|
|
|
- log.debug("RulesCheck.check_gerber_clearance(). Iterations: %s" % str(iterations))
|
|
|
+ self.results.append(self.pool.apply_async(self.check_gerber_clearance,
|
|
|
+ args=(objs,
|
|
|
+ copper_outline_clearance,
|
|
|
+ _("Silk to Outline Clearance"))))
|
|
|
|
|
|
- min_dict = {}
|
|
|
- for geo in total_geo_grb_1:
|
|
|
- for s_geo in total_geo_grb_3:
|
|
|
- # minimize the number of distances by not taking into considerations those that are too small
|
|
|
- dist = geo.distance(s_geo)
|
|
|
- if float(dist) < float(size):
|
|
|
- loc_1, loc_2 = nearest_points(geo, s_geo)
|
|
|
+ # RULE: Check Minimum Solder Mask Sliver
|
|
|
+ if self.ui.clearance_silk2silk_cb.get_value():
|
|
|
+ sm_dict = {}
|
|
|
|
|
|
- dx = loc_1.x - loc_2.x
|
|
|
- dy = loc_1.y - loc_2.y
|
|
|
- loc = min(loc_1.x, loc_2.x) + (abs(dx) / 2), min(loc_1.y, loc_2.y) + (abs(dy) / 2)
|
|
|
+ try:
|
|
|
+ sm_sm_clearance = float(self.ui.clearance_sm2sm_entry.get_value())
|
|
|
+ except Exception as e:
|
|
|
+ log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Minimum Solder Mask Sliver"),
|
|
|
+ _("Value is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- if dist in min_dict:
|
|
|
- min_dict[dist].append(loc)
|
|
|
- else:
|
|
|
- min_dict[dist] = [loc]
|
|
|
+ if self.ui.sm_t_cb.get_value():
|
|
|
+ solder_obj = self.ui.sm_t_object.currentText()
|
|
|
+ if solder_obj != '':
|
|
|
+ sm_dict['name'] = deepcopy(solder_obj)
|
|
|
+ sm_dict['apertures'] = deepcopy(self.app.collection.get_by_name(solder_obj).apertures)
|
|
|
|
|
|
- points_list = set()
|
|
|
- for dist in min_dict.keys():
|
|
|
- for location in min_dict[dist]:
|
|
|
- points_list.add(location)
|
|
|
+ self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
+ args=(sm_dict,
|
|
|
+ sm_sm_clearance,
|
|
|
+ _("TOP -> Minimum Solder Mask Sliver"))))
|
|
|
+ if self.ui.sm_b_cb.get_value():
|
|
|
+ solder_obj = self.ui.sm_b_object.currentText()
|
|
|
+ if solder_obj != '':
|
|
|
+ sm_dict['name'] = deepcopy(solder_obj)
|
|
|
+ sm_dict['apertures'] = deepcopy(self.app.collection.get_by_name(solder_obj).apertures)
|
|
|
|
|
|
- name_list = []
|
|
|
- if gerber_1:
|
|
|
- name_list.append(gerber_1['name'])
|
|
|
- if gerber_2:
|
|
|
- name_list.append(gerber_2['name'])
|
|
|
- if gerber_3:
|
|
|
- name_list.append(gerber_3['name'])
|
|
|
+ self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
+ args=(sm_dict,
|
|
|
+ sm_sm_clearance,
|
|
|
+ _("BOTTOM -> Minimum Solder Mask Sliver"))))
|
|
|
|
|
|
- obj_violations['name'] = name_list
|
|
|
- obj_violations['points'] = list(points_list)
|
|
|
- violations.append(deepcopy(obj_violations))
|
|
|
+ if self.ui.sm_t_cb.get_value() is False and self.ui.sm_b_cb.get_value() is False:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Minimum Solder Mask Sliver"),
|
|
|
+ _("At least one Gerber object has to be selected for this rule but none is selected.")))
|
|
|
+ return
|
|
|
|
|
|
- return rule_title, violations
|
|
|
+ # RULE: Check Minimum Annular Ring
|
|
|
+ if self.ui.ring_integrity_cb.get_value():
|
|
|
+ top_dict = {}
|
|
|
+ bottom_dict = {}
|
|
|
+ exc_1_dict = {}
|
|
|
+ exc_2_dict = {}
|
|
|
|
|
|
- @staticmethod
|
|
|
- def check_holes_size(elements, size):
|
|
|
- log.debug("RulesCheck.check_holes_size()")
|
|
|
+ copper_top = self.ui.copper_t_object.currentText()
|
|
|
+ if copper_top != '' and self.ui.copper_t_cb.get_value():
|
|
|
+ top_dict['name'] = deepcopy(copper_top)
|
|
|
+ top_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_top).apertures)
|
|
|
|
|
|
- rule = _("Hole Size")
|
|
|
+ copper_bottom = self.ui.copper_b_object.currentText()
|
|
|
+ if copper_bottom != '' and self.ui.copper_b_cb.get_value():
|
|
|
+ bottom_dict['name'] = deepcopy(copper_bottom)
|
|
|
+ bottom_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_bottom).apertures)
|
|
|
|
|
|
- violations = []
|
|
|
- obj_violations = {}
|
|
|
- obj_violations.update({
|
|
|
- 'name': '',
|
|
|
- 'dia': list()
|
|
|
- })
|
|
|
+ excellon_1 = self.ui.e1_object.currentText()
|
|
|
+ if excellon_1 != '' and self.ui.e1_cb.get_value():
|
|
|
+ exc_1_dict['name'] = deepcopy(excellon_1)
|
|
|
+ exc_1_dict['tools'] = deepcopy(
|
|
|
+ self.app.collection.get_by_name(excellon_1).tools)
|
|
|
|
|
|
- for elem in elements:
|
|
|
- dia_list = []
|
|
|
+ excellon_2 = self.ui.e2_object.currentText()
|
|
|
+ if excellon_2 != '' and self.ui.e2_cb.get_value():
|
|
|
+ exc_2_dict['name'] = deepcopy(excellon_2)
|
|
|
+ exc_2_dict['tools'] = deepcopy(
|
|
|
+ self.app.collection.get_by_name(excellon_2).tools)
|
|
|
|
|
|
- name = elem['name']
|
|
|
- for tool in elem['tools']:
|
|
|
- tool_dia = float('%.*f' % (4, float(elem['tools'][tool]['C'])))
|
|
|
- if tool_dia < float(size):
|
|
|
- dia_list.append(tool_dia)
|
|
|
- obj_violations['name'] = name
|
|
|
- obj_violations['dia'] = dia_list
|
|
|
- violations.append(deepcopy(obj_violations))
|
|
|
+ try:
|
|
|
+ ring_val = float(self.ui.ring_integrity_entry.get_value())
|
|
|
+ except Exception as e:
|
|
|
+ log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Minimum Annular Ring"),
|
|
|
+ _("Value is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- return rule, violations
|
|
|
+ if (not top_dict and not bottom_dict) or (not exc_1_dict and not exc_2_dict):
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Minimum Annular Ring"),
|
|
|
+ _("One of the Copper Gerber objects or the Excellon objects is not valid.")))
|
|
|
+ return
|
|
|
|
|
|
- @staticmethod
|
|
|
- def check_holes_clearance(elements, size):
|
|
|
- log.debug("RulesCheck.check_holes_clearance()")
|
|
|
- rule = _("Hole to Hole Clearance")
|
|
|
+ objs = []
|
|
|
+ if top_dict:
|
|
|
+ objs.append(top_dict)
|
|
|
+ elif bottom_dict:
|
|
|
+ objs.append(bottom_dict)
|
|
|
|
|
|
- violations = []
|
|
|
- obj_violations = {}
|
|
|
- obj_violations.update({
|
|
|
- 'name': '',
|
|
|
- 'points': list()
|
|
|
- })
|
|
|
+ if exc_1_dict:
|
|
|
+ objs.append(exc_1_dict)
|
|
|
+ elif exc_2_dict:
|
|
|
+ objs.append(exc_2_dict)
|
|
|
+ else:
|
|
|
+ self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
+ _("Minimum Annular Ring"),
|
|
|
+ _("Excellon object presence is mandatory for this rule but none is selected.")))
|
|
|
+ return
|
|
|
|
|
|
- total_geo = []
|
|
|
- for elem in elements:
|
|
|
- for tool in elem['tools']:
|
|
|
- if 'solid_geometry' in elem['tools'][tool]:
|
|
|
- geometry = elem['tools'][tool]['solid_geometry']
|
|
|
- for geo in geometry:
|
|
|
- total_geo.append(geo)
|
|
|
+ self.results.append(self.pool.apply_async(self.check_gerber_annular_ring,
|
|
|
+ args=(objs,
|
|
|
+ ring_val,
|
|
|
+ _("Minimum Annular Ring"))))
|
|
|
|
|
|
- min_dict = {}
|
|
|
- idx = 1
|
|
|
- for geo in total_geo:
|
|
|
- for s_geo in total_geo[idx:]:
|
|
|
+ # RULE: Check Hole to Hole Clearance
|
|
|
+ if self.ui.clearance_d2d_cb.get_value():
|
|
|
+ exc_list = []
|
|
|
+ exc_name_1 = self.ui.e1_object.currentText()
|
|
|
+ if exc_name_1 != '' and self.ui.e1_cb.get_value():
|
|
|
+ elem_dict = {}
|
|
|
+ elem_dict['name'] = deepcopy(exc_name_1)
|
|
|
+ elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_1).tools)
|
|
|
+ exc_list.append(elem_dict)
|
|
|
|
|
|
- # minimize the number of distances by not taking into considerations those that are too small
|
|
|
- dist = geo.distance(s_geo)
|
|
|
- loc_1, loc_2 = nearest_points(geo, s_geo)
|
|
|
+ exc_name_2 = self.ui.e2_object.currentText()
|
|
|
+ if exc_name_2 != '' and self.ui.e2_cb.get_value():
|
|
|
+ elem_dict = {}
|
|
|
+ elem_dict['name'] = deepcopy(exc_name_2)
|
|
|
+ elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_2).tools)
|
|
|
+ exc_list.append(elem_dict)
|
|
|
|
|
|
- dx = loc_1.x - loc_2.x
|
|
|
- dy = loc_1.y - loc_2.y
|
|
|
- loc = min(loc_1.x, loc_2.x) + (abs(dx) / 2), min(loc_1.y, loc_2.y) + (abs(dy) / 2)
|
|
|
+ hole_clearance = float(self.ui.clearance_d2d_entry.get_value())
|
|
|
+ self.results.append(self.pool.apply_async(self.check_holes_clearance, args=(exc_list, hole_clearance)))
|
|
|
|
|
|
- if dist in min_dict:
|
|
|
- min_dict[dist].append(loc)
|
|
|
- else:
|
|
|
- min_dict[dist] = [loc]
|
|
|
- idx += 1
|
|
|
+ # RULE: Check Holes Size
|
|
|
+ if self.ui.drill_size_cb.get_value():
|
|
|
+ exc_list = []
|
|
|
+ exc_name_1 = self.ui.e1_object.currentText()
|
|
|
+ if exc_name_1 != '' and self.ui.e1_cb.get_value():
|
|
|
+ elem_dict = {}
|
|
|
+ elem_dict['name'] = deepcopy(exc_name_1)
|
|
|
+ elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_1).tools)
|
|
|
+ exc_list.append(elem_dict)
|
|
|
|
|
|
- points_list = set()
|
|
|
- for dist in min_dict.keys():
|
|
|
- if float(dist) < size:
|
|
|
- for location in min_dict[dist]:
|
|
|
- points_list.add(location)
|
|
|
+ exc_name_2 = self.ui.e2_object.currentText()
|
|
|
+ if exc_name_2 != '' and self.ui.e2_cb.get_value():
|
|
|
+ elem_dict = {}
|
|
|
+ elem_dict['name'] = deepcopy(exc_name_2)
|
|
|
+ elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_2).tools)
|
|
|
+ exc_list.append(elem_dict)
|
|
|
|
|
|
- name_list = []
|
|
|
- for elem in elements:
|
|
|
- name_list.append(elem['name'])
|
|
|
+ drill_size = float(self.ui.drill_size_entry.get_value())
|
|
|
+ self.results.append(self.pool.apply_async(self.check_holes_size, args=(exc_list, drill_size)))
|
|
|
|
|
|
- obj_violations['name'] = name_list
|
|
|
- obj_violations['points'] = list(points_list)
|
|
|
- violations.append(deepcopy(obj_violations))
|
|
|
+ output = []
|
|
|
+ for p in self.results:
|
|
|
+ output.append(p.get())
|
|
|
|
|
|
- return rule, violations
|
|
|
+ self.tool_finished.emit(output)
|
|
|
|
|
|
- @staticmethod
|
|
|
- def check_traces_size(elements, size):
|
|
|
- log.debug("RulesCheck.check_traces_size()")
|
|
|
+ log.debug("RuleCheck() finished")
|
|
|
|
|
|
- rule = _("Trace Size")
|
|
|
+ self.app.worker_task.emit({'fcn': worker_job, 'params': [self.app]})
|
|
|
|
|
|
- violations = []
|
|
|
- obj_violations = {}
|
|
|
- obj_violations.update({
|
|
|
- 'name': '',
|
|
|
- 'size': list(),
|
|
|
- 'points': list()
|
|
|
- })
|
|
|
+ def on_tool_finished(self, res):
|
|
|
+ def init(new_obj, app_obj):
|
|
|
+ txt = ''
|
|
|
+ for el in res:
|
|
|
+ txt += '<b>RULE NAME:</b> %s<BR>' % str(el[0]).upper()
|
|
|
+ if isinstance(el[1][0]['name'], list):
|
|
|
+ for name in el[1][0]['name']:
|
|
|
+ txt += 'File name: %s<BR>' % str(name)
|
|
|
+ else:
|
|
|
+ txt += 'File name: %s<BR>' % str(el[1][0]['name'])
|
|
|
|
|
|
- for elem in elements:
|
|
|
- dia_list = []
|
|
|
- points_list = []
|
|
|
- name = elem['name']
|
|
|
+ point_txt = ''
|
|
|
+ try:
|
|
|
+ if el[1][0]['points']:
|
|
|
+ txt += '{title}: <span style="color:{color};background-color:{h_color}"' \
|
|
|
+ '> {status} </span>.<BR>'.format(title=_("STATUS"),
|
|
|
+ h_color='red',
|
|
|
+ color='white',
|
|
|
+ status=_("FAILED"))
|
|
|
+ if 'Failed' in el[1][0]['points'][0]:
|
|
|
+ point_txt = el[1][0]['points'][0]
|
|
|
+ else:
|
|
|
+ for pt in el[1][0]['points']:
|
|
|
+ point_txt += '(%.*f, %.*f)' % (self.decimals, float(pt[0]), self.decimals, float(pt[1]))
|
|
|
+ point_txt += ', '
|
|
|
+ txt += 'Violations: %s<BR>' % str(point_txt)
|
|
|
+ else:
|
|
|
+ txt += '{title}: <span style="color:{color};background-color:{h_color}"' \
|
|
|
+ '> {status} </span>.<BR>'.format(title=_("STATUS"),
|
|
|
+ h_color='green',
|
|
|
+ color='white',
|
|
|
+ status=_("PASSED"))
|
|
|
+ txt += '%s<BR>' % _("Violations: There are no violations for the current rule.")
|
|
|
+ except KeyError:
|
|
|
+ pass
|
|
|
|
|
|
- for apid in elem['apertures']:
|
|
|
try:
|
|
|
- tool_dia = float(elem['apertures'][apid]['size'])
|
|
|
- if tool_dia < float(size) and tool_dia != 0.0:
|
|
|
- dia_list.append(tool_dia)
|
|
|
- for geo_el in elem['apertures'][apid]['geometry']:
|
|
|
- if 'solid' in geo_el.keys():
|
|
|
- geo = geo_el['solid']
|
|
|
- pt = geo.representative_point()
|
|
|
- points_list.append((pt.x, pt.y))
|
|
|
- except Exception:
|
|
|
- # An exception will be raised for the 'size' key in case of apertures of type AM (macro) which does
|
|
|
- # not have the size key
|
|
|
+ if el[1][0]['dia']:
|
|
|
+ txt += '{title}: <span style="color:{color};background-color:{h_color}"' \
|
|
|
+ '> {status} </span>.<BR>'.format(title=_("STATUS"),
|
|
|
+ h_color='red',
|
|
|
+ color='white',
|
|
|
+ status=_("FAILED"))
|
|
|
+ if 'Failed' in el[1][0]['dia']:
|
|
|
+ point_txt = el[1][0]['dia']
|
|
|
+ else:
|
|
|
+ for pt in el[1][0]['dia']:
|
|
|
+ point_txt += '%.*f' % (self.decimals, float(pt))
|
|
|
+ point_txt += ', '
|
|
|
+ txt += 'Violations: %s<BR>' % str(point_txt)
|
|
|
+ else:
|
|
|
+ txt += '{title}: <span style="color:{color};background-color:{h_color}"' \
|
|
|
+ '> {status} </span>.<BR>'.format(title=_("STATUS"),
|
|
|
+ h_color='green',
|
|
|
+ color='white',
|
|
|
+ status=_("PASSED"))
|
|
|
+ txt += '%s<BR>' % _("Violations: There are no violations for the current rule.")
|
|
|
+ except KeyError:
|
|
|
pass
|
|
|
|
|
|
- obj_violations['name'] = name
|
|
|
- obj_violations['size'] = dia_list
|
|
|
- obj_violations['points'] = points_list
|
|
|
- violations.append(deepcopy(obj_violations))
|
|
|
- return rule, violations
|
|
|
+ txt += '<BR><BR>'
|
|
|
+ new_obj.source_file = txt
|
|
|
+ new_obj.read_only = True
|
|
|
|
|
|
- @staticmethod
|
|
|
- def check_gerber_annular_ring(obj_list, size, rule):
|
|
|
- rule_title = rule
|
|
|
+ self.app.app_obj.new_object('document', name='Rules_check_results', initialize=init, plot=False)
|
|
|
|
|
|
- violations = []
|
|
|
- obj_violations = {}
|
|
|
- obj_violations.update({
|
|
|
- 'name': '',
|
|
|
- 'points': list()
|
|
|
- })
|
|
|
+ def reset_fields(self):
|
|
|
+ # self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ # self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ pass
|
|
|
|
|
|
- # added it so I won't have errors of using before declaring
|
|
|
- gerber_obj = {}
|
|
|
- gerber_extra_obj = {}
|
|
|
- exc_obj = {}
|
|
|
- exc_extra_obj = {}
|
|
|
|
|
|
- if len(obj_list) == 2:
|
|
|
- gerber_obj = obj_list[0]
|
|
|
- exc_obj = obj_list[1]
|
|
|
- if 'apertures' in gerber_obj and 'tools' in exc_obj:
|
|
|
- pass
|
|
|
- else:
|
|
|
- return 'Fail. At least one Gerber and one Excellon object is required to check Minimum Annular Ring'
|
|
|
- elif len(obj_list) == 3:
|
|
|
- o1 = obj_list[0]
|
|
|
- o2 = obj_list[1]
|
|
|
- o3 = obj_list[2]
|
|
|
- if 'apertures' in o1 and 'apertures' in o2:
|
|
|
- gerber_obj = o1
|
|
|
- gerber_extra_obj = o2
|
|
|
- exc_obj = o3
|
|
|
- elif 'tools' in o2 and 'tools' in o3:
|
|
|
- gerber_obj = o1
|
|
|
- exc_obj = o2
|
|
|
- exc_extra_obj = o3
|
|
|
- elif len(obj_list) == 4:
|
|
|
- gerber_obj = obj_list[0]
|
|
|
- gerber_extra_obj = obj_list[1]
|
|
|
- exc_obj = obj_list[2]
|
|
|
- exc_extra_obj = obj_list[3]
|
|
|
- else:
|
|
|
- return 'Fail. Not enough objects to check Minimum Annular Ring'
|
|
|
+class RulesUI:
|
|
|
+
|
|
|
+ toolName = _("Check Rules")
|
|
|
|
|
|
- total_geo_grb = []
|
|
|
- for apid in gerber_obj['apertures']:
|
|
|
- if 'geometry' in gerber_obj['apertures'][apid]:
|
|
|
- geometry = gerber_obj['apertures'][apid]['geometry']
|
|
|
- for geo_el in geometry:
|
|
|
- if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
- total_geo_grb.append(geo_el['solid'])
|
|
|
+ def __init__(self, layout, app):
|
|
|
+ self.app = app
|
|
|
+ self.decimals = self.app.decimals
|
|
|
+ self.layout = layout
|
|
|
|
|
|
- if len(obj_list) == 3 and gerber_extra_obj:
|
|
|
- # add the second Gerber geometry to the first one if it exists
|
|
|
- for apid in gerber_extra_obj['apertures']:
|
|
|
- if 'geometry' in gerber_extra_obj['apertures'][apid]:
|
|
|
- geometry = gerber_extra_obj['apertures'][apid]['geometry']
|
|
|
- for geo_el in geometry:
|
|
|
- if 'solid' in geo_el and geo_el['solid'] is not None:
|
|
|
- total_geo_grb.append(geo_el['solid'])
|
|
|
+ # ## Title
|
|
|
+ title_label = FCLabel("%s" % self.toolName)
|
|
|
+ title_label.setStyleSheet("""
|
|
|
+ QLabel
|
|
|
+ {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ """)
|
|
|
+ self.layout.addWidget(title_label)
|
|
|
|
|
|
- total_geo_grb = MultiPolygon(total_geo_grb)
|
|
|
- total_geo_grb = total_geo_grb.buffer(0)
|
|
|
+ # Form Layout
|
|
|
+ self.grid_layout = QtWidgets.QGridLayout()
|
|
|
+ self.layout.addLayout(self.grid_layout)
|
|
|
|
|
|
- total_geo_exc = []
|
|
|
- for tool in exc_obj['tools']:
|
|
|
- if 'solid_geometry' in exc_obj['tools'][tool]:
|
|
|
- geometry = exc_obj['tools'][tool]['solid_geometry']
|
|
|
- for geo in geometry:
|
|
|
- total_geo_exc.append(geo)
|
|
|
+ self.grid_layout.setColumnStretch(0, 0)
|
|
|
+ self.grid_layout.setColumnStretch(1, 3)
|
|
|
+ self.grid_layout.setColumnStretch(2, 0)
|
|
|
|
|
|
- if len(obj_list) == 3 and exc_extra_obj:
|
|
|
- # add the second Excellon geometry to the first one if it exists
|
|
|
- for tool in exc_extra_obj['tools']:
|
|
|
- if 'solid_geometry' in exc_extra_obj['tools'][tool]:
|
|
|
- geometry = exc_extra_obj['tools'][tool]['solid_geometry']
|
|
|
- for geo in geometry:
|
|
|
- total_geo_exc.append(geo)
|
|
|
+ self.gerber_title_lbl = FCLabel('<b>%s</b>:' % _("GERBER"))
|
|
|
+ self.gerber_title_lbl.setToolTip(
|
|
|
+ _("Gerber objects for which to check rules.")
|
|
|
+ )
|
|
|
|
|
|
- if isinstance(total_geo_grb, Polygon):
|
|
|
- len_1 = 1
|
|
|
- total_geo_grb = [total_geo_grb]
|
|
|
- else:
|
|
|
- len_1 = len(total_geo_grb)
|
|
|
+ self.all_obj_cb = FCCheckBox()
|
|
|
+
|
|
|
+ self.grid_layout.addWidget(self.gerber_title_lbl, 0, 0, 1, 2)
|
|
|
+ self.grid_layout.addWidget(self.all_obj_cb, 0, 2)
|
|
|
+
|
|
|
+ # Copper Top object
|
|
|
+ self.copper_t_object = FCComboBox()
|
|
|
+ self.copper_t_object.setModel(self.app.collection)
|
|
|
+ self.copper_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ self.copper_t_object.is_last = True
|
|
|
+ self.copper_t_object.obj_type = "Gerber"
|
|
|
+
|
|
|
+ self.copper_t_object_lbl = FCLabel('%s:' % _("Top"))
|
|
|
+ self.copper_t_object_lbl.setToolTip(
|
|
|
+ _("The Top Gerber Copper object for which rules are checked.")
|
|
|
+ )
|
|
|
+
|
|
|
+ self.copper_t_cb = FCCheckBox()
|
|
|
+
|
|
|
+ self.grid_layout.addWidget(self.copper_t_object_lbl, 1, 0)
|
|
|
+ self.grid_layout.addWidget(self.copper_t_object, 1, 1)
|
|
|
+ self.grid_layout.addWidget(self.copper_t_cb, 1, 2)
|
|
|
|
|
|
- if isinstance(total_geo_exc, Polygon):
|
|
|
- len_2 = 1
|
|
|
- total_geo_exc = [total_geo_exc]
|
|
|
- else:
|
|
|
- len_2 = len(total_geo_exc)
|
|
|
+ # Copper Bottom object
|
|
|
+ self.copper_b_object = FCComboBox()
|
|
|
+ self.copper_b_object.setModel(self.app.collection)
|
|
|
+ self.copper_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ self.copper_b_object.is_last = True
|
|
|
+ self.copper_b_object.obj_type = "Gerber"
|
|
|
|
|
|
- iterations = len_1 * len_2
|
|
|
- log.debug("RulesCheck.check_gerber_annular_ring(). Iterations: %s" % str(iterations))
|
|
|
+ self.copper_b_object_lbl = FCLabel('%s:' % _("Bottom"))
|
|
|
+ self.copper_b_object_lbl.setToolTip(
|
|
|
+ _("The Bottom Gerber Copper object for which rules are checked.")
|
|
|
+ )
|
|
|
|
|
|
- min_dict = {}
|
|
|
- dist = None
|
|
|
- for geo in total_geo_grb:
|
|
|
- for s_geo in total_geo_exc:
|
|
|
- try:
|
|
|
- # minimize the number of distances by not taking into considerations those that are too small
|
|
|
- dist = abs(geo.exterior.distance(s_geo))
|
|
|
- except Exception as e:
|
|
|
- log.debug("RulesCheck.check_gerber_annular_ring() --> %s" % str(e))
|
|
|
+ self.copper_b_cb = FCCheckBox()
|
|
|
|
|
|
- if dist > 0:
|
|
|
- if float(dist) < float(size):
|
|
|
- loc_1, loc_2 = nearest_points(geo.exterior, s_geo)
|
|
|
+ self.grid_layout.addWidget(self.copper_b_object_lbl, 2, 0)
|
|
|
+ self.grid_layout.addWidget(self.copper_b_object, 2, 1)
|
|
|
+ self.grid_layout.addWidget(self.copper_b_cb, 2, 2)
|
|
|
|
|
|
- dx = loc_1.x - loc_2.x
|
|
|
- dy = loc_1.y - loc_2.y
|
|
|
- loc = min(loc_1.x, loc_2.x) + (abs(dx) / 2), min(loc_1.y, loc_2.y) + (abs(dy) / 2)
|
|
|
+ # SolderMask Top object
|
|
|
+ self.sm_t_object = FCComboBox()
|
|
|
+ self.sm_t_object.setModel(self.app.collection)
|
|
|
+ self.sm_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ self.sm_t_object.is_last = True
|
|
|
+ self.sm_t_object.obj_type = "Gerber"
|
|
|
|
|
|
- if dist in min_dict:
|
|
|
- min_dict[dist].append(loc)
|
|
|
- else:
|
|
|
- min_dict[dist] = [loc]
|
|
|
- else:
|
|
|
- if dist in min_dict:
|
|
|
- min_dict[dist].append(s_geo.representative_point())
|
|
|
- else:
|
|
|
- min_dict[dist] = [s_geo.representative_point()]
|
|
|
+ self.sm_t_object_lbl = FCLabel('%s:' % _("SM Top"))
|
|
|
+ self.sm_t_object_lbl.setToolTip(
|
|
|
+ _("The Top Gerber Solder Mask object for which rules are checked.")
|
|
|
+ )
|
|
|
|
|
|
- points_list = []
|
|
|
- for dist in min_dict.keys():
|
|
|
- for location in min_dict[dist]:
|
|
|
- points_list.append(location)
|
|
|
+ self.sm_t_cb = FCCheckBox()
|
|
|
|
|
|
- name_list = []
|
|
|
- try:
|
|
|
- if gerber_obj:
|
|
|
- name_list.append(gerber_obj['name'])
|
|
|
- except KeyError:
|
|
|
- pass
|
|
|
- try:
|
|
|
- if gerber_extra_obj:
|
|
|
- name_list.append(gerber_extra_obj['name'])
|
|
|
- except KeyError:
|
|
|
- pass
|
|
|
+ self.grid_layout.addWidget(self.sm_t_object_lbl, 3, 0)
|
|
|
+ self.grid_layout.addWidget(self.sm_t_object, 3, 1)
|
|
|
+ self.grid_layout.addWidget(self.sm_t_cb, 3, 2)
|
|
|
|
|
|
- try:
|
|
|
- if exc_obj:
|
|
|
- name_list.append(exc_obj['name'])
|
|
|
- except KeyError:
|
|
|
- pass
|
|
|
+ # SolderMask Bottom object
|
|
|
+ self.sm_b_object = FCComboBox()
|
|
|
+ self.sm_b_object.setModel(self.app.collection)
|
|
|
+ self.sm_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ self.sm_b_object.is_last = True
|
|
|
+ self.sm_b_object.obj_type = "Gerber"
|
|
|
|
|
|
- try:
|
|
|
- if exc_extra_obj:
|
|
|
- name_list.append(exc_extra_obj['name'])
|
|
|
- except KeyError:
|
|
|
- pass
|
|
|
+ self.sm_b_object_lbl = FCLabel('%s:' % _("SM Bottom"))
|
|
|
+ self.sm_b_object_lbl.setToolTip(
|
|
|
+ _("The Bottom Gerber Solder Mask object for which rules are checked.")
|
|
|
+ )
|
|
|
|
|
|
- obj_violations['name'] = name_list
|
|
|
- obj_violations['points'] = points_list
|
|
|
- violations.append(deepcopy(obj_violations))
|
|
|
- return rule_title, violations
|
|
|
+ self.sm_b_cb = FCCheckBox()
|
|
|
|
|
|
- def execute(self):
|
|
|
- self.results = []
|
|
|
+ self.grid_layout.addWidget(self.sm_b_object_lbl, 4, 0)
|
|
|
+ self.grid_layout.addWidget(self.sm_b_object, 4, 1)
|
|
|
+ self.grid_layout.addWidget(self.sm_b_cb, 4, 2)
|
|
|
|
|
|
- log.debug("RuleCheck() executing")
|
|
|
+ # SilkScreen Top object
|
|
|
+ self.ss_t_object = FCComboBox()
|
|
|
+ self.ss_t_object.setModel(self.app.collection)
|
|
|
+ self.ss_t_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ self.ss_t_object.is_last = True
|
|
|
+ self.ss_t_object.obj_type = "Gerber"
|
|
|
|
|
|
- def worker_job(app_obj):
|
|
|
- self.app.proc_container.new(_("Working..."))
|
|
|
+ self.ss_t_object_lbl = FCLabel('%s:' % _("Silk Top"))
|
|
|
+ self.ss_t_object_lbl.setToolTip(
|
|
|
+ _("The Top Gerber Silkscreen object for which rules are checked.")
|
|
|
+ )
|
|
|
|
|
|
- # RULE: Check Trace Size
|
|
|
- if self.trace_size_cb.get_value():
|
|
|
- copper_list = []
|
|
|
- copper_name_1 = self.copper_t_object.currentText()
|
|
|
- if copper_name_1 != '' and self.copper_t_cb.get_value():
|
|
|
- elem_dict = {}
|
|
|
- elem_dict['name'] = deepcopy(copper_name_1)
|
|
|
- elem_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_name_1).apertures)
|
|
|
- copper_list.append(elem_dict)
|
|
|
+ self.ss_t_cb = FCCheckBox()
|
|
|
|
|
|
- copper_name_2 = self.copper_b_object.currentText()
|
|
|
- if copper_name_2 != '' and self.copper_b_cb.get_value():
|
|
|
- elem_dict = {}
|
|
|
- elem_dict['name'] = deepcopy(copper_name_2)
|
|
|
- elem_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_name_2).apertures)
|
|
|
- copper_list.append(elem_dict)
|
|
|
+ self.grid_layout.addWidget(self.ss_t_object_lbl, 5, 0)
|
|
|
+ self.grid_layout.addWidget(self.ss_t_object, 5, 1)
|
|
|
+ self.grid_layout.addWidget(self.ss_t_cb, 5, 2)
|
|
|
|
|
|
- trace_size = float(self.trace_size_entry.get_value())
|
|
|
- self.results.append(self.pool.apply_async(self.check_traces_size, args=(copper_list, trace_size)))
|
|
|
+ # SilkScreen Bottom object
|
|
|
+ self.ss_b_object = FCComboBox()
|
|
|
+ self.ss_b_object.setModel(self.app.collection)
|
|
|
+ self.ss_b_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ self.ss_b_object.is_last = True
|
|
|
+ self.ss_b_object.obj_type = "Gerber"
|
|
|
|
|
|
- # RULE: Check Copper to Copper Clearance
|
|
|
- if self.clearance_copper2copper_cb.get_value():
|
|
|
+ self.ss_b_object_lbl = FCLabel('%s:' % _("Silk Bottom"))
|
|
|
+ self.ss_b_object_lbl.setToolTip(
|
|
|
+ _("The Bottom Gerber Silkscreen object for which rules are checked.")
|
|
|
+ )
|
|
|
|
|
|
- try:
|
|
|
- copper_copper_clearance = float(self.clearance_copper2copper_entry.get_value())
|
|
|
- except Exception as e:
|
|
|
- log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Copper to Copper clearance"),
|
|
|
- _("Value is not valid.")))
|
|
|
- return
|
|
|
+ self.ss_b_cb = FCCheckBox()
|
|
|
|
|
|
- if self.copper_t_cb.get_value():
|
|
|
- copper_t_obj = self.copper_t_object.currentText()
|
|
|
- copper_t_dict = {}
|
|
|
+ self.grid_layout.addWidget(self.ss_b_object_lbl, 6, 0)
|
|
|
+ self.grid_layout.addWidget(self.ss_b_object, 6, 1)
|
|
|
+ self.grid_layout.addWidget(self.ss_b_cb, 6, 2)
|
|
|
|
|
|
- if copper_t_obj != '':
|
|
|
- copper_t_dict['name'] = deepcopy(copper_t_obj)
|
|
|
- copper_t_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_t_obj).apertures)
|
|
|
+ # Outline object
|
|
|
+ self.outline_object = FCComboBox()
|
|
|
+ self.outline_object.setModel(self.app.collection)
|
|
|
+ self.outline_object.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
+ self.outline_object.is_last = True
|
|
|
+ self.outline_object.obj_type = "Gerber"
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
- args=(copper_t_dict,
|
|
|
- copper_copper_clearance,
|
|
|
- _("TOP -> Copper to Copper clearance"))))
|
|
|
- if self.copper_b_cb.get_value():
|
|
|
- copper_b_obj = self.copper_b_object.currentText()
|
|
|
- copper_b_dict = {}
|
|
|
- if copper_b_obj != '':
|
|
|
- copper_b_dict['name'] = deepcopy(copper_b_obj)
|
|
|
- copper_b_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_b_obj).apertures)
|
|
|
+ self.outline_object_lbl = FCLabel('%s:' % _("Outline"))
|
|
|
+ self.outline_object_lbl.setToolTip(
|
|
|
+ _("The Gerber Outline (Cutout) object for which rules are checked.")
|
|
|
+ )
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
- args=(copper_b_dict,
|
|
|
- copper_copper_clearance,
|
|
|
- _("BOTTOM -> Copper to Copper clearance"))))
|
|
|
+ self.out_cb = FCCheckBox()
|
|
|
|
|
|
- if self.copper_t_cb.get_value() is False and self.copper_b_cb.get_value() is False:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Copper to Copper clearance"),
|
|
|
- _("At least one Gerber object has to be selected for this rule but none is selected.")))
|
|
|
- return
|
|
|
+ self.grid_layout.addWidget(self.outline_object_lbl, 7, 0)
|
|
|
+ self.grid_layout.addWidget(self.outline_object, 7, 1)
|
|
|
+ self.grid_layout.addWidget(self.out_cb, 7, 2)
|
|
|
|
|
|
- # RULE: Check Copper to Outline Clearance
|
|
|
- if self.clearance_copper2ol_cb.get_value() and self.out_cb.get_value():
|
|
|
- top_dict = {}
|
|
|
- bottom_dict = {}
|
|
|
- outline_dict = {}
|
|
|
+ self.grid_layout.addWidget(FCLabel(""), 8, 0, 1, 3)
|
|
|
|
|
|
- copper_top = self.copper_t_object.currentText()
|
|
|
- if copper_top != '' and self.copper_t_cb.get_value():
|
|
|
- top_dict['name'] = deepcopy(copper_top)
|
|
|
- top_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_top).apertures)
|
|
|
+ self.excellon_title_lbl = FCLabel('<b>%s</b>:' % _("EXCELLON"))
|
|
|
+ self.excellon_title_lbl.setToolTip(
|
|
|
+ _("Excellon objects for which to check rules.")
|
|
|
+ )
|
|
|
|
|
|
- copper_bottom = self.copper_b_object.currentText()
|
|
|
- if copper_bottom != '' and self.copper_b_cb.get_value():
|
|
|
- bottom_dict['name'] = deepcopy(copper_bottom)
|
|
|
- bottom_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_bottom).apertures)
|
|
|
+ self.grid_layout.addWidget(self.excellon_title_lbl, 9, 0, 1, 3)
|
|
|
|
|
|
- copper_outline = self.outline_object.currentText()
|
|
|
- if copper_outline != '' and self.out_cb.get_value():
|
|
|
- outline_dict['name'] = deepcopy(copper_outline)
|
|
|
- outline_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_outline).apertures)
|
|
|
+ # Excellon 1 object
|
|
|
+ self.e1_object = FCComboBox()
|
|
|
+ self.e1_object.setModel(self.app.collection)
|
|
|
+ self.e1_object.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
|
|
|
+ self.e1_object.is_last = True
|
|
|
+ self.e1_object.obj_type = "Excellon"
|
|
|
|
|
|
- try:
|
|
|
- copper_outline_clearance = float(self.clearance_copper2ol_entry.get_value())
|
|
|
- except Exception as e:
|
|
|
- log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Copper to Outline clearance"),
|
|
|
- _("Value is not valid.")))
|
|
|
- return
|
|
|
+ self.e1_object_lbl = FCLabel('%s:' % _("Excellon 1"))
|
|
|
+ self.e1_object_lbl.setToolTip(
|
|
|
+ _("Excellon object for which to check rules.\n"
|
|
|
+ "Holds the plated holes or a general Excellon file content.")
|
|
|
+ )
|
|
|
|
|
|
- if not top_dict and not bottom_dict or not outline_dict:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Copper to Outline clearance"),
|
|
|
- _("One of the copper Gerber objects or the Outline Gerber object is not valid.")))
|
|
|
- return
|
|
|
- objs = []
|
|
|
- if top_dict:
|
|
|
- objs.append(top_dict)
|
|
|
- if bottom_dict:
|
|
|
- objs.append(bottom_dict)
|
|
|
+ self.e1_cb = FCCheckBox()
|
|
|
|
|
|
- if outline_dict:
|
|
|
- objs.append(outline_dict)
|
|
|
- else:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Copper to Outline clearance"),
|
|
|
- _("Outline Gerber object presence is mandatory for this rule but it is not selected.")))
|
|
|
- return
|
|
|
+ self.grid_layout.addWidget(self.e1_object_lbl, 10, 0)
|
|
|
+ self.grid_layout.addWidget(self.e1_object, 10, 1)
|
|
|
+ self.grid_layout.addWidget(self.e1_cb, 10, 2)
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_gerber_clearance,
|
|
|
- args=(objs,
|
|
|
- copper_outline_clearance,
|
|
|
- _("Copper to Outline clearance"))))
|
|
|
+ # Excellon 2 object
|
|
|
+ self.e2_object = FCComboBox()
|
|
|
+ self.e2_object.setModel(self.app.collection)
|
|
|
+ self.e2_object.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
|
|
|
+ self.e2_object.is_last = True
|
|
|
+ self.e2_object.obj_type = "Excellon"
|
|
|
|
|
|
- # RULE: Check Silk to Silk Clearance
|
|
|
- if self.clearance_silk2silk_cb.get_value():
|
|
|
- silk_dict = {}
|
|
|
+ self.e2_object_lbl = FCLabel('%s:' % _("Excellon 2"))
|
|
|
+ self.e2_object_lbl.setToolTip(
|
|
|
+ _("Excellon object for which to check rules.\n"
|
|
|
+ "Holds the non-plated holes.")
|
|
|
+ )
|
|
|
+
|
|
|
+ self.e2_cb = FCCheckBox()
|
|
|
|
|
|
- try:
|
|
|
- silk_silk_clearance = float(self.clearance_silk2silk_entry.get_value())
|
|
|
- except Exception as e:
|
|
|
- log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Silk to Silk clearance"),
|
|
|
- _("Value is not valid.")))
|
|
|
- return
|
|
|
+ self.grid_layout.addWidget(self.e2_object_lbl, 11, 0)
|
|
|
+ self.grid_layout.addWidget(self.e2_object, 11, 1)
|
|
|
+ self.grid_layout.addWidget(self.e2_cb, 11, 2)
|
|
|
|
|
|
- if self.ss_t_cb.get_value():
|
|
|
- silk_obj = self.ss_t_object.currentText()
|
|
|
- if silk_obj != '':
|
|
|
- silk_dict['name'] = deepcopy(silk_obj)
|
|
|
- silk_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_obj).apertures)
|
|
|
+ self.grid_layout.addWidget(FCLabel(""), 12, 0, 1, 3)
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
- args=(silk_dict,
|
|
|
- silk_silk_clearance,
|
|
|
- _("TOP -> Silk to Silk clearance"))))
|
|
|
- if self.ss_b_cb.get_value():
|
|
|
- silk_obj = self.ss_b_object.currentText()
|
|
|
- if silk_obj != '':
|
|
|
- silk_dict['name'] = deepcopy(silk_obj)
|
|
|
- silk_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_obj).apertures)
|
|
|
+ # Control All
|
|
|
+ self.all_cb = FCCheckBox('%s' % _("All Rules"))
|
|
|
+ self.all_cb.setToolTip(
|
|
|
+ _("This check/uncheck all the rules below.")
|
|
|
+ )
|
|
|
+ self.all_cb.setStyleSheet(
|
|
|
+ """
|
|
|
+ QCheckBox {font-weight: bold; color: green}
|
|
|
+ """
|
|
|
+ )
|
|
|
+ self.layout.addWidget(self.all_cb)
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
- args=(silk_dict,
|
|
|
- silk_silk_clearance,
|
|
|
- _("BOTTOM -> Silk to Silk clearance"))))
|
|
|
+ # Form Layout
|
|
|
+ self.form_layout_1 = QtWidgets.QFormLayout()
|
|
|
+ self.layout.addLayout(self.form_layout_1)
|
|
|
|
|
|
- if self.ss_t_cb.get_value() is False and self.ss_b_cb.get_value() is False:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Silk to Silk clearance"),
|
|
|
- _("At least one Gerber object has to be selected for this rule but none is selected.")))
|
|
|
- return
|
|
|
+ self.form_layout_1.addRow(FCLabel(""))
|
|
|
|
|
|
- # RULE: Check Silk to Solder Mask Clearance
|
|
|
- if self.clearance_silk2sm_cb.get_value():
|
|
|
- silk_t_dict = {}
|
|
|
- sm_t_dict = {}
|
|
|
- silk_b_dict = {}
|
|
|
- sm_b_dict = {}
|
|
|
+ # Trace size
|
|
|
+ self.trace_size_cb = FCCheckBox('%s:' % _("Trace Size"))
|
|
|
+ self.trace_size_cb.setToolTip(
|
|
|
+ _("This checks if the minimum size for traces is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.trace_size_cb)
|
|
|
|
|
|
- top_ss = False
|
|
|
- bottom_ss = False
|
|
|
- top_sm = False
|
|
|
- bottom_sm = False
|
|
|
+ # Trace size value
|
|
|
+ self.trace_size_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.trace_size_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.trace_size_entry.set_precision(self.decimals)
|
|
|
+ self.trace_size_entry.setSingleStep(0.1)
|
|
|
|
|
|
- silk_top = self.ss_t_object.currentText()
|
|
|
- if silk_top != '' and self.ss_t_cb.get_value():
|
|
|
- silk_t_dict['name'] = deepcopy(silk_top)
|
|
|
- silk_t_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_top).apertures)
|
|
|
- top_ss = True
|
|
|
+ self.trace_size_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.trace_size_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable trace size.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.trace_size_lbl, self.trace_size_entry)
|
|
|
|
|
|
- silk_bottom = self.ss_b_object.currentText()
|
|
|
- if silk_bottom != '' and self.ss_b_cb.get_value():
|
|
|
- silk_b_dict['name'] = deepcopy(silk_bottom)
|
|
|
- silk_b_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_bottom).apertures)
|
|
|
- bottom_ss = True
|
|
|
+ self.ts = OptionalInputSection(self.trace_size_cb, [self.trace_size_lbl, self.trace_size_entry])
|
|
|
|
|
|
- sm_top = self.sm_t_object.currentText()
|
|
|
- if sm_top != '' and self.sm_t_cb.get_value():
|
|
|
- sm_t_dict['name'] = deepcopy(sm_top)
|
|
|
- sm_t_dict['apertures'] = deepcopy(self.app.collection.get_by_name(sm_top).apertures)
|
|
|
- top_sm = True
|
|
|
+ # Copper2copper clearance
|
|
|
+ self.clearance_copper2copper_cb = FCCheckBox('%s:' % _("Copper to Copper clearance"))
|
|
|
+ self.clearance_copper2copper_cb.setToolTip(
|
|
|
+ _("This checks if the minimum clearance between copper\n"
|
|
|
+ "features is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_copper2copper_cb)
|
|
|
|
|
|
- sm_bottom = self.sm_b_object.currentText()
|
|
|
- if sm_bottom != '' and self.sm_b_cb.get_value():
|
|
|
- sm_b_dict['name'] = deepcopy(sm_bottom)
|
|
|
- sm_b_dict['apertures'] = deepcopy(self.app.collection.get_by_name(sm_bottom).apertures)
|
|
|
- bottom_sm = True
|
|
|
+ # Copper2copper clearance value
|
|
|
+ self.clearance_copper2copper_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.clearance_copper2copper_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.clearance_copper2copper_entry.set_precision(self.decimals)
|
|
|
+ self.clearance_copper2copper_entry.setSingleStep(0.1)
|
|
|
|
|
|
- try:
|
|
|
- silk_sm_clearance = float(self.clearance_silk2sm_entry.get_value())
|
|
|
- except Exception as e:
|
|
|
- log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Silk to Solder Mask Clearance"),
|
|
|
- _("Value is not valid.")))
|
|
|
- return
|
|
|
+ self.clearance_copper2copper_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.clearance_copper2copper_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable clearance value.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry)
|
|
|
|
|
|
- if (not silk_t_dict and not silk_b_dict) or (not sm_t_dict and not sm_b_dict):
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Silk to Solder Mask Clearance"),
|
|
|
- _("One or more of the Gerber objects is not valid.")))
|
|
|
- return
|
|
|
+ self.c2c = OptionalInputSection(
|
|
|
+ self.clearance_copper2copper_cb, [self.clearance_copper2copper_lbl, self.clearance_copper2copper_entry])
|
|
|
|
|
|
- if top_ss is True and top_sm is True:
|
|
|
- objs = [silk_t_dict, sm_t_dict]
|
|
|
- self.results.append(self.pool.apply_async(self.check_gerber_clearance,
|
|
|
- args=(objs,
|
|
|
- silk_sm_clearance,
|
|
|
- _("TOP -> Silk to Solder Mask Clearance"))))
|
|
|
- elif bottom_ss is True and bottom_sm is True:
|
|
|
- objs = [silk_b_dict, sm_b_dict]
|
|
|
- self.results.append(self.pool.apply_async(self.check_gerber_clearance,
|
|
|
- args=(objs,
|
|
|
- silk_sm_clearance,
|
|
|
- _("BOTTOM -> Silk to Solder Mask Clearance"))))
|
|
|
- else:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Silk to Solder Mask Clearance"),
|
|
|
- _("Both Silk and Solder Mask Gerber objects has to be either both Top or both Bottom.")))
|
|
|
- return
|
|
|
+ # Copper2outline clearance
|
|
|
+ self.clearance_copper2ol_cb = FCCheckBox('%s:' % _("Copper to Outline clearance"))
|
|
|
+ self.clearance_copper2ol_cb.setToolTip(
|
|
|
+ _("This checks if the minimum clearance between copper\n"
|
|
|
+ "features and the outline is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_copper2ol_cb)
|
|
|
|
|
|
- # RULE: Check Silk to Outline Clearance
|
|
|
- if self.clearance_silk2ol_cb.get_value():
|
|
|
- top_dict = {}
|
|
|
- bottom_dict = {}
|
|
|
- outline_dict = {}
|
|
|
+ # Copper2outline clearance value
|
|
|
+ self.clearance_copper2ol_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.clearance_copper2ol_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.clearance_copper2ol_entry.set_precision(self.decimals)
|
|
|
+ self.clearance_copper2ol_entry.setSingleStep(0.1)
|
|
|
|
|
|
- silk_top = self.ss_t_object.currentText()
|
|
|
- if silk_top != '' and self.ss_t_cb.get_value():
|
|
|
- top_dict['name'] = deepcopy(silk_top)
|
|
|
- top_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_top).apertures)
|
|
|
+ self.clearance_copper2ol_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.clearance_copper2ol_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable clearance value.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry)
|
|
|
|
|
|
- silk_bottom = self.ss_b_object.currentText()
|
|
|
- if silk_bottom != '' and self.ss_b_cb.get_value():
|
|
|
- bottom_dict['name'] = deepcopy(silk_bottom)
|
|
|
- bottom_dict['apertures'] = deepcopy(self.app.collection.get_by_name(silk_bottom).apertures)
|
|
|
+ self.c2ol = OptionalInputSection(
|
|
|
+ self.clearance_copper2ol_cb, [self.clearance_copper2ol_lbl, self.clearance_copper2ol_entry])
|
|
|
|
|
|
- copper_outline = self.outline_object.currentText()
|
|
|
- if copper_outline != '' and self.out_cb.get_value():
|
|
|
- outline_dict['name'] = deepcopy(copper_outline)
|
|
|
- outline_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_outline).apertures)
|
|
|
+ # Silkscreen2silkscreen clearance
|
|
|
+ self.clearance_silk2silk_cb = FCCheckBox('%s:' % _("Silk to Silk Clearance"))
|
|
|
+ self.clearance_silk2silk_cb.setToolTip(
|
|
|
+ _("This checks if the minimum clearance between silkscreen\n"
|
|
|
+ "features and silkscreen features is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_silk2silk_cb)
|
|
|
|
|
|
- try:
|
|
|
- copper_outline_clearance = float(self.clearance_copper2ol_entry.get_value())
|
|
|
- except Exception as e:
|
|
|
- log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Silk to Outline Clearance"),
|
|
|
- _("Value is not valid.")))
|
|
|
- return
|
|
|
+ # Copper2silkscreen clearance value
|
|
|
+ self.clearance_silk2silk_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.clearance_silk2silk_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.clearance_silk2silk_entry.set_precision(self.decimals)
|
|
|
+ self.clearance_silk2silk_entry.setSingleStep(0.1)
|
|
|
|
|
|
- if not top_dict and not bottom_dict or not outline_dict:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Silk to Outline Clearance"),
|
|
|
- _("One of the Silk Gerber objects or the Outline Gerber object is not valid.")))
|
|
|
- return
|
|
|
+ self.clearance_silk2silk_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.clearance_silk2silk_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable clearance value.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry)
|
|
|
|
|
|
- objs = []
|
|
|
- if top_dict:
|
|
|
- objs.append(top_dict)
|
|
|
- if bottom_dict:
|
|
|
- objs.append(bottom_dict)
|
|
|
+ self.s2s = OptionalInputSection(
|
|
|
+ self.clearance_silk2silk_cb, [self.clearance_silk2silk_lbl, self.clearance_silk2silk_entry])
|
|
|
|
|
|
- if outline_dict:
|
|
|
- objs.append(outline_dict)
|
|
|
- else:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Silk to Outline Clearance"),
|
|
|
- _("Outline Gerber object presence is mandatory for this rule but it is not selected.")))
|
|
|
- return
|
|
|
+ # Silkscreen2soldermask clearance
|
|
|
+ self.clearance_silk2sm_cb = FCCheckBox('%s:' % _("Silk to Solder Mask Clearance"))
|
|
|
+ self.clearance_silk2sm_cb.setToolTip(
|
|
|
+ _("This checks if the minimum clearance between silkscreen\n"
|
|
|
+ "features and soldermask features is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_silk2sm_cb)
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_gerber_clearance,
|
|
|
- args=(objs,
|
|
|
- copper_outline_clearance,
|
|
|
- _("Silk to Outline Clearance"))))
|
|
|
+ # Silkscreen2soldermask clearance value
|
|
|
+ self.clearance_silk2sm_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.clearance_silk2sm_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.clearance_silk2sm_entry.set_precision(self.decimals)
|
|
|
+ self.clearance_silk2sm_entry.setSingleStep(0.1)
|
|
|
|
|
|
- # RULE: Check Minimum Solder Mask Sliver
|
|
|
- if self.clearance_silk2silk_cb.get_value():
|
|
|
- sm_dict = {}
|
|
|
+ self.clearance_silk2sm_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.clearance_silk2sm_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable clearance value.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry)
|
|
|
|
|
|
- try:
|
|
|
- sm_sm_clearance = float(self.clearance_sm2sm_entry.get_value())
|
|
|
- except Exception as e:
|
|
|
- log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Minimum Solder Mask Sliver"),
|
|
|
- _("Value is not valid.")))
|
|
|
- return
|
|
|
+ self.s2sm = OptionalInputSection(
|
|
|
+ self.clearance_silk2sm_cb, [self.clearance_silk2sm_lbl, self.clearance_silk2sm_entry])
|
|
|
|
|
|
- if self.sm_t_cb.get_value():
|
|
|
- solder_obj = self.sm_t_object.currentText()
|
|
|
- if solder_obj != '':
|
|
|
- sm_dict['name'] = deepcopy(solder_obj)
|
|
|
- sm_dict['apertures'] = deepcopy(self.app.collection.get_by_name(solder_obj).apertures)
|
|
|
+ # Silk2outline clearance
|
|
|
+ self.clearance_silk2ol_cb = FCCheckBox('%s:' % _("Silk to Outline Clearance"))
|
|
|
+ self.clearance_silk2ol_cb.setToolTip(
|
|
|
+ _("This checks if the minimum clearance between silk\n"
|
|
|
+ "features and the outline is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_silk2ol_cb)
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
- args=(sm_dict,
|
|
|
- sm_sm_clearance,
|
|
|
- _("TOP -> Minimum Solder Mask Sliver"))))
|
|
|
- if self.sm_b_cb.get_value():
|
|
|
- solder_obj = self.sm_b_object.currentText()
|
|
|
- if solder_obj != '':
|
|
|
- sm_dict['name'] = deepcopy(solder_obj)
|
|
|
- sm_dict['apertures'] = deepcopy(self.app.collection.get_by_name(solder_obj).apertures)
|
|
|
+ # Silk2outline clearance value
|
|
|
+ self.clearance_silk2ol_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.clearance_silk2ol_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.clearance_silk2ol_entry.set_precision(self.decimals)
|
|
|
+ self.clearance_silk2ol_entry.setSingleStep(0.1)
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_inside_gerber_clearance,
|
|
|
- args=(sm_dict,
|
|
|
- sm_sm_clearance,
|
|
|
- _("BOTTOM -> Minimum Solder Mask Sliver"))))
|
|
|
+ self.clearance_silk2ol_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.clearance_silk2ol_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable clearance value.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry)
|
|
|
|
|
|
- if self.sm_t_cb.get_value() is False and self.sm_b_cb.get_value() is False:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Minimum Solder Mask Sliver"),
|
|
|
- _("At least one Gerber object has to be selected for this rule but none is selected.")))
|
|
|
- return
|
|
|
+ self.s2ol = OptionalInputSection(
|
|
|
+ self.clearance_silk2ol_cb, [self.clearance_silk2ol_lbl, self.clearance_silk2ol_entry])
|
|
|
|
|
|
- # RULE: Check Minimum Annular Ring
|
|
|
- if self.ring_integrity_cb.get_value():
|
|
|
- top_dict = {}
|
|
|
- bottom_dict = {}
|
|
|
- exc_1_dict = {}
|
|
|
- exc_2_dict = {}
|
|
|
+ # Soldermask2soldermask clearance
|
|
|
+ self.clearance_sm2sm_cb = FCCheckBox('%s:' % _("Minimum Solder Mask Sliver"))
|
|
|
+ self.clearance_sm2sm_cb.setToolTip(
|
|
|
+ _("This checks if the minimum clearance between soldermask\n"
|
|
|
+ "features and soldermask features is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_sm2sm_cb)
|
|
|
|
|
|
- copper_top = self.copper_t_object.currentText()
|
|
|
- if copper_top != '' and self.copper_t_cb.get_value():
|
|
|
- top_dict['name'] = deepcopy(copper_top)
|
|
|
- top_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_top).apertures)
|
|
|
+ # Soldermask2soldermask clearance value
|
|
|
+ self.clearance_sm2sm_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.clearance_sm2sm_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.clearance_sm2sm_entry.set_precision(self.decimals)
|
|
|
+ self.clearance_sm2sm_entry.setSingleStep(0.1)
|
|
|
|
|
|
- copper_bottom = self.copper_b_object.currentText()
|
|
|
- if copper_bottom != '' and self.copper_b_cb.get_value():
|
|
|
- bottom_dict['name'] = deepcopy(copper_bottom)
|
|
|
- bottom_dict['apertures'] = deepcopy(self.app.collection.get_by_name(copper_bottom).apertures)
|
|
|
+ self.clearance_sm2sm_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.clearance_sm2sm_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable clearance value.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry)
|
|
|
|
|
|
- excellon_1 = self.e1_object.currentText()
|
|
|
- if excellon_1 != '' and self.e1_cb.get_value():
|
|
|
- exc_1_dict['name'] = deepcopy(excellon_1)
|
|
|
- exc_1_dict['tools'] = deepcopy(
|
|
|
- self.app.collection.get_by_name(excellon_1).tools)
|
|
|
+ self.sm2sm = OptionalInputSection(
|
|
|
+ self.clearance_sm2sm_cb, [self.clearance_sm2sm_lbl, self.clearance_sm2sm_entry])
|
|
|
|
|
|
- excellon_2 = self.e2_object.currentText()
|
|
|
- if excellon_2 != '' and self.e2_cb.get_value():
|
|
|
- exc_2_dict['name'] = deepcopy(excellon_2)
|
|
|
- exc_2_dict['tools'] = deepcopy(
|
|
|
- self.app.collection.get_by_name(excellon_2).tools)
|
|
|
+ # Ring integrity check
|
|
|
+ self.ring_integrity_cb = FCCheckBox('%s:' % _("Minimum Annular Ring"))
|
|
|
+ self.ring_integrity_cb.setToolTip(
|
|
|
+ _("This checks if the minimum copper ring left by drilling\n"
|
|
|
+ "a hole into a pad is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.ring_integrity_cb)
|
|
|
|
|
|
- try:
|
|
|
- ring_val = float(self.ring_integrity_entry.get_value())
|
|
|
- except Exception as e:
|
|
|
- log.debug("RulesCheck.execute.worker_job() --> %s" % str(e))
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Minimum Annular Ring"),
|
|
|
- _("Value is not valid.")))
|
|
|
- return
|
|
|
+ # Ring integrity value
|
|
|
+ self.ring_integrity_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.ring_integrity_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.ring_integrity_entry.set_precision(self.decimals)
|
|
|
+ self.ring_integrity_entry.setSingleStep(0.1)
|
|
|
|
|
|
- if (not top_dict and not bottom_dict) or (not exc_1_dict and not exc_2_dict):
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Minimum Annular Ring"),
|
|
|
- _("One of the Copper Gerber objects or the Excellon objects is not valid.")))
|
|
|
- return
|
|
|
+ self.ring_integrity_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.ring_integrity_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable ring value.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.ring_integrity_lbl, self.ring_integrity_entry)
|
|
|
|
|
|
- objs = []
|
|
|
- if top_dict:
|
|
|
- objs.append(top_dict)
|
|
|
- elif bottom_dict:
|
|
|
- objs.append(bottom_dict)
|
|
|
+ self.anr = OptionalInputSection(
|
|
|
+ self.ring_integrity_cb, [self.ring_integrity_lbl, self.ring_integrity_entry])
|
|
|
|
|
|
- if exc_1_dict:
|
|
|
- objs.append(exc_1_dict)
|
|
|
- elif exc_2_dict:
|
|
|
- objs.append(exc_2_dict)
|
|
|
- else:
|
|
|
- self.app.inform.emit('[ERROR_NOTCL] %s. %s' % (
|
|
|
- _("Minimum Annular Ring"),
|
|
|
- _("Excellon object presence is mandatory for this rule but none is selected.")))
|
|
|
- return
|
|
|
+ self.form_layout_1.addRow(FCLabel(""))
|
|
|
|
|
|
- self.results.append(self.pool.apply_async(self.check_gerber_annular_ring,
|
|
|
- args=(objs,
|
|
|
- ring_val,
|
|
|
- _("Minimum Annular Ring"))))
|
|
|
+ # Hole2Hole clearance
|
|
|
+ self.clearance_d2d_cb = FCCheckBox('%s:' % _("Hole to Hole Clearance"))
|
|
|
+ self.clearance_d2d_cb.setToolTip(
|
|
|
+ _("This checks if the minimum clearance between a drill hole\n"
|
|
|
+ "and another drill hole is met.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_d2d_cb)
|
|
|
|
|
|
- # RULE: Check Hole to Hole Clearance
|
|
|
- if self.clearance_d2d_cb.get_value():
|
|
|
- exc_list = []
|
|
|
- exc_name_1 = self.e1_object.currentText()
|
|
|
- if exc_name_1 != '' and self.e1_cb.get_value():
|
|
|
- elem_dict = {}
|
|
|
- elem_dict['name'] = deepcopy(exc_name_1)
|
|
|
- elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_1).tools)
|
|
|
- exc_list.append(elem_dict)
|
|
|
+ # Hole2Hole clearance value
|
|
|
+ self.clearance_d2d_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.clearance_d2d_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.clearance_d2d_entry.set_precision(self.decimals)
|
|
|
+ self.clearance_d2d_entry.setSingleStep(0.1)
|
|
|
|
|
|
- exc_name_2 = self.e2_object.currentText()
|
|
|
- if exc_name_2 != '' and self.e2_cb.get_value():
|
|
|
- elem_dict = {}
|
|
|
- elem_dict['name'] = deepcopy(exc_name_2)
|
|
|
- elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_2).tools)
|
|
|
- exc_list.append(elem_dict)
|
|
|
+ self.clearance_d2d_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.clearance_d2d_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable clearance value.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.clearance_d2d_lbl, self.clearance_d2d_entry)
|
|
|
|
|
|
- hole_clearance = float(self.clearance_d2d_entry.get_value())
|
|
|
- self.results.append(self.pool.apply_async(self.check_holes_clearance, args=(exc_list, hole_clearance)))
|
|
|
+ self.d2d = OptionalInputSection(
|
|
|
+ self.clearance_d2d_cb, [self.clearance_d2d_lbl, self.clearance_d2d_entry])
|
|
|
|
|
|
- # RULE: Check Holes Size
|
|
|
- if self.drill_size_cb.get_value():
|
|
|
- exc_list = []
|
|
|
- exc_name_1 = self.e1_object.currentText()
|
|
|
- if exc_name_1 != '' and self.e1_cb.get_value():
|
|
|
- elem_dict = {}
|
|
|
- elem_dict['name'] = deepcopy(exc_name_1)
|
|
|
- elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_1).tools)
|
|
|
- exc_list.append(elem_dict)
|
|
|
+ # Drill holes size check
|
|
|
+ self.drill_size_cb = FCCheckBox('%s:' % _("Hole Size"))
|
|
|
+ self.drill_size_cb.setToolTip(
|
|
|
+ _("This checks if the drill holes\n"
|
|
|
+ "sizes are above the threshold.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.drill_size_cb)
|
|
|
|
|
|
- exc_name_2 = self.e2_object.currentText()
|
|
|
- if exc_name_2 != '' and self.e2_cb.get_value():
|
|
|
- elem_dict = {}
|
|
|
- elem_dict['name'] = deepcopy(exc_name_2)
|
|
|
- elem_dict['tools'] = deepcopy(self.app.collection.get_by_name(exc_name_2).tools)
|
|
|
- exc_list.append(elem_dict)
|
|
|
+ # Drile holes value
|
|
|
+ self.drill_size_entry = FCDoubleSpinner(callback=self.confirmation_message)
|
|
|
+ self.drill_size_entry.set_range(0.00001, 999.99999)
|
|
|
+ self.drill_size_entry.set_precision(self.decimals)
|
|
|
+ self.drill_size_entry.setSingleStep(0.1)
|
|
|
|
|
|
- drill_size = float(self.drill_size_entry.get_value())
|
|
|
- self.results.append(self.pool.apply_async(self.check_holes_size, args=(exc_list, drill_size)))
|
|
|
+ self.drill_size_lbl = FCLabel('%s:' % _("Min value"))
|
|
|
+ self.drill_size_lbl.setToolTip(
|
|
|
+ _("Minimum acceptable drill size.")
|
|
|
+ )
|
|
|
+ self.form_layout_1.addRow(self.drill_size_lbl, self.drill_size_entry)
|
|
|
|
|
|
- output = []
|
|
|
- for p in self.results:
|
|
|
- output.append(p.get())
|
|
|
+ self.ds = OptionalInputSection(
|
|
|
+ self.drill_size_cb, [self.drill_size_lbl, self.drill_size_entry])
|
|
|
|
|
|
- self.tool_finished.emit(output)
|
|
|
+ # Buttons
|
|
|
+ hlay_2 = QtWidgets.QHBoxLayout()
|
|
|
+ self.layout.addLayout(hlay_2)
|
|
|
|
|
|
- log.debug("RuleCheck() finished")
|
|
|
+ # hlay_2.addStretch()
|
|
|
+ self.run_button = FCButton(_("Run Rules Check"))
|
|
|
+ self.run_button.setToolTip(
|
|
|
+ _("Panelize the specified object around the specified box.\n"
|
|
|
+ "In other words it creates multiple copies of the source object,\n"
|
|
|
+ "arranged in a 2D array of rows and columns.")
|
|
|
+ )
|
|
|
+ self.run_button.setStyleSheet("""
|
|
|
+ QPushButton
|
|
|
+ {
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ """)
|
|
|
+ hlay_2.addWidget(self.run_button)
|
|
|
|
|
|
- self.app.worker_task.emit({'fcn': worker_job, 'params': [self.app]})
|
|
|
+ self.layout.addStretch()
|
|
|
|
|
|
- def on_tool_finished(self, res):
|
|
|
- def init(new_obj, app_obj):
|
|
|
- txt = ''
|
|
|
- for el in res:
|
|
|
- txt += '<b>RULE NAME:</b> %s<BR>' % str(el[0]).upper()
|
|
|
- if isinstance(el[1][0]['name'], list):
|
|
|
- for name in el[1][0]['name']:
|
|
|
- txt += 'File name: %s<BR>' % str(name)
|
|
|
- else:
|
|
|
- txt += 'File name: %s<BR>' % str(el[1][0]['name'])
|
|
|
+ # ## Reset Tool
|
|
|
+ self.reset_button = FCButton(_("Reset Tool"))
|
|
|
+ self.reset_button.setIcon(QtGui.QIcon(self.app.resource_location + '/reset32.png'))
|
|
|
+ self.reset_button.setToolTip(
|
|
|
+ _("Will reset the tool parameters.")
|
|
|
+ )
|
|
|
+ self.reset_button.setStyleSheet("""
|
|
|
+ QPushButton
|
|
|
+ {
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ """)
|
|
|
+ self.layout.addWidget(self.reset_button)
|
|
|
|
|
|
- point_txt = ''
|
|
|
- try:
|
|
|
- if el[1][0]['points']:
|
|
|
- txt += '{title}: <span style="color:{color};background-color:{h_color}"' \
|
|
|
- '> {status} </span>.<BR>'.format(title=_("STATUS"),
|
|
|
- h_color='red',
|
|
|
- color='white',
|
|
|
- status=_("FAILED"))
|
|
|
- if 'Failed' in el[1][0]['points'][0]:
|
|
|
- point_txt = el[1][0]['points'][0]
|
|
|
- else:
|
|
|
- for pt in el[1][0]['points']:
|
|
|
- point_txt += '(%.*f, %.*f)' % (self.decimals, float(pt[0]), self.decimals, float(pt[1]))
|
|
|
- point_txt += ', '
|
|
|
- txt += 'Violations: %s<BR>' % str(point_txt)
|
|
|
- else:
|
|
|
- txt += '{title}: <span style="color:{color};background-color:{h_color}"' \
|
|
|
- '> {status} </span>.<BR>'.format(title=_("STATUS"),
|
|
|
- h_color='green',
|
|
|
- color='white',
|
|
|
- status=_("PASSED"))
|
|
|
- txt += '%s<BR>' % _("Violations: There are no violations for the current rule.")
|
|
|
- except KeyError:
|
|
|
- pass
|
|
|
+ # #################################### FINSIHED GUI ###########################
|
|
|
+ # #############################################################################
|
|
|
+ def on_all_cb_changed(self, state):
|
|
|
+ cb_items = [self.form_layout_1.itemAt(i).widget() for i in range(self.form_layout_1.count())
|
|
|
+ if isinstance(self.form_layout_1.itemAt(i).widget(), FCCheckBox)]
|
|
|
|
|
|
- try:
|
|
|
- if el[1][0]['dia']:
|
|
|
- txt += '{title}: <span style="color:{color};background-color:{h_color}"' \
|
|
|
- '> {status} </span>.<BR>'.format(title=_("STATUS"),
|
|
|
- h_color='red',
|
|
|
- color='white',
|
|
|
- status=_("FAILED"))
|
|
|
- if 'Failed' in el[1][0]['dia']:
|
|
|
- point_txt = el[1][0]['dia']
|
|
|
- else:
|
|
|
- for pt in el[1][0]['dia']:
|
|
|
- point_txt += '%.*f' % (self.decimals, float(pt))
|
|
|
- point_txt += ', '
|
|
|
- txt += 'Violations: %s<BR>' % str(point_txt)
|
|
|
- else:
|
|
|
- txt += '{title}: <span style="color:{color};background-color:{h_color}"' \
|
|
|
- '> {status} </span>.<BR>'.format(title=_("STATUS"),
|
|
|
- h_color='green',
|
|
|
- color='white',
|
|
|
- status=_("PASSED"))
|
|
|
- txt += '%s<BR>' % _("Violations: There are no violations for the current rule.")
|
|
|
- except KeyError:
|
|
|
- pass
|
|
|
+ for cb in cb_items:
|
|
|
+ if state:
|
|
|
+ cb.setChecked(True)
|
|
|
+ else:
|
|
|
+ cb.setChecked(False)
|
|
|
|
|
|
- txt += '<BR><BR>'
|
|
|
- new_obj.source_file = txt
|
|
|
- new_obj.read_only = True
|
|
|
+ def on_all_objects_cb_changed(self, state):
|
|
|
+ cb_items = [self.grid_layout.itemAt(i).widget() for i in range(self.grid_layout.count())
|
|
|
+ if isinstance(self.grid_layout.itemAt(i).widget(), FCCheckBox)]
|
|
|
|
|
|
- self.app.app_obj.new_object('document', name='Rules_check_results', initialize=init, plot=False)
|
|
|
+ for cb in cb_items:
|
|
|
+ if state:
|
|
|
+ cb.setChecked(True)
|
|
|
+ else:
|
|
|
+ cb.setChecked(False)
|
|
|
|
|
|
- def reset_fields(self):
|
|
|
- # self.object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- # self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
- pass
|
|
|
+ def confirmation_message(self, accepted, minval, maxval):
|
|
|
+ if accepted is False:
|
|
|
+ self.app.inform[str, bool].emit('[WARNING_NOTCL] %s: [%.*f, %.*f]' % (_("Edited value is out of range"),
|
|
|
+ self.decimals,
|
|
|
+ minval,
|
|
|
+ self.decimals,
|
|
|
+ maxval), False)
|
|
|
+ else:
|
|
|
+ self.app.inform[str, bool].emit('[success] %s' % _("Edited value is within limits."), False)
|
|
|
+
|
|
|
+ def confirmation_message_int(self, accepted, minval, maxval):
|
|
|
+ if accepted is False:
|
|
|
+ self.app.inform[str, bool].emit('[WARNING_NOTCL] %s: [%d, %d]' %
|
|
|
+ (_("Edited value is out of range"), minval, maxval), False)
|
|
|
+ else:
|
|
|
+ self.app.inform[str, bool].emit('[success] %s' % _("Edited value is within limits."), False)
|