ToolDblSided.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. from PyQt5 import QtGui
  2. from GUIElements import RadioSet, EvalEntry, LengthEntry
  3. from FlatCAMTool import FlatCAMTool
  4. from FlatCAMObj import *
  5. from shapely.geometry import Point
  6. from shapely import affinity
  7. from PyQt5 import QtCore
  8. import gettext
  9. import FlatCAMTranslation as fcTranslate
  10. fcTranslate.apply_language('ToolDblSided')
  11. import builtins
  12. if '_' not in builtins.__dict__:
  13. _ = gettext.gettext
  14. class DblSidedTool(FlatCAMTool):
  15. toolName = _("2-Sided PCB")
  16. def __init__(self, app):
  17. FlatCAMTool.__init__(self, app)
  18. ## Title
  19. title_label = QtWidgets.QLabel("%s" % self.toolName)
  20. title_label.setStyleSheet("""
  21. QLabel
  22. {
  23. font-size: 16px;
  24. font-weight: bold;
  25. }
  26. """)
  27. self.layout.addWidget(title_label)
  28. self.empty_lb = QtWidgets.QLabel("")
  29. self.layout.addWidget(self.empty_lb)
  30. ## Grid Layout
  31. grid_lay = QtWidgets.QGridLayout()
  32. self.layout.addLayout(grid_lay)
  33. ## Gerber Object to mirror
  34. self.gerber_object_combo = QtWidgets.QComboBox()
  35. self.gerber_object_combo.setModel(self.app.collection)
  36. self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  37. self.gerber_object_combo.setCurrentIndex(1)
  38. self.botlay_label = QtWidgets.QLabel("<b>GERBER:</b>")
  39. self.botlay_label.setToolTip(
  40. "Gerber to be mirrored."
  41. )
  42. self.mirror_gerber_button = QtWidgets.QPushButton(_("Mirror"))
  43. self.mirror_gerber_button.setToolTip(
  44. _("Mirrors (flips) the specified object around \n"
  45. "the specified axis. Does not create a new \n"
  46. "object, but modifies it.")
  47. )
  48. self.mirror_gerber_button.setFixedWidth(40)
  49. # grid_lay.addRow("Bottom Layer:", self.object_combo)
  50. grid_lay.addWidget(self.botlay_label, 0, 0)
  51. grid_lay.addWidget(self.gerber_object_combo, 1, 0, 1, 2)
  52. grid_lay.addWidget(self.mirror_gerber_button, 1, 3)
  53. ## Excellon Object to mirror
  54. self.exc_object_combo = QtWidgets.QComboBox()
  55. self.exc_object_combo.setModel(self.app.collection)
  56. self.exc_object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
  57. self.exc_object_combo.setCurrentIndex(1)
  58. self.excobj_label = QtWidgets.QLabel("<b>EXCELLON:</b>")
  59. self.excobj_label.setToolTip(
  60. _("Excellon Object to be mirrored.")
  61. )
  62. self.mirror_exc_button = QtWidgets.QPushButton(_("Mirror"))
  63. self.mirror_exc_button.setToolTip(
  64. _("Mirrors (flips) the specified object around \n"
  65. "the specified axis. Does not create a new \n"
  66. "object, but modifies it.")
  67. )
  68. self.mirror_exc_button.setFixedWidth(40)
  69. # grid_lay.addRow("Bottom Layer:", self.object_combo)
  70. grid_lay.addWidget(self.excobj_label, 2, 0)
  71. grid_lay.addWidget(self.exc_object_combo, 3, 0, 1, 2)
  72. grid_lay.addWidget(self.mirror_exc_button, 3, 3)
  73. ## Geometry Object to mirror
  74. self.geo_object_combo = QtWidgets.QComboBox()
  75. self.geo_object_combo.setModel(self.app.collection)
  76. self.geo_object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
  77. self.geo_object_combo.setCurrentIndex(1)
  78. self.geoobj_label = QtWidgets.QLabel("<b>GEOMETRY</b>:")
  79. self.geoobj_label.setToolTip(
  80. _("Geometry Obj to be mirrored.")
  81. )
  82. self.mirror_geo_button = QtWidgets.QPushButton(_("Mirror"))
  83. self.mirror_geo_button.setToolTip(
  84. _("Mirrors (flips) the specified object around \n"
  85. "the specified axis. Does not create a new \n"
  86. "object, but modifies it.")
  87. )
  88. self.mirror_geo_button.setFixedWidth(40)
  89. # grid_lay.addRow("Bottom Layer:", self.object_combo)
  90. grid_lay.addWidget(self.geoobj_label, 4, 0)
  91. grid_lay.addWidget(self.geo_object_combo, 5, 0, 1, 2)
  92. grid_lay.addWidget(self.mirror_geo_button, 5, 3)
  93. ## Axis
  94. self.mirror_axis = RadioSet([{'label': 'X', 'value': 'X'},
  95. {'label': 'Y', 'value': 'Y'}])
  96. self.mirax_label = QtWidgets.QLabel(_("Mirror Axis:"))
  97. self.mirax_label.setToolTip(
  98. _("Mirror vertically (X) or horizontally (Y).")
  99. )
  100. # grid_lay.addRow("Mirror Axis:", self.mirror_axis)
  101. self.empty_lb1 = QtWidgets.QLabel("")
  102. grid_lay.addWidget(self.empty_lb1, 6, 0)
  103. grid_lay.addWidget(self.mirax_label, 7, 0)
  104. grid_lay.addWidget(self.mirror_axis, 7, 1)
  105. ## Axis Location
  106. self.axis_location = RadioSet([{'label': 'Point', 'value': 'point'},
  107. {'label': 'Box', 'value': 'box'}])
  108. self.axloc_label = QtWidgets.QLabel(_("Axis Ref:"))
  109. self.axloc_label.setToolTip(
  110. _("The axis should pass through a <b>point</b> or cut\n "
  111. "a specified <b>box</b> (in a FlatCAM object) through \n"
  112. "the center.")
  113. )
  114. # grid_lay.addRow("Axis Location:", self.axis_location)
  115. grid_lay.addWidget(self.axloc_label, 8, 0)
  116. grid_lay.addWidget(self.axis_location, 8, 1)
  117. self.empty_lb2 = QtWidgets.QLabel("")
  118. grid_lay.addWidget(self.empty_lb2, 9, 0)
  119. ## Point/Box
  120. self.point_box_container = QtWidgets.QVBoxLayout()
  121. self.pb_label = QtWidgets.QLabel("<b>%s</b>" % _('Point/Box Reference:'))
  122. self.pb_label.setToolTip(
  123. _("If 'Point' is selected above it store the coordinates (x, y) through which\n"
  124. "the mirroring axis passes.\n"
  125. "If 'Box' is selected above, select here a FlatCAM object (Gerber, Exc or Geo).\n"
  126. "Through the center of this object pass the mirroring axis selected above.")
  127. )
  128. self.add_point_button = QtWidgets.QPushButton(_("Add"))
  129. self.add_point_button.setToolTip(
  130. _("Add the coordinates in format <b>(x, y)</b> through which the mirroring axis \n "
  131. "selected in 'MIRROR AXIS' pass.\n"
  132. "The (x, y) coordinates are captured by pressing SHIFT key\n"
  133. "and left mouse button click on canvas or you can enter the coords manually.")
  134. )
  135. self.add_point_button.setFixedWidth(40)
  136. grid_lay.addWidget(self.pb_label, 10, 0)
  137. grid_lay.addLayout(self.point_box_container, 11, 0, 1, 3)
  138. grid_lay.addWidget(self.add_point_button, 11, 3)
  139. self.point_entry = EvalEntry()
  140. self.point_box_container.addWidget(self.point_entry)
  141. self.box_combo = QtWidgets.QComboBox()
  142. self.box_combo.setModel(self.app.collection)
  143. self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  144. self.box_combo.setCurrentIndex(1)
  145. self.box_combo_type = QtWidgets.QComboBox()
  146. self.box_combo_type.addItem(_("Gerber Reference Box Object"))
  147. self.box_combo_type.addItem(_("Excellon Reference Box Object"))
  148. self.box_combo_type.addItem(_("Geometry Reference Box Object"))
  149. self.point_box_container.addWidget(self.box_combo_type)
  150. self.point_box_container.addWidget(self.box_combo)
  151. self.box_combo.hide()
  152. self.box_combo_type.hide()
  153. ## Alignment holes
  154. self.ah_label = QtWidgets.QLabel("<b%s</b>" % _('>Alignment Drill Coordinates:'))
  155. self.ah_label.setToolTip(
  156. _( "Alignment holes (x1, y1), (x2, y2), ... "
  157. "on one side of the mirror axis. For each set of (x, y) coordinates\n"
  158. "entered here, a pair of drills will be created:\n\n"
  159. "- one drill at the coordinates from the field\n"
  160. "- one drill in mirror position over the axis selected above in the 'Mirror Axis'.")
  161. )
  162. self.layout.addWidget(self.ah_label)
  163. grid_lay1 = QtWidgets.QGridLayout()
  164. self.layout.addLayout(grid_lay1)
  165. self.alignment_holes = EvalEntry()
  166. self.add_drill_point_button = QtWidgets.QPushButton(_("Add"))
  167. self.add_drill_point_button.setToolTip(
  168. _("Add alignment drill holes coords in the format: (x1, y1), (x2, y2), ... \n"
  169. "on one side of the mirror axis.\n\n"
  170. "The coordinates set can be obtained:\n"
  171. "- press SHIFT key and left mouse clicking on canvas. Then click Add.\n"
  172. "- press SHIFT key and left mouse clicking on canvas. Then CTRL+V in the field.\n"
  173. "- press SHIFT key and left mouse clicking on canvas. Then RMB click in the field and click Paste.\n"
  174. "- by entering the coords manually in the format: (x1, y1), (x2, y2), ...")
  175. )
  176. self.add_drill_point_button.setFixedWidth(40)
  177. grid_lay1.addWidget(self.alignment_holes, 0, 0, 1, 2)
  178. grid_lay1.addWidget(self.add_drill_point_button, 0, 3)
  179. ## Drill diameter for alignment holes
  180. self.dt_label = QtWidgets.QLabel("<b>%s</b>:" % _('Alignment Drill Diameter'))
  181. self.dt_label.setToolTip(
  182. _("Diameter of the drill for the "
  183. "alignment holes.")
  184. )
  185. self.layout.addWidget(self.dt_label)
  186. grid_lay2 = QtWidgets.QGridLayout()
  187. self.layout.addLayout(grid_lay2)
  188. self.drill_dia = FCEntry()
  189. self.dd_label = QtWidgets.QLabel(_("Drill diam.:"))
  190. self.dd_label.setToolTip(
  191. _("Diameter of the drill for the "
  192. "alignment holes.")
  193. )
  194. grid_lay2.addWidget(self.dd_label, 0, 0)
  195. grid_lay2.addWidget(self.drill_dia, 0, 1)
  196. ## Buttons
  197. self.create_alignment_hole_button = QtWidgets.QPushButton(_("Create Excellon Object"))
  198. self.create_alignment_hole_button.setToolTip(
  199. _("Creates an Excellon Object containing the\n"
  200. "specified alignment holes and their mirror\n"
  201. "images.")
  202. )
  203. # self.create_alignment_hole_button.setFixedWidth(40)
  204. grid_lay2.addWidget(self.create_alignment_hole_button, 1,0, 1, 2)
  205. self.reset_button = QtWidgets.QPushButton(_("Reset"))
  206. self.reset_button.setToolTip(
  207. _("Resets all the fields.")
  208. )
  209. self.reset_button.setFixedWidth(40)
  210. grid_lay2.addWidget(self.reset_button, 1, 2)
  211. self.layout.addStretch()
  212. ## Signals
  213. self.create_alignment_hole_button.clicked.connect(self.on_create_alignment_holes)
  214. self.mirror_gerber_button.clicked.connect(self.on_mirror_gerber)
  215. self.mirror_exc_button.clicked.connect(self.on_mirror_exc)
  216. self.mirror_geo_button.clicked.connect(self.on_mirror_geo)
  217. self.add_point_button.clicked.connect(self.on_point_add)
  218. self.add_drill_point_button.clicked.connect(self.on_drill_add)
  219. self.reset_button.clicked.connect(self.reset_fields)
  220. self.box_combo_type.currentIndexChanged.connect(self.on_combo_box_type)
  221. self.axis_location.group_toggle_fn = self.on_toggle_pointbox
  222. self.drill_values = ""
  223. def install(self, icon=None, separator=None, **kwargs):
  224. FlatCAMTool.install(self, icon, separator, shortcut='ALT+D', **kwargs)
  225. def run(self, toggle=True):
  226. self.app.report_usage("Tool2Sided()")
  227. FlatCAMTool.run(self, toggle=toggle)
  228. self.set_tool_ui()
  229. self.app.ui.notebook.setTabText(2, _("2-Sided Tool"))
  230. def set_tool_ui(self):
  231. self.reset_fields()
  232. self.point_entry.set_value("")
  233. self.alignment_holes.set_value("")
  234. self.mirror_axis.set_value(self.app.defaults["tools_2sided_mirror_axis"])
  235. self.axis_location.set_value(self.app.defaults["tools_2sided_axis_loc"])
  236. self.drill_dia.set_value(self.app.defaults["tools_2sided_drilldia"])
  237. def on_combo_box_type(self):
  238. obj_type = self.box_combo_type.currentIndex()
  239. self.box_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
  240. self.box_combo.setCurrentIndex(0)
  241. def on_create_alignment_holes(self):
  242. axis = self.mirror_axis.get_value()
  243. mode = self.axis_location.get_value()
  244. if mode == "point":
  245. try:
  246. px, py = self.point_entry.get_value()
  247. except TypeError:
  248. self.app.inform.emit(_("[WARNING_NOTCL] 'Point' reference is selected and 'Point' coordinates "
  249. "are missing. Add them and retry."))
  250. return
  251. else:
  252. selection_index = self.box_combo.currentIndex()
  253. model_index = self.app.collection.index(selection_index, 0, self.gerber_object_combo.rootModelIndex())
  254. try:
  255. bb_obj = model_index.internalPointer().obj
  256. except AttributeError:
  257. model_index = self.app.collection.index(selection_index, 0, self.exc_object_combo.rootModelIndex())
  258. try:
  259. bb_obj = model_index.internalPointer().obj
  260. except AttributeError:
  261. model_index = self.app.collection.index(selection_index, 0,
  262. self.geo_object_combo.rootModelIndex())
  263. try:
  264. bb_obj = model_index.internalPointer().obj
  265. except AttributeError:
  266. self.app.inform.emit(
  267. _("[WARNING_NOTCL] There is no Box reference object loaded. Load one and retry."))
  268. return
  269. xmin, ymin, xmax, ymax = bb_obj.bounds()
  270. px = 0.5 * (xmin + xmax)
  271. py = 0.5 * (ymin + ymax)
  272. xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis]
  273. try:
  274. dia = float(self.drill_dia.get_value())
  275. except ValueError:
  276. # try to convert comma to decimal point. if it's still not working error message and return
  277. try:
  278. dia = float(self.drill_dia.get_value().replace(',', '.'))
  279. self.drill_dia.set_value(dia)
  280. except ValueError:
  281. self.app.inform.emit(_("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
  282. "Add it and retry."))
  283. return
  284. if dia is '':
  285. self.app.inform.emit(_("[WARNING_NOTCL]No value or wrong format in Drill Dia entry. Add it and retry."))
  286. return
  287. tools = {"1": {"C": dia}}
  288. # holes = self.alignment_holes.get_value()
  289. holes = eval('[{}]'.format(self.alignment_holes.text()))
  290. if not holes:
  291. self.app.inform.emit(_("[WARNING_NOTCL] There are no Alignment Drill Coordinates to use. Add them and retry."))
  292. return
  293. drills = []
  294. for hole in holes:
  295. point = Point(hole)
  296. point_mirror = affinity.scale(point, xscale, yscale, origin=(px, py))
  297. drills.append({"point": point, "tool": "1"})
  298. drills.append({"point": point_mirror, "tool": "1"})
  299. if 'solid_geometry' not in tools:
  300. tools["1"]['solid_geometry'] = []
  301. else:
  302. tools["1"]['solid_geometry'].append(point_mirror)
  303. def obj_init(obj_inst, app_inst):
  304. obj_inst.tools = tools
  305. obj_inst.drills = drills
  306. obj_inst.create_geometry()
  307. self.app.new_object("excellon", "Alignment Drills", obj_init)
  308. self.drill_values = ''
  309. self.app.inform.emit(_("[success] Excellon object with alignment drills created..."))
  310. def on_mirror_gerber(self):
  311. selection_index = self.gerber_object_combo.currentIndex()
  312. # fcobj = self.app.collection.object_list[selection_index]
  313. model_index = self.app.collection.index(selection_index, 0, self.gerber_object_combo.rootModelIndex())
  314. try:
  315. fcobj = model_index.internalPointer().obj
  316. except Exception as e:
  317. self.app.inform.emit(_("[WARNING_NOTCL] There is no Gerber object loaded ..."))
  318. return
  319. if not isinstance(fcobj, FlatCAMGerber):
  320. self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
  321. return
  322. axis = self.mirror_axis.get_value()
  323. mode = self.axis_location.get_value()
  324. if mode == "point":
  325. try:
  326. px, py = self.point_entry.get_value()
  327. except TypeError:
  328. self.app.inform.emit(_("[WARNING_NOTCL] 'Point' coordinates missing. "
  329. "Using Origin (0, 0) as mirroring reference."))
  330. px, py = (0, 0)
  331. else:
  332. selection_index_box = self.box_combo.currentIndex()
  333. model_index_box = self.app.collection.index(selection_index_box, 0, self.box_combo.rootModelIndex())
  334. try:
  335. bb_obj = model_index_box.internalPointer().obj
  336. except Exception as e:
  337. self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
  338. return
  339. xmin, ymin, xmax, ymax = bb_obj.bounds()
  340. px = 0.5 * (xmin + xmax)
  341. py = 0.5 * (ymin + ymax)
  342. fcobj.mirror(axis, [px, py])
  343. self.app.object_changed.emit(fcobj)
  344. fcobj.plot()
  345. self.app.inform.emit(_("[success] Gerber %s was mirrored...") % str(fcobj.options['name']))
  346. def on_mirror_exc(self):
  347. selection_index = self.exc_object_combo.currentIndex()
  348. # fcobj = self.app.collection.object_list[selection_index]
  349. model_index = self.app.collection.index(selection_index, 0, self.exc_object_combo.rootModelIndex())
  350. try:
  351. fcobj = model_index.internalPointer().obj
  352. except Exception as e:
  353. self.app.inform.emit(_("[WARNING_NOTCL] There is no Excellon object loaded ..."))
  354. return
  355. if not isinstance(fcobj, FlatCAMExcellon):
  356. self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
  357. return
  358. axis = self.mirror_axis.get_value()
  359. mode = self.axis_location.get_value()
  360. if mode == "point":
  361. try:
  362. px, py = self.point_entry.get_value()
  363. except Exception as e:
  364. log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e))
  365. self.app.inform.emit(_("[WARNING_NOTCL] There are no Point coordinates in the Point field. "
  366. "Add coords and try again ..."))
  367. return
  368. else:
  369. selection_index_box = self.box_combo.currentIndex()
  370. model_index_box = self.app.collection.index(selection_index_box, 0, self.box_combo.rootModelIndex())
  371. try:
  372. bb_obj = model_index_box.internalPointer().obj
  373. except Exception as e:
  374. log.debug("DblSidedTool.on_mirror_geo() --> %s" % str(e))
  375. self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
  376. return
  377. xmin, ymin, xmax, ymax = bb_obj.bounds()
  378. px = 0.5 * (xmin + xmax)
  379. py = 0.5 * (ymin + ymax)
  380. fcobj.mirror(axis, [px, py])
  381. self.app.object_changed.emit(fcobj)
  382. fcobj.plot()
  383. self.app.inform.emit(_("[success] Excellon %s was mirrored...") % str(fcobj.options['name']))
  384. def on_mirror_geo(self):
  385. selection_index = self.geo_object_combo.currentIndex()
  386. # fcobj = self.app.collection.object_list[selection_index]
  387. model_index = self.app.collection.index(selection_index, 0, self.geo_object_combo.rootModelIndex())
  388. try:
  389. fcobj = model_index.internalPointer().obj
  390. except Exception as e:
  391. self.app.inform.emit(_("[WARNING_NOTCL] There is no Geometry object loaded ..."))
  392. return
  393. if not isinstance(fcobj, FlatCAMGeometry):
  394. self.app.inform.emit(_("[ERROR_NOTCL] Only Gerber, Excellon and Geometry objects can be mirrored."))
  395. return
  396. axis = self.mirror_axis.get_value()
  397. mode = self.axis_location.get_value()
  398. if mode == "point":
  399. px, py = self.point_entry.get_value()
  400. else:
  401. selection_index_box = self.box_combo.currentIndex()
  402. model_index_box = self.app.collection.index(selection_index_box, 0, self.box_combo.rootModelIndex())
  403. try:
  404. bb_obj = model_index_box.internalPointer().obj
  405. except Exception as e:
  406. self.app.inform.emit(_("[WARNING_NOTCL] There is no Box object loaded ..."))
  407. return
  408. xmin, ymin, xmax, ymax = bb_obj.bounds()
  409. px = 0.5 * (xmin + xmax)
  410. py = 0.5 * (ymin + ymax)
  411. fcobj.mirror(axis, [px, py])
  412. self.app.object_changed.emit(fcobj)
  413. fcobj.plot()
  414. self.app.inform.emit(_("[success] Geometry %s was mirrored...") % str(fcobj.options['name']))
  415. def on_point_add(self):
  416. val = self.app.defaults["global_point_clipboard_format"] % (self.app.pos[0], self.app.pos[1])
  417. self.point_entry.set_value(val)
  418. def on_drill_add(self):
  419. self.drill_values += (self.app.defaults["global_point_clipboard_format"] %
  420. (self.app.pos[0], self.app.pos[1])) + ','
  421. self.alignment_holes.set_value(self.drill_values)
  422. def on_toggle_pointbox(self):
  423. if self.axis_location.get_value() == "point":
  424. self.point_entry.show()
  425. self.box_combo.hide()
  426. self.box_combo_type.hide()
  427. self.add_point_button.setDisabled(False)
  428. else:
  429. self.point_entry.hide()
  430. self.box_combo.show()
  431. self.box_combo_type.show()
  432. self.add_point_button.setDisabled(True)
  433. def reset_fields(self):
  434. self.gerber_object_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  435. self.exc_object_combo.setRootModelIndex(self.app.collection.index(1, 0, QtCore.QModelIndex()))
  436. self.geo_object_combo.setRootModelIndex(self.app.collection.index(2, 0, QtCore.QModelIndex()))
  437. self.box_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
  438. self.gerber_object_combo.setCurrentIndex(0)
  439. self.exc_object_combo.setCurrentIndex(0)
  440. self.geo_object_combo.setCurrentIndex(0)
  441. self.box_combo.setCurrentIndex(0)
  442. self.box_combo_type.setCurrentIndex(0)
  443. self.drill_values = ""