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