MachineSettingsPrinterTab.qml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import QtQuick.Layouts 1.3
  6. import UM 1.5 as UM
  7. import Cura 1.1 as Cura
  8. //
  9. // This the content in the "Printer" tab in the Machine Settings dialog.
  10. //
  11. Item
  12. {
  13. id: base
  14. UM.I18nCatalog { id: catalog; name: "cura" }
  15. property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0
  16. property int columnSpacing: 3 * screenScaleFactor
  17. property int propertyStoreIndex: manager ? manager.storeContainerIndex : 1 // definition_changes
  18. property int labelWidth: (columnWidth * 2 / 3 - UM.Theme.getSize("default_margin").width * 2) | 0
  19. property int controlWidth: (columnWidth / 3) | 0
  20. property var labelFont: UM.Theme.getFont("default")
  21. property string machineStackId: Cura.MachineManager.activeMachine.id
  22. property var forceUpdateFunction: manager.forceUpdate
  23. RowLayout
  24. {
  25. id: upperBlock
  26. anchors
  27. {
  28. top: parent.top
  29. left: parent.left
  30. right: parent.right
  31. margins: UM.Theme.getSize("default_margin").width
  32. }
  33. spacing: UM.Theme.getSize("default_margin").width
  34. // =======================================
  35. // Left-side column for "Printer Settings"
  36. // =======================================
  37. Column
  38. {
  39. Layout.fillWidth: true
  40. Layout.alignment: Qt.AlignTop
  41. spacing: base.columnSpacing
  42. UM.Label // Title Label
  43. {
  44. text: catalog.i18nc("@title:label", "Printer Settings")
  45. font: UM.Theme.getFont("medium_bold")
  46. width: parent.width
  47. elide: Text.ElideRight
  48. }
  49. Cura.NumericTextFieldWithUnit // "X (Width)"
  50. {
  51. id: machineXWidthField
  52. containerStackId: machineStackId
  53. settingKey: "machine_width"
  54. settingStoreIndex: propertyStoreIndex
  55. labelText: catalog.i18nc("@label", "X (Width)")
  56. labelFont: base.labelFont
  57. labelWidth: base.labelWidth
  58. controlWidth: base.controlWidth
  59. unitText: catalog.i18nc("@label", "mm")
  60. maximum: 2000000
  61. forceUpdateOnChangeFunction: forceUpdateFunction
  62. }
  63. Cura.NumericTextFieldWithUnit // "Y (Depth)"
  64. {
  65. id: machineYDepthField
  66. containerStackId: machineStackId
  67. settingKey: "machine_depth"
  68. settingStoreIndex: propertyStoreIndex
  69. labelText: catalog.i18nc("@label", "Y (Depth)")
  70. labelFont: base.labelFont
  71. labelWidth: base.labelWidth
  72. controlWidth: base.controlWidth
  73. unitText: catalog.i18nc("@label", "mm")
  74. maximum: 2000000
  75. forceUpdateOnChangeFunction: forceUpdateFunction
  76. }
  77. Cura.NumericTextFieldWithUnit // "Z (Height)"
  78. {
  79. id: machineZHeightField
  80. containerStackId: machineStackId
  81. settingKey: "machine_height"
  82. settingStoreIndex: propertyStoreIndex
  83. labelText: catalog.i18nc("@label", "Z (Height)")
  84. labelFont: base.labelFont
  85. labelWidth: base.labelWidth
  86. controlWidth: base.controlWidth
  87. unitText: catalog.i18nc("@label", "mm")
  88. forceUpdateOnChangeFunction: forceUpdateFunction
  89. }
  90. Cura.ComboBoxWithOptions // "Build plate shape"
  91. {
  92. id: buildPlateShapeComboBox
  93. containerStackId: machineStackId
  94. settingKey: "machine_shape"
  95. settingStoreIndex: propertyStoreIndex
  96. labelText: catalog.i18nc("@label", "Build plate shape")
  97. labelFont: base.labelFont
  98. labelWidth: base.labelWidth
  99. controlWidth: base.controlWidth
  100. forceUpdateOnChangeFunction: forceUpdateFunction
  101. }
  102. Cura.SimpleCheckBox // "Origin at center"
  103. {
  104. id: originAtCenterCheckBox
  105. containerStackId: machineStackId
  106. settingKey: "machine_center_is_zero"
  107. settingStoreIndex: propertyStoreIndex
  108. labelText: catalog.i18nc("@label", "Origin at center")
  109. labelFont: base.labelFont
  110. labelWidth: base.labelWidth
  111. forceUpdateOnChangeFunction: forceUpdateFunction
  112. }
  113. Cura.SimpleCheckBox // "Heated bed"
  114. {
  115. id: heatedBedCheckBox
  116. containerStackId: machineStackId
  117. settingKey: "machine_heated_bed"
  118. settingStoreIndex: propertyStoreIndex
  119. labelText: catalog.i18nc("@label", "Heated bed")
  120. labelFont: base.labelFont
  121. labelWidth: base.labelWidth
  122. forceUpdateOnChangeFunction: forceUpdateFunction
  123. }
  124. Cura.SimpleCheckBox // "Heated build volume"
  125. {
  126. id: heatedVolumeCheckBox
  127. containerStackId: machineStackId
  128. settingKey: "machine_heated_build_volume"
  129. settingStoreIndex: propertyStoreIndex
  130. labelText: catalog.i18nc("@label", "Heated build volume")
  131. labelFont: base.labelFont
  132. labelWidth: base.labelWidth
  133. forceUpdateOnChangeFunction: forceUpdateFunction
  134. }
  135. Cura.ComboBoxWithOptions // "G-code flavor"
  136. {
  137. id: gcodeFlavorComboBox
  138. containerStackId: machineStackId
  139. settingKey: "machine_gcode_flavor"
  140. settingStoreIndex: propertyStoreIndex
  141. labelText: catalog.i18nc("@label", "G-code flavor")
  142. labelFont: base.labelFont
  143. labelWidth: base.labelWidth
  144. controlWidth: base.controlWidth
  145. forceUpdateOnChangeFunction: forceUpdateFunction
  146. // FIXME(Lipu): better document this.
  147. // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings.
  148. // I don't remember exactly what.
  149. afterOnEditingFinishedFunction: manager.updateHasMaterialsMetadata
  150. }
  151. }
  152. // =======================================
  153. // Right-side column for "Printhead Settings"
  154. // =======================================
  155. Column
  156. {
  157. Layout.fillWidth: true
  158. Layout.alignment: Qt.AlignTop
  159. spacing: base.columnSpacing
  160. UM.Label // Title Label
  161. {
  162. text: catalog.i18nc("@title:label", "Printhead Settings")
  163. font: UM.Theme.getFont("medium_bold")
  164. width: parent.width
  165. elide: Text.ElideRight
  166. }
  167. Cura.PrintHeadMinMaxTextField // "X min"
  168. {
  169. id: machineXMinField
  170. settingStoreIndex: propertyStoreIndex
  171. labelText: catalog.i18nc("@label", "X min")
  172. labelFont: base.labelFont
  173. labelWidth: base.labelWidth
  174. controlWidth: base.controlWidth
  175. unitText: catalog.i18nc("@label", "mm")
  176. axisName: "x"
  177. axisMinOrMax: "min"
  178. minimum: Number.NEGATIVE_INFINITY
  179. maximum: 0
  180. forceUpdateOnChangeFunction: forceUpdateFunction
  181. }
  182. Cura.PrintHeadMinMaxTextField // "Y min"
  183. {
  184. id: machineYMinField
  185. settingStoreIndex: propertyStoreIndex
  186. labelText: catalog.i18nc("@label", "Y min")
  187. labelFont: base.labelFont
  188. labelWidth: base.labelWidth
  189. controlWidth: base.controlWidth
  190. unitText: catalog.i18nc("@label", "mm")
  191. axisName: "y"
  192. axisMinOrMax: "min"
  193. minimum: Number.NEGATIVE_INFINITY
  194. maximum: 0
  195. forceUpdateOnChangeFunction: forceUpdateFunction
  196. }
  197. Cura.PrintHeadMinMaxTextField // "X max"
  198. {
  199. id: machineXMaxField
  200. settingStoreIndex: propertyStoreIndex
  201. labelText: catalog.i18nc("@label", "X max")
  202. labelFont: base.labelFont
  203. labelWidth: base.labelWidth
  204. controlWidth: base.controlWidth
  205. unitText: catalog.i18nc("@label", "mm")
  206. axisName: "x"
  207. axisMinOrMax: "max"
  208. forceUpdateOnChangeFunction: forceUpdateFunction
  209. }
  210. Cura.PrintHeadMinMaxTextField // "Y max"
  211. {
  212. id: machineYMaxField
  213. containerStackId: machineStackId
  214. settingKey: "machine_head_with_fans_polygon"
  215. settingStoreIndex: propertyStoreIndex
  216. labelText: catalog.i18nc("@label", "Y max")
  217. labelFont: base.labelFont
  218. labelWidth: base.labelWidth
  219. controlWidth: base.controlWidth
  220. unitText: catalog.i18nc("@label", "mm")
  221. axisName: "y"
  222. axisMinOrMax: "max"
  223. forceUpdateOnChangeFunction: forceUpdateFunction
  224. }
  225. Cura.NumericTextFieldWithUnit // "Gantry Height"
  226. {
  227. id: machineGantryHeightField
  228. containerStackId: machineStackId
  229. settingKey: "gantry_height"
  230. settingStoreIndex: propertyStoreIndex
  231. labelText: catalog.i18nc("@label", "Gantry Height")
  232. labelFont: base.labelFont
  233. labelWidth: base.labelWidth
  234. controlWidth: base.controlWidth
  235. unitText: catalog.i18nc("@label", "mm")
  236. forceUpdateOnChangeFunction: forceUpdateFunction
  237. }
  238. Cura.ComboBoxWithOptions // "Number of Extruders"
  239. {
  240. id: numberOfExtrudersComboBox
  241. containerStackId: machineStackId
  242. settingKey: "machine_extruder_count"
  243. settingStoreIndex: propertyStoreIndex
  244. labelText: catalog.i18nc("@label", "Number of Extruders")
  245. labelFont: base.labelFont
  246. labelWidth: base.labelWidth
  247. controlWidth: base.controlWidth
  248. forceUpdateOnChangeFunction: forceUpdateFunction
  249. // FIXME(Lipu): better document this.
  250. // This has something to do with UM2 and UM2+ regarding "has_material" and the gcode flavor settings.
  251. // I don't remember exactly what.
  252. afterOnEditingFinishedFunction: manager.updateHasMaterialsMetadata
  253. setValueFunction: manager.setMachineExtruderCount
  254. optionModel: ListModel
  255. {
  256. id: extruderCountModel
  257. Component.onCompleted:
  258. {
  259. updateModel();
  260. }
  261. function updateModel()
  262. {
  263. clear();
  264. for (var i = 1; i <= Cura.MachineManager.activeMachine.maxExtruderCount; i ++) {
  265. // Use String as value. JavaScript only has Number. PropertyProvider.setPropertyValue()
  266. // takes a QVariant as value, and Number gets translated into a float. This will cause problem
  267. // for integer settings such as "Number of Extruders".
  268. append({ text: String(i), value: String(i) });
  269. }
  270. }
  271. }
  272. Connections
  273. {
  274. target: Cura.MachineManager
  275. function onGlobalContainerChanged() {
  276. extruderCountModel.updateModel();
  277. }
  278. }
  279. }
  280. /*
  281. - Fix for this issue: https://github.com/Ultimaker/Cura/issues/9167
  282. - Allows user to toggle if GCODE coordinates are affected by the extruder offset.
  283. - Machine wide setting. CuraEngine/src/gcodeExport.cpp is not set up to evaluate per extruder currently.
  284. - If it is moved to per-extruder (unlikely), then this should be moved to the extruder tab.
  285. */
  286. Cura.SimpleCheckBox // "GCode Affected By Extruder Offsets"
  287. {
  288. id: applyExtruderOffsetsCheckbox
  289. containerStackId: machineStackId
  290. settingKey: "machine_use_extruder_offset_to_offset_coords"
  291. settingStoreIndex: propertyStoreIndex
  292. labelText: catalog.i18nc("@label", "Apply Extruder offsets to GCode")
  293. labelFont: base.labelFont
  294. labelWidth: base.labelWidth
  295. forceUpdateOnChangeFunction: forceUpdateFunction
  296. }
  297. /*
  298. - Allows user to toggle if Start Gcode is the absolute first gcode.
  299. */
  300. Cura.SimpleCheckBox // "Make sure Start Code is before all gcodes"
  301. {
  302. id: applyStartGcodeFirstCheckbox
  303. containerStackId: machineStackId
  304. settingKey: "machine_start_gcode_first"
  305. settingStoreIndex: propertyStoreIndex
  306. labelText: catalog.i18nc("@label", "Start GCode must be first")
  307. labelFont: base.labelFont
  308. labelWidth: base.labelWidth
  309. forceUpdateOnChangeFunction: forceUpdateFunction
  310. }
  311. /* The "Shared Heater" feature is temporarily disabled because its
  312. implementation is incomplete. Printers with multiple filaments going
  313. into one nozzle will keep the inactive filaments retracted at the
  314. start of a print. However CuraEngine assumes that all filaments
  315. start at the nozzle tip. So it'll start printing the second filament
  316. without unretracting it.
  317. See: https://github.com/Ultimaker/Cura/issues/8148
  318. Cura.SimpleCheckBox // "Shared Heater"
  319. {
  320. id: sharedHeaterCheckBox
  321. containerStackId: machineStackId
  322. settingKey: "machine_extruders_share_heater"
  323. settingStoreIndex: propertyStoreIndex
  324. labelText: catalog.i18nc("@label", "Shared Heater")
  325. labelFont: base.labelFont
  326. labelWidth: base.labelWidth
  327. forceUpdateOnChangeFunction: forceUpdateFunction
  328. }
  329. */
  330. }
  331. }
  332. RowLayout // Start and End G-code
  333. {
  334. id: lowerBlock
  335. spacing: UM.Theme.getSize("default_margin").width
  336. anchors
  337. {
  338. top: upperBlock.bottom
  339. bottom: buttonLearnMore.top
  340. left: parent.left
  341. right: parent.right
  342. margins: UM.Theme.getSize("default_margin").width
  343. }
  344. Cura.GcodeTextArea // "Start G-code"
  345. {
  346. Layout.fillWidth: true
  347. Layout.fillHeight: true
  348. labelText: catalog.i18nc("@title:label", "Start G-code")
  349. containerStackId: machineStackId
  350. settingKey: "machine_start_gcode"
  351. settingStoreIndex: propertyStoreIndex
  352. }
  353. Cura.GcodeTextArea // "End G-code"
  354. {
  355. Layout.fillWidth: true
  356. Layout.fillHeight: true
  357. labelText: catalog.i18nc("@title:label", "End G-code")
  358. containerStackId: machineStackId
  359. settingKey: "machine_end_gcode"
  360. settingStoreIndex: propertyStoreIndex
  361. }
  362. }
  363. Cura.TertiaryButton
  364. {
  365. id: buttonLearnMore
  366. text: catalog.i18nc("@button", "Learn more")
  367. iconSource: UM.Theme.getIcon("LinkExternal")
  368. isIconOnRightSide: true
  369. onClicked: Qt.openUrlExternally("https://github.com/Ultimaker/Cura/wiki/Start-End-G%E2%80%90Code")
  370. anchors.bottom: parent.bottom
  371. anchors.right: parent.right
  372. anchors.margins: UM.Theme.getSize("default_margin").width
  373. }
  374. }