GerberOptPrefGroupUI.py 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. from flatcamGUI.preferences.OptionUI import *
  2. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
  3. import gettext
  4. import FlatCAMTranslation as fcTranslate
  5. import builtins
  6. fcTranslate.apply_language('strings')
  7. if '_' not in builtins.__dict__:
  8. _ = gettext.gettext
  9. class GerberOptPrefGroupUI(OptionsGroupUI2):
  10. def __init__(self, decimals=4, **kwargs):
  11. self.decimals = decimals
  12. super().__init__(**kwargs)
  13. self.setTitle(str(_("Gerber Options")))
  14. def build_options(self) -> [OptionUI]:
  15. return [
  16. HeadingOptionUI(
  17. label_text="Isolation Routing",
  18. label_tooltip="Create a Geometry object with\n"
  19. "toolpaths to cut outside polygons."
  20. ),
  21. DoubleSpinnerOptionUI(
  22. option="gerber_isotooldia",
  23. label_text="Tool dia",
  24. label_tooltip="Diameter of the cutting tool.",
  25. min_value=0.0, max_value=9999.9, step=0.1, decimals=self.decimals
  26. ),
  27. SpinnerOptionUI(
  28. option="gerber_isopasses",
  29. label_text="# Passes",
  30. label_tooltip="Width of the isolation gap in\n"
  31. "number (integer) of tool widths.",
  32. min_value=1, max_value=999, step=1
  33. ),
  34. DoubleSpinnerOptionUI(
  35. option="gerber_isooverlap",
  36. label_text="Pass overlap",
  37. label_tooltip="How much (percentage) of the tool width to overlap each tool pass.",
  38. min_value=0.0, max_value=99.9999, step=0.1, decimals=self.decimals, suffix="%"
  39. ),
  40. RadioSetOptionUI(
  41. option="gerber_iso_scope",
  42. label_text="Scope",
  43. label_tooltip="Isolation scope. Choose what to isolate:\n"
  44. "- 'All' -> Isolate all the polygons in the object\n"
  45. "- 'Selection' -> Isolate a selection of polygons.",
  46. choices=[{'label': _('All'), 'value': 'all'},
  47. {'label': _('Selection'), 'value': 'single'}]
  48. ),
  49. RadioSetOptionUI(
  50. option="gerber_milling_type",
  51. label_text="Milling Type",
  52. label_tooltip="Milling type:\n"
  53. "- climb / best for precision milling and to reduce tool usage\n"
  54. "- conventional / useful when there is no backlash compensation",
  55. choices=[{'label': _('Climb'), 'value': 'cl'},
  56. {'label': _('Conventional'), 'value': 'cv'}]
  57. ),
  58. CheckboxOptionUI(
  59. option="gerber_combine_passes",
  60. label_text="Combine Passes",
  61. label_tooltip="Combine all passes into one object"
  62. ),
  63. SeparatorOptionUI(),
  64. HeadingOptionUI(
  65. label_text="Non-copper regions",
  66. label_tooltip="Create polygons covering the\n"
  67. "areas without copper on the PCB.\n"
  68. "Equivalent to the inverse of this\n"
  69. "object. Can be used to remove all\n"
  70. "copper from a specified region."
  71. ),
  72. DoubleSpinnerOptionUI(
  73. option="gerber_noncoppermargin",
  74. label_text="Boundary Margin",
  75. label_tooltip="Specify the edge of the PCB\n"
  76. "by drawing a box around all\n"
  77. "objects with this minimum\n"
  78. "distance.",
  79. min_value=-9999, max_value=9999, step=0.1, decimals=self.decimals
  80. ),
  81. CheckboxOptionUI(
  82. option="gerber_noncopperrounded",
  83. label_text="Rounded Geo",
  84. label_tooltip="Resulting geometry will have rounded corners."
  85. ),
  86. SeparatorOptionUI(),
  87. HeadingOptionUI(label_text="Bounding Box"),
  88. DoubleSpinnerOptionUI(
  89. option="gerber_bboxmargin",
  90. label_text="Boundary Margin",
  91. label_tooltip="Distance of the edges of the box\n"
  92. "to the nearest polygon.",
  93. min_value=-9999, max_value=9999, step=0.1, decimals=self.decimals
  94. ),
  95. CheckboxOptionUI(
  96. option="gerber_bboxrounded",
  97. label_text="Rounded Geo",
  98. label_tooltip="If the bounding box is \n"
  99. "to have rounded corners\n"
  100. "their radius is equal to\n"
  101. "the margin."
  102. ),
  103. ]