GeometryOptPrefGroupUI.py 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. from PyQt5.QtCore import QSettings
  2. from flatcamGUI.GUIElements import OptionalInputSection
  3. from flatcamGUI.preferences import machinist_setting
  4. from flatcamGUI.preferences.OptionUI import *
  5. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI2
  6. import gettext
  7. import FlatCAMTranslation as fcTranslate
  8. import builtins
  9. fcTranslate.apply_language('strings')
  10. if '_' not in builtins.__dict__:
  11. _ = gettext.gettext
  12. settings = QSettings("Open Source", "FlatCAM")
  13. if settings.contains("machinist"):
  14. machinist_setting = settings.value('machinist', type=int)
  15. else:
  16. machinist_setting = 0
  17. class GeometryOptPrefGroupUI(OptionsGroupUI2):
  18. def __init__(self, decimals=4, **kwargs):
  19. self.decimals = decimals
  20. super().__init__(**kwargs)
  21. self.setTitle(str(_("Geometry Options")))
  22. self.pp_geometry_name_cb = self.option_dict()["geometry_ppname_g"].get_field()
  23. self.multidepth_cb = self.option_dict()["geometry_multidepth"].get_field()
  24. self.depthperpass_entry = self.option_dict()["geometry_depthperpass"].get_field()
  25. self.ois_multidepth = OptionalInputSection(self.multidepth_cb, [self.depthperpass_entry])
  26. self.dwell_cb = self.option_dict()["geometry_dwell"].get_field()
  27. self.dwelltime_entry = self.option_dict()["geometry_dwelltime"].get_field()
  28. self.ois_dwell = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
  29. def build_options(self) -> [OptionUI]:
  30. return [
  31. HeadingOptionUI(
  32. label_text="Create CNC Job",
  33. label_tooltip="Create a CNC Job object\n"
  34. "tracing the contours of this\n"
  35. "Geometry object."
  36. ),
  37. DoubleSpinnerOptionUI(
  38. option="geometry_cutz",
  39. label_text="Cut Z",
  40. label_tooltip="Cutting depth (negative)\n"
  41. "below the copper surface.",
  42. min_value=-9999.9999, max_value=(9999.999 if machinist_setting else 0.0),
  43. decimals=self.decimals, step=0.1
  44. ),
  45. CheckboxOptionUI(
  46. option="geometry_multidepth",
  47. label_text="Multi-Depth",
  48. label_tooltip="Use multiple passes to limit\n"
  49. "the cut depth in each pass. Will\n"
  50. "cut multiple times until Cut Z is\n"
  51. "reached."
  52. ),
  53. DoubleSpinnerOptionUI(
  54. option="geometry_depthperpass",
  55. label_text="Depth/Pass",
  56. label_tooltip="The depth to cut on each pass,\n"
  57. "when multidepth is enabled.\n"
  58. "It has positive value although\n"
  59. "it is a fraction from the depth\n"
  60. "which has negative value.",
  61. min_value=0, max_value=99999, step=0.1, decimals=self.decimals
  62. ),
  63. DoubleSpinnerOptionUI(
  64. option="geometry_travelz",
  65. label_text="Travel Z",
  66. label_tooltip="Height of the tool when\n"
  67. "moving without cutting.",
  68. min_value=(-9999.9999 if machinist_setting else 0.0001), max_value=9999.9999,
  69. step=0.1, decimals=self.decimals
  70. ),
  71. CheckboxOptionUI(
  72. option="geometry_toolchange",
  73. label_text="Tool change",
  74. label_tooltip="Include tool-change sequence\n"
  75. "in the Machine Code (Pause for tool change)."
  76. ),
  77. DoubleSpinnerOptionUI(
  78. option="geometry_toolchangez",
  79. label_text="Toolchange Z",
  80. label_tooltip="Z-axis position (height) for\n"
  81. "tool change.",
  82. min_value=(-9999.9999 if machinist_setting else 0.0), max_value=9999.9999,
  83. step=0.1, decimals=self.decimals
  84. ),
  85. DoubleSpinnerOptionUI(
  86. option="geometry_endz",
  87. label_text="End move Z",
  88. label_tooltip="Height of the tool after\n"
  89. "the last move at the end of the job.",
  90. min_value=(-9999.9999 if machinist_setting else 0.0), max_value=9999.9999,
  91. step=0.1, decimals=self.decimals
  92. ),
  93. LineEntryOptionUI(
  94. option="geometry_endxy",
  95. label_text="End move X,Y",
  96. label_tooltip="End move X,Y position. In format (x,y).\n"
  97. "If no value is entered then there is no move\n"
  98. "on X,Y plane at the end of the job."
  99. ),
  100. DoubleSpinnerOptionUI(
  101. option="geometry_feedrate",
  102. label_text="Feedrate X-Y",
  103. label_tooltip="Cutting speed in the XY\n"
  104. "plane in units per minute",
  105. min_value=0, max_value=99999.9999, step=0.1, decimals=self.decimals
  106. ),
  107. DoubleSpinnerOptionUI(
  108. option="geometry_feedrate_z",
  109. label_text="Feedrate Z",
  110. label_tooltip="Cutting speed in the XY\n"
  111. "plane in units per minute.\n"
  112. "It is called also Plunge.",
  113. min_value=0, max_value=99999.9999, step=0.1, decimals=self.decimals
  114. ),
  115. SpinnerOptionUI(
  116. option="geometry_spindlespeed",
  117. label_text="Spindle speed",
  118. label_tooltip="Speed of the spindle in RPM (optional).\n"
  119. "If LASER preprocessor is used,\n"
  120. "this value is the power of laser.",
  121. min_value=0, max_value=1000000, step=100
  122. ),
  123. CheckboxOptionUI(
  124. option="geometry_dwell",
  125. label_text="Enable Dwell",
  126. label_tooltip="Pause to allow the spindle to reach its\n"
  127. "speed before cutting."
  128. ),
  129. DoubleSpinnerOptionUI(
  130. option="geometry_dwelltime",
  131. label_text="Duration",
  132. label_tooltip="Number of time units for spindle to dwell.",
  133. min_value=0, max_value=999999, step=0.5, decimals=self.decimals
  134. ),
  135. ComboboxOptionUI(
  136. option="geometry_ppname_g",
  137. label_text="Preprocessor",
  138. label_tooltip="The Preprocessor file that dictates\n"
  139. "the Machine Code (like GCode, RML, HPGL) output.",
  140. choices=[] # Populated in App (FIXME)
  141. )
  142. ]