GerberOptPrefGroupUI.py 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. from PyQt5 import QtWidgets
  2. from flatcamGUI.GUIElements import FCDoubleSpinner, FCSpinner, RadioSet, FCCheckBox
  3. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
  4. class GerberOptPrefGroupUI(OptionsGroupUI):
  5. def __init__(self, decimals=4, parent=None):
  6. # OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
  7. super(GerberOptPrefGroupUI, self).__init__(self)
  8. self.decimals = decimals
  9. self.setTitle(str(_("Gerber Options")))
  10. # ## Isolation Routing
  11. self.isolation_routing_label = QtWidgets.QLabel("<b>%s:</b>" % _("Isolation Routing"))
  12. self.isolation_routing_label.setToolTip(
  13. _("Create a Geometry object with\n"
  14. "toolpaths to cut outside polygons.")
  15. )
  16. self.layout.addWidget(self.isolation_routing_label)
  17. # Cutting Tool Diameter
  18. grid0 = QtWidgets.QGridLayout()
  19. self.layout.addLayout(grid0)
  20. tdlabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
  21. tdlabel.setToolTip(
  22. _("Diameter of the cutting tool.")
  23. )
  24. grid0.addWidget(tdlabel, 0, 0)
  25. self.iso_tool_dia_entry = FCDoubleSpinner()
  26. self.iso_tool_dia_entry.set_precision(self.decimals)
  27. self.iso_tool_dia_entry.setSingleStep(0.1)
  28. self.iso_tool_dia_entry.set_range(-9999, 9999)
  29. grid0.addWidget(self.iso_tool_dia_entry, 0, 1)
  30. # Nr of passes
  31. passlabel = QtWidgets.QLabel('%s:' % _('# Passes'))
  32. passlabel.setToolTip(
  33. _("Width of the isolation gap in\n"
  34. "number (integer) of tool widths.")
  35. )
  36. self.iso_width_entry = FCSpinner()
  37. self.iso_width_entry.set_range(1, 999)
  38. grid0.addWidget(passlabel, 1, 0)
  39. grid0.addWidget(self.iso_width_entry, 1, 1)
  40. # Pass overlap
  41. overlabel = QtWidgets.QLabel('%s:' % _('Pass overlap'))
  42. overlabel.setToolTip(
  43. _("How much (percentage) of the tool width to overlap each tool pass.")
  44. )
  45. self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
  46. self.iso_overlap_entry.set_precision(self.decimals)
  47. self.iso_overlap_entry.setWrapping(True)
  48. self.iso_overlap_entry.setRange(0.0000, 99.9999)
  49. self.iso_overlap_entry.setSingleStep(0.1)
  50. grid0.addWidget(overlabel, 2, 0)
  51. grid0.addWidget(self.iso_overlap_entry, 2, 1)
  52. # Isolation Scope
  53. self.iso_scope_label = QtWidgets.QLabel('%s:' % _('Scope'))
  54. self.iso_scope_label.setToolTip(
  55. _("Isolation scope. Choose what to isolate:\n"
  56. "- 'All' -> Isolate all the polygons in the object\n"
  57. "- 'Selection' -> Isolate a selection of polygons.")
  58. )
  59. self.iso_scope_radio = RadioSet([{'label': _('All'), 'value': 'all'},
  60. {'label': _('Selection'), 'value': 'single'}])
  61. grid0.addWidget(self.iso_scope_label, 3, 0)
  62. grid0.addWidget(self.iso_scope_radio, 3, 1, 1, 2)
  63. # Milling Type
  64. milling_type_label = QtWidgets.QLabel('%s:' % _('Milling Type'))
  65. milling_type_label.setToolTip(
  66. _("Milling type:\n"
  67. "- climb / best for precision milling and to reduce tool usage\n"
  68. "- conventional / useful when there is no backlash compensation")
  69. )
  70. grid0.addWidget(milling_type_label, 4, 0)
  71. self.milling_type_radio = RadioSet([{'label': _('Climb'), 'value': 'cl'},
  72. {'label': _('Conventional'), 'value': 'cv'}])
  73. grid0.addWidget(self.milling_type_radio, 4, 1)
  74. # Combine passes
  75. self.combine_passes_cb = FCCheckBox(label=_('Combine Passes'))
  76. self.combine_passes_cb.setToolTip(
  77. _("Combine all passes into one object")
  78. )
  79. grid0.addWidget(self.combine_passes_cb, 5, 0, 1, 2)
  80. separator_line = QtWidgets.QFrame()
  81. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  82. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  83. grid0.addWidget(separator_line, 6, 0, 1, 2)
  84. # ## Clear non-copper regions
  85. self.clearcopper_label = QtWidgets.QLabel("<b>%s:</b>" % _("Non-copper regions"))
  86. self.clearcopper_label.setToolTip(
  87. _("Create polygons covering the\n"
  88. "areas without copper on the PCB.\n"
  89. "Equivalent to the inverse of this\n"
  90. "object. Can be used to remove all\n"
  91. "copper from a specified region.")
  92. )
  93. self.layout.addWidget(self.clearcopper_label)
  94. grid1 = QtWidgets.QGridLayout()
  95. self.layout.addLayout(grid1)
  96. # Margin
  97. bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  98. bmlabel.setToolTip(
  99. _("Specify the edge of the PCB\n"
  100. "by drawing a box around all\n"
  101. "objects with this minimum\n"
  102. "distance.")
  103. )
  104. grid1.addWidget(bmlabel, 0, 0)
  105. self.noncopper_margin_entry = FCDoubleSpinner()
  106. self.noncopper_margin_entry.set_precision(self.decimals)
  107. self.noncopper_margin_entry.setSingleStep(0.1)
  108. self.noncopper_margin_entry.set_range(-9999, 9999)
  109. grid1.addWidget(self.noncopper_margin_entry, 0, 1)
  110. # Rounded corners
  111. self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
  112. self.noncopper_rounded_cb.setToolTip(
  113. _("Resulting geometry will have rounded corners.")
  114. )
  115. grid1.addWidget(self.noncopper_rounded_cb, 1, 0, 1, 2)
  116. separator_line = QtWidgets.QFrame()
  117. separator_line.setFrameShape(QtWidgets.QFrame.HLine)
  118. separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
  119. grid1.addWidget(separator_line, 2, 0, 1, 2)
  120. # ## Bounding box
  121. self.boundingbox_label = QtWidgets.QLabel('<b>%s:</b>' % _('Bounding Box'))
  122. self.layout.addWidget(self.boundingbox_label)
  123. grid2 = QtWidgets.QGridLayout()
  124. self.layout.addLayout(grid2)
  125. bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
  126. bbmargin.setToolTip(
  127. _("Distance of the edges of the box\n"
  128. "to the nearest polygon.")
  129. )
  130. self.bbmargin_entry = FCDoubleSpinner()
  131. self.bbmargin_entry.set_precision(self.decimals)
  132. self.bbmargin_entry.setSingleStep(0.1)
  133. self.bbmargin_entry.set_range(-9999, 9999)
  134. grid2.addWidget(bbmargin, 0, 0)
  135. grid2.addWidget(self.bbmargin_entry, 0, 1)
  136. self.bbrounded_cb = FCCheckBox(label='%s' % _("Rounded Geo"))
  137. self.bbrounded_cb.setToolTip(
  138. _("If the bounding box is \n"
  139. "to have rounded corners\n"
  140. "their radius is equal to\n"
  141. "the margin.")
  142. )
  143. grid2.addWidget(self.bbrounded_cb, 1, 0, 1, 2)
  144. self.layout.addStretch()