BuildVolume.py 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  1. # Copyright (c) 2018 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from cura.Settings.ExtruderManager import ExtruderManager
  4. from UM.Settings.ContainerRegistry import ContainerRegistry
  5. from UM.i18n import i18nCatalog
  6. from UM.Scene.Platform import Platform
  7. from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
  8. from UM.Scene.SceneNode import SceneNode
  9. from UM.Application import Application
  10. from UM.Resources import Resources
  11. from UM.Mesh.MeshBuilder import MeshBuilder
  12. from UM.Math.Vector import Vector
  13. from UM.Math.Matrix import Matrix
  14. from UM.Math.Color import Color
  15. from UM.Math.AxisAlignedBox import AxisAlignedBox
  16. from UM.Math.Polygon import Polygon
  17. from UM.Message import Message
  18. from UM.Signal import Signal
  19. from PyQt5.QtCore import QTimer
  20. from UM.View.RenderBatch import RenderBatch
  21. from UM.View.GL.OpenGL import OpenGL
  22. catalog = i18nCatalog("cura")
  23. import numpy
  24. import math
  25. from typing import List
  26. # Setting for clearance around the prime
  27. PRIME_CLEARANCE = 6.5
  28. ## Build volume is a special kind of node that is responsible for rendering the printable area & disallowed areas.
  29. class BuildVolume(SceneNode):
  30. raftThicknessChanged = Signal()
  31. def __init__(self, parent = None):
  32. super().__init__(parent)
  33. self._volume_outline_color = None
  34. self._x_axis_color = None
  35. self._y_axis_color = None
  36. self._z_axis_color = None
  37. self._disallowed_area_color = None
  38. self._error_area_color = None
  39. self._width = 0
  40. self._height = 0
  41. self._depth = 0
  42. self._shape = ""
  43. self._shader = None
  44. self._origin_mesh = None
  45. self._origin_line_length = 20
  46. self._origin_line_width = 0.5
  47. self._grid_mesh = None
  48. self._grid_shader = None
  49. self._disallowed_areas = []
  50. self._disallowed_area_mesh = None
  51. self._error_areas = []
  52. self._error_mesh = None
  53. self.setCalculateBoundingBox(False)
  54. self._volume_aabb = None
  55. self._raft_thickness = 0.0
  56. self._extra_z_clearance = 0.0
  57. self._adhesion_type = None
  58. self._platform = Platform(self)
  59. self._build_volume_message = Message(catalog.i18nc("@info:status",
  60. "The build volume height has been reduced due to the value of the"
  61. " \"Print Sequence\" setting to prevent the gantry from colliding"
  62. " with printed models."), title = catalog.i18nc("@info:title", "Build Volume"))
  63. self._global_container_stack = None
  64. Application.getInstance().globalContainerStackChanged.connect(self._onStackChanged)
  65. self._onStackChanged()
  66. self._engine_ready = False
  67. Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated)
  68. self._has_errors = False
  69. Application.getInstance().getController().getScene().sceneChanged.connect(self._onSceneChanged)
  70. #Objects loaded at the moment. We are connected to the property changed events of these objects.
  71. self._scene_objects = set()
  72. self._scene_change_timer = QTimer()
  73. self._scene_change_timer.setInterval(100)
  74. self._scene_change_timer.setSingleShot(True)
  75. self._scene_change_timer.timeout.connect(self._onSceneChangeTimerFinished)
  76. self._setting_change_timer = QTimer()
  77. self._setting_change_timer.setInterval(150)
  78. self._setting_change_timer.setSingleShot(True)
  79. self._setting_change_timer.timeout.connect(self._onSettingChangeTimerFinished)
  80. # Must be after setting _build_volume_message, apparently that is used in getMachineManager.
  81. # activeQualityChanged is always emitted after setActiveVariant, setActiveMaterial and setActiveQuality.
  82. # Therefore this works.
  83. Application.getInstance().getMachineManager().activeQualityChanged.connect(self._onStackChanged)
  84. # This should also ways work, and it is semantically more correct,
  85. # but it does not update the disallowed areas after material change
  86. Application.getInstance().getMachineManager().activeStackChanged.connect(self._onStackChanged)
  87. # list of settings which were updated
  88. self._changed_settings_since_last_rebuild = []
  89. def _onSceneChanged(self, source):
  90. if self._global_container_stack:
  91. self._scene_change_timer.start()
  92. def _onSceneChangeTimerFinished(self):
  93. root = Application.getInstance().getController().getScene().getRoot()
  94. new_scene_objects = set(node for node in BreadthFirstIterator(root) if node.callDecoration("isSliceable"))
  95. if new_scene_objects != self._scene_objects:
  96. for node in new_scene_objects - self._scene_objects: #Nodes that were added to the scene.
  97. self._updateNodeListeners(node)
  98. node.decoratorsChanged.connect(self._updateNodeListeners) # Make sure that decoration changes afterwards also receive the same treatment
  99. for node in self._scene_objects - new_scene_objects: #Nodes that were removed from the scene.
  100. per_mesh_stack = node.callDecoration("getStack")
  101. if per_mesh_stack:
  102. per_mesh_stack.propertyChanged.disconnect(self._onSettingPropertyChanged)
  103. active_extruder_changed = node.callDecoration("getActiveExtruderChangedSignal")
  104. if active_extruder_changed is not None:
  105. node.callDecoration("getActiveExtruderChangedSignal").disconnect(self._updateDisallowedAreasAndRebuild)
  106. node.decoratorsChanged.disconnect(self._updateNodeListeners)
  107. self._scene_objects = new_scene_objects
  108. self._onSettingPropertyChanged("print_sequence", "value") # Create fake event, so right settings are triggered.
  109. ## Updates the listeners that listen for changes in per-mesh stacks.
  110. #
  111. # \param node The node for which the decorators changed.
  112. def _updateNodeListeners(self, node: SceneNode):
  113. per_mesh_stack = node.callDecoration("getStack")
  114. if per_mesh_stack:
  115. per_mesh_stack.propertyChanged.connect(self._onSettingPropertyChanged)
  116. active_extruder_changed = node.callDecoration("getActiveExtruderChangedSignal")
  117. if active_extruder_changed is not None:
  118. active_extruder_changed.connect(self._updateDisallowedAreasAndRebuild)
  119. self._updateDisallowedAreasAndRebuild()
  120. def setWidth(self, width):
  121. if width is not None:
  122. self._width = width
  123. def setHeight(self, height):
  124. if height is not None:
  125. self._height = height
  126. def setDepth(self, depth):
  127. if depth is not None:
  128. self._depth = depth
  129. def setShape(self, shape: str):
  130. if shape:
  131. self._shape = shape
  132. def getDisallowedAreas(self) -> List[Polygon]:
  133. return self._disallowed_areas
  134. def setDisallowedAreas(self, areas: List[Polygon]):
  135. self._disallowed_areas = areas
  136. def render(self, renderer):
  137. if not self.getMeshData():
  138. return True
  139. if not self._shader:
  140. self._shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "default.shader"))
  141. self._grid_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "grid.shader"))
  142. theme = Application.getInstance().getTheme()
  143. self._grid_shader.setUniformValue("u_plateColor", Color(*theme.getColor("buildplate").getRgb()))
  144. self._grid_shader.setUniformValue("u_gridColor0", Color(*theme.getColor("buildplate_grid").getRgb()))
  145. self._grid_shader.setUniformValue("u_gridColor1", Color(*theme.getColor("buildplate_grid_minor").getRgb()))
  146. renderer.queueNode(self, mode = RenderBatch.RenderMode.Lines)
  147. renderer.queueNode(self, mesh = self._origin_mesh)
  148. renderer.queueNode(self, mesh = self._grid_mesh, shader = self._grid_shader, backface_cull = True)
  149. if self._disallowed_area_mesh:
  150. renderer.queueNode(self, mesh = self._disallowed_area_mesh, shader = self._shader, transparent = True, backface_cull = True, sort = -9)
  151. if self._error_mesh:
  152. renderer.queueNode(self, mesh=self._error_mesh, shader=self._shader, transparent=True,
  153. backface_cull=True, sort=-8)
  154. return True
  155. ## For every sliceable node, update node._outside_buildarea
  156. #
  157. def updateNodeBoundaryCheck(self):
  158. root = Application.getInstance().getController().getScene().getRoot()
  159. nodes = list(BreadthFirstIterator(root))
  160. group_nodes = []
  161. build_volume_bounding_box = self.getBoundingBox()
  162. if build_volume_bounding_box:
  163. # It's over 9000!
  164. build_volume_bounding_box = build_volume_bounding_box.set(bottom=-9001)
  165. else:
  166. # No bounding box. This is triggered when running Cura from command line with a model for the first time
  167. # In that situation there is a model, but no machine (and therefore no build volume.
  168. return
  169. for node in nodes:
  170. # Need to check group nodes later
  171. if node.callDecoration("isGroup"):
  172. group_nodes.append(node) # Keep list of affected group_nodes
  173. if node.callDecoration("isSliceable") or node.callDecoration("isGroup"):
  174. node._outside_buildarea = False
  175. bbox = node.getBoundingBox()
  176. # Mark the node as outside the build volume if the bounding box test fails.
  177. if build_volume_bounding_box.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
  178. node._outside_buildarea = True
  179. continue
  180. convex_hull = node.callDecoration("getConvexHull")
  181. if convex_hull:
  182. if not convex_hull.isValid():
  183. return
  184. # Check for collisions between disallowed areas and the object
  185. for area in self.getDisallowedAreas():
  186. overlap = convex_hull.intersectsPolygon(area)
  187. if overlap is None:
  188. continue
  189. node._outside_buildarea = True
  190. continue
  191. # Group nodes should override the _outside_buildarea property of their children.
  192. for group_node in group_nodes:
  193. for child_node in group_node.getAllChildren():
  194. child_node._outside_buildarea = group_node._outside_buildarea
  195. ## Recalculates the build volume & disallowed areas.
  196. def rebuild(self):
  197. if not self._width or not self._height or not self._depth:
  198. return
  199. if not Application.getInstance()._engine:
  200. return
  201. if not self._volume_outline_color:
  202. theme = Application.getInstance().getTheme()
  203. self._volume_outline_color = Color(*theme.getColor("volume_outline").getRgb())
  204. self._x_axis_color = Color(*theme.getColor("x_axis").getRgb())
  205. self._y_axis_color = Color(*theme.getColor("y_axis").getRgb())
  206. self._z_axis_color = Color(*theme.getColor("z_axis").getRgb())
  207. self._disallowed_area_color = Color(*theme.getColor("disallowed_area").getRgb())
  208. self._error_area_color = Color(*theme.getColor("error_area").getRgb())
  209. min_w = -self._width / 2
  210. max_w = self._width / 2
  211. min_h = 0.0
  212. max_h = self._height
  213. min_d = -self._depth / 2
  214. max_d = self._depth / 2
  215. z_fight_distance = 0.2 # Distance between buildplate and disallowed area meshes to prevent z-fighting
  216. if self._shape != "elliptic":
  217. # Outline 'cube' of the build volume
  218. mb = MeshBuilder()
  219. mb.addLine(Vector(min_w, min_h, min_d), Vector(max_w, min_h, min_d), color = self._volume_outline_color)
  220. mb.addLine(Vector(min_w, min_h, min_d), Vector(min_w, max_h, min_d), color = self._volume_outline_color)
  221. mb.addLine(Vector(min_w, max_h, min_d), Vector(max_w, max_h, min_d), color = self._volume_outline_color)
  222. mb.addLine(Vector(max_w, min_h, min_d), Vector(max_w, max_h, min_d), color = self._volume_outline_color)
  223. mb.addLine(Vector(min_w, min_h, max_d), Vector(max_w, min_h, max_d), color = self._volume_outline_color)
  224. mb.addLine(Vector(min_w, min_h, max_d), Vector(min_w, max_h, max_d), color = self._volume_outline_color)
  225. mb.addLine(Vector(min_w, max_h, max_d), Vector(max_w, max_h, max_d), color = self._volume_outline_color)
  226. mb.addLine(Vector(max_w, min_h, max_d), Vector(max_w, max_h, max_d), color = self._volume_outline_color)
  227. mb.addLine(Vector(min_w, min_h, min_d), Vector(min_w, min_h, max_d), color = self._volume_outline_color)
  228. mb.addLine(Vector(max_w, min_h, min_d), Vector(max_w, min_h, max_d), color = self._volume_outline_color)
  229. mb.addLine(Vector(min_w, max_h, min_d), Vector(min_w, max_h, max_d), color = self._volume_outline_color)
  230. mb.addLine(Vector(max_w, max_h, min_d), Vector(max_w, max_h, max_d), color = self._volume_outline_color)
  231. self.setMeshData(mb.build())
  232. # Build plate grid mesh
  233. mb = MeshBuilder()
  234. mb.addQuad(
  235. Vector(min_w, min_h - z_fight_distance, min_d),
  236. Vector(max_w, min_h - z_fight_distance, min_d),
  237. Vector(max_w, min_h - z_fight_distance, max_d),
  238. Vector(min_w, min_h - z_fight_distance, max_d)
  239. )
  240. for n in range(0, 6):
  241. v = mb.getVertex(n)
  242. mb.setVertexUVCoordinates(n, v[0], v[2])
  243. self._grid_mesh = mb.build()
  244. else:
  245. # Bottom and top 'ellipse' of the build volume
  246. aspect = 1.0
  247. scale_matrix = Matrix()
  248. if self._width != 0:
  249. # Scale circular meshes by aspect ratio if width != height
  250. aspect = self._depth / self._width
  251. scale_matrix.compose(scale = Vector(1, 1, aspect))
  252. mb = MeshBuilder()
  253. mb.addArc(max_w, Vector.Unit_Y, center = (0, min_h - z_fight_distance, 0), color = self._volume_outline_color)
  254. mb.addArc(max_w, Vector.Unit_Y, center = (0, max_h, 0), color = self._volume_outline_color)
  255. self.setMeshData(mb.build().getTransformed(scale_matrix))
  256. # Build plate grid mesh
  257. mb = MeshBuilder()
  258. mb.addVertex(0, min_h - z_fight_distance, 0)
  259. mb.addArc(max_w, Vector.Unit_Y, center = Vector(0, min_h - z_fight_distance, 0))
  260. sections = mb.getVertexCount() - 1 # Center point is not an arc section
  261. indices = []
  262. for n in range(0, sections - 1):
  263. indices.append([0, n + 2, n + 1])
  264. mb.addIndices(numpy.asarray(indices, dtype = numpy.int32))
  265. mb.calculateNormals()
  266. for n in range(0, mb.getVertexCount()):
  267. v = mb.getVertex(n)
  268. mb.setVertexUVCoordinates(n, v[0], v[2] * aspect)
  269. self._grid_mesh = mb.build().getTransformed(scale_matrix)
  270. # Indication of the machine origin
  271. if self._global_container_stack.getProperty("machine_center_is_zero", "value"):
  272. origin = (Vector(min_w, min_h, min_d) + Vector(max_w, min_h, max_d)) / 2
  273. else:
  274. origin = Vector(min_w, min_h, max_d)
  275. mb = MeshBuilder()
  276. mb.addCube(
  277. width = self._origin_line_length,
  278. height = self._origin_line_width,
  279. depth = self._origin_line_width,
  280. center = origin + Vector(self._origin_line_length / 2, 0, 0),
  281. color = self._x_axis_color
  282. )
  283. mb.addCube(
  284. width = self._origin_line_width,
  285. height = self._origin_line_length,
  286. depth = self._origin_line_width,
  287. center = origin + Vector(0, self._origin_line_length / 2, 0),
  288. color = self._y_axis_color
  289. )
  290. mb.addCube(
  291. width = self._origin_line_width,
  292. height = self._origin_line_width,
  293. depth = self._origin_line_length,
  294. center = origin - Vector(0, 0, self._origin_line_length / 2),
  295. color = self._z_axis_color
  296. )
  297. self._origin_mesh = mb.build()
  298. disallowed_area_height = 0.1
  299. disallowed_area_size = 0
  300. if self._disallowed_areas:
  301. mb = MeshBuilder()
  302. color = self._disallowed_area_color
  303. for polygon in self._disallowed_areas:
  304. points = polygon.getPoints()
  305. if len(points) == 0:
  306. continue
  307. first = Vector(self._clamp(points[0][0], min_w, max_w), disallowed_area_height, self._clamp(points[0][1], min_d, max_d))
  308. previous_point = Vector(self._clamp(points[0][0], min_w, max_w), disallowed_area_height, self._clamp(points[0][1], min_d, max_d))
  309. for point in points:
  310. new_point = Vector(self._clamp(point[0], min_w, max_w), disallowed_area_height, self._clamp(point[1], min_d, max_d))
  311. mb.addFace(first, previous_point, new_point, color = color)
  312. previous_point = new_point
  313. # Find the largest disallowed area to exclude it from the maximum scale bounds.
  314. # This is a very nasty hack. This pretty much only works for UM machines.
  315. # This disallowed area_size needs a -lot- of rework at some point in the future: TODO
  316. if numpy.min(points[:, 1]) >= 0: # This filters out all areas that have points to the left of the centre. This is done to filter the skirt area.
  317. size = abs(numpy.max(points[:, 1]) - numpy.min(points[:, 1]))
  318. else:
  319. size = 0
  320. disallowed_area_size = max(size, disallowed_area_size)
  321. self._disallowed_area_mesh = mb.build()
  322. else:
  323. self._disallowed_area_mesh = None
  324. if self._error_areas:
  325. mb = MeshBuilder()
  326. for error_area in self._error_areas:
  327. color = self._error_area_color
  328. points = error_area.getPoints()
  329. first = Vector(self._clamp(points[0][0], min_w, max_w), disallowed_area_height,
  330. self._clamp(points[0][1], min_d, max_d))
  331. previous_point = Vector(self._clamp(points[0][0], min_w, max_w), disallowed_area_height,
  332. self._clamp(points[0][1], min_d, max_d))
  333. for point in points:
  334. new_point = Vector(self._clamp(point[0], min_w, max_w), disallowed_area_height,
  335. self._clamp(point[1], min_d, max_d))
  336. mb.addFace(first, previous_point, new_point, color=color)
  337. previous_point = new_point
  338. self._error_mesh = mb.build()
  339. else:
  340. self._error_mesh = None
  341. self._volume_aabb = AxisAlignedBox(
  342. minimum = Vector(min_w, min_h - 1.0, min_d),
  343. maximum = Vector(max_w, max_h - self._raft_thickness - self._extra_z_clearance, max_d))
  344. bed_adhesion_size = self._getEdgeDisallowedSize()
  345. # As this works better for UM machines, we only add the disallowed_area_size for the z direction.
  346. # This is probably wrong in all other cases. TODO!
  347. # The +1 and -1 is added as there is always a bit of extra room required to work properly.
  348. scale_to_max_bounds = AxisAlignedBox(
  349. minimum = Vector(min_w + bed_adhesion_size + 1, min_h, min_d + disallowed_area_size - bed_adhesion_size + 1),
  350. maximum = Vector(max_w - bed_adhesion_size - 1, max_h - self._raft_thickness - self._extra_z_clearance, max_d - disallowed_area_size + bed_adhesion_size - 1)
  351. )
  352. Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds
  353. self.updateNodeBoundaryCheck()
  354. def getBoundingBox(self) -> AxisAlignedBox:
  355. return self._volume_aabb
  356. def getRaftThickness(self) -> float:
  357. return self._raft_thickness
  358. def _updateRaftThickness(self):
  359. old_raft_thickness = self._raft_thickness
  360. self._adhesion_type = self._global_container_stack.getProperty("adhesion_type", "value")
  361. self._raft_thickness = 0.0
  362. if self._adhesion_type == "raft":
  363. self._raft_thickness = (
  364. self._global_container_stack.getProperty("raft_base_thickness", "value") +
  365. self._global_container_stack.getProperty("raft_interface_thickness", "value") +
  366. self._global_container_stack.getProperty("raft_surface_layers", "value") *
  367. self._global_container_stack.getProperty("raft_surface_thickness", "value") +
  368. self._global_container_stack.getProperty("raft_airgap", "value") -
  369. self._global_container_stack.getProperty("layer_0_z_overlap", "value"))
  370. # Rounding errors do not matter, we check if raft_thickness has changed at all
  371. if old_raft_thickness != self._raft_thickness:
  372. self.setPosition(Vector(0, -self._raft_thickness, 0), SceneNode.TransformSpace.World)
  373. self.raftThicknessChanged.emit()
  374. def _updateExtraZClearance(self) -> None:
  375. extra_z = 0.0
  376. extruders = ExtruderManager.getInstance().getUsedExtruderStacks()
  377. use_extruders = False
  378. for extruder in extruders:
  379. if extruder.getProperty("retraction_hop_enabled", "value"):
  380. retraction_hop = extruder.getProperty("retraction_hop", "value")
  381. if extra_z is None or retraction_hop > extra_z:
  382. extra_z = retraction_hop
  383. use_extruders = True
  384. if not use_extruders:
  385. # If no extruders, take global value.
  386. if self._global_container_stack.getProperty("retraction_hop_enabled", "value"):
  387. extra_z = self._global_container_stack.getProperty("retraction_hop", "value")
  388. if extra_z != self._extra_z_clearance:
  389. self._extra_z_clearance = extra_z
  390. ## Update the build volume visualization
  391. def _onStackChanged(self):
  392. if self._global_container_stack:
  393. self._global_container_stack.propertyChanged.disconnect(self._onSettingPropertyChanged)
  394. extruders = ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())
  395. for extruder in extruders:
  396. extruder.propertyChanged.disconnect(self._onSettingPropertyChanged)
  397. self._global_container_stack = Application.getInstance().getGlobalContainerStack()
  398. if self._global_container_stack:
  399. self._global_container_stack.propertyChanged.connect(self._onSettingPropertyChanged)
  400. extruders = ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())
  401. for extruder in extruders:
  402. extruder.propertyChanged.connect(self._onSettingPropertyChanged)
  403. self._width = self._global_container_stack.getProperty("machine_width", "value")
  404. machine_height = self._global_container_stack.getProperty("machine_height", "value")
  405. if self._global_container_stack.getProperty("print_sequence", "value") == "one_at_a_time" and len(self._scene_objects) > 1:
  406. self._height = min(self._global_container_stack.getProperty("gantry_height", "value"), machine_height)
  407. if self._height < machine_height:
  408. self._build_volume_message.show()
  409. else:
  410. self._build_volume_message.hide()
  411. else:
  412. self._height = self._global_container_stack.getProperty("machine_height", "value")
  413. self._build_volume_message.hide()
  414. self._depth = self._global_container_stack.getProperty("machine_depth", "value")
  415. self._shape = self._global_container_stack.getProperty("machine_shape", "value")
  416. self._updateDisallowedAreas()
  417. self._updateRaftThickness()
  418. self._updateExtraZClearance()
  419. if self._engine_ready:
  420. self.rebuild()
  421. def _onEngineCreated(self):
  422. self._engine_ready = True
  423. self.rebuild()
  424. def _onSettingChangeTimerFinished(self):
  425. rebuild_me = False
  426. update_disallowed_areas = False
  427. update_raft_thickness = False
  428. update_extra_z_clearance = True
  429. for setting_key in self._changed_settings_since_last_rebuild:
  430. if setting_key == "print_sequence":
  431. machine_height = self._global_container_stack.getProperty("machine_height", "value")
  432. if Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", "value") == "one_at_a_time" and len(self._scene_objects) > 1:
  433. self._height = min(self._global_container_stack.getProperty("gantry_height", "value"), machine_height)
  434. if self._height < machine_height:
  435. self._build_volume_message.show()
  436. else:
  437. self._build_volume_message.hide()
  438. else:
  439. self._height = self._global_container_stack.getProperty("machine_height", "value")
  440. self._build_volume_message.hide()
  441. update_disallowed_areas = True
  442. rebuild_me = True
  443. # sometimes the machine size or shape settings are adjusted on the active machine, we should reflect this
  444. if setting_key in self._machine_settings:
  445. self._height = self._global_container_stack.getProperty("machine_height", "value")
  446. self._width = self._global_container_stack.getProperty("machine_width", "value")
  447. self._depth = self._global_container_stack.getProperty("machine_depth", "value")
  448. self._shape = self._global_container_stack.getProperty("machine_shape", "value")
  449. update_extra_z_clearance = True
  450. update_disallowed_areas = True
  451. rebuild_me = True
  452. if setting_key in self._skirt_settings + self._prime_settings + self._tower_settings + self._ooze_shield_settings + self._distance_settings + self._extruder_settings:
  453. update_disallowed_areas = True
  454. rebuild_me = True
  455. if setting_key in self._raft_settings:
  456. update_raft_thickness = True
  457. rebuild_me = True
  458. if setting_key in self._extra_z_settings:
  459. update_extra_z_clearance = True
  460. rebuild_me = True
  461. if setting_key in self._limit_to_extruder_settings:
  462. update_disallowed_areas = True
  463. rebuild_me = True
  464. # We only want to update all of them once.
  465. if update_disallowed_areas:
  466. self._updateDisallowedAreas()
  467. if update_raft_thickness:
  468. self._updateRaftThickness()
  469. if update_extra_z_clearance:
  470. self._updateExtraZClearance()
  471. if rebuild_me:
  472. self.rebuild()
  473. # We just did a rebuild, reset the list.
  474. self._changed_settings_since_last_rebuild = []
  475. def _onSettingPropertyChanged(self, setting_key: str, property_name: str):
  476. if property_name != "value":
  477. return
  478. if setting_key not in self._changed_settings_since_last_rebuild:
  479. self._changed_settings_since_last_rebuild.append(setting_key)
  480. self._setting_change_timer.start()
  481. def hasErrors(self) -> bool:
  482. return self._has_errors
  483. ## Calls _updateDisallowedAreas and makes sure the changes appear in the
  484. # scene.
  485. #
  486. # This is required for a signal to trigger the update in one go. The
  487. # ``_updateDisallowedAreas`` method itself shouldn't call ``rebuild``,
  488. # since there may be other changes before it needs to be rebuilt, which
  489. # would hit performance.
  490. def _updateDisallowedAreasAndRebuild(self):
  491. self._updateDisallowedAreas()
  492. self._updateRaftThickness()
  493. self._updateExtraZClearance()
  494. self.rebuild()
  495. def _updateDisallowedAreas(self):
  496. if not self._global_container_stack:
  497. return
  498. self._error_areas = []
  499. extruder_manager = ExtruderManager.getInstance()
  500. used_extruders = extruder_manager.getUsedExtruderStacks()
  501. disallowed_border_size = self._getEdgeDisallowedSize()
  502. if not used_extruders:
  503. # If no extruder is used, assume that the active extruder is used (else nothing is drawn)
  504. if extruder_manager.getActiveExtruderStack():
  505. used_extruders = [extruder_manager.getActiveExtruderStack()]
  506. else:
  507. used_extruders = [self._global_container_stack]
  508. result_areas = self._computeDisallowedAreasStatic(disallowed_border_size, used_extruders) #Normal machine disallowed areas can always be added.
  509. prime_areas = self._computeDisallowedAreasPrimeBlob(disallowed_border_size, used_extruders)
  510. prime_disallowed_areas = self._computeDisallowedAreasStatic(0, used_extruders) #Where the priming is not allowed to happen. This is not added to the result, just for collision checking.
  511. #Check if prime positions intersect with disallowed areas.
  512. for extruder in used_extruders:
  513. extruder_id = extruder.getId()
  514. collision = False
  515. for prime_polygon in prime_areas[extruder_id]:
  516. for disallowed_polygon in prime_disallowed_areas[extruder_id]:
  517. if prime_polygon.intersectsPolygon(disallowed_polygon) is not None:
  518. collision = True
  519. break
  520. if collision:
  521. break
  522. #Also check other prime positions (without additional offset).
  523. for other_extruder_id in prime_areas:
  524. if extruder_id == other_extruder_id: #It is allowed to collide with itself.
  525. continue
  526. for other_prime_polygon in prime_areas[other_extruder_id]:
  527. if prime_polygon.intersectsPolygon(other_prime_polygon):
  528. collision = True
  529. break
  530. if collision:
  531. break
  532. if collision:
  533. break
  534. result_areas[extruder_id].extend(prime_areas[extruder_id])
  535. nozzle_disallowed_areas = extruder.getProperty("nozzle_disallowed_areas", "value")
  536. for area in nozzle_disallowed_areas:
  537. polygon = Polygon(numpy.array(area, numpy.float32))
  538. polygon = polygon.getMinkowskiHull(Polygon.approximatedCircle(disallowed_border_size))
  539. result_areas[extruder_id].append(polygon) #Don't perform the offset on these.
  540. # Add prime tower location as disallowed area.
  541. if len(used_extruders) > 1: #No prime tower in single-extrusion.
  542. prime_tower_collision = False
  543. prime_tower_areas = self._computeDisallowedAreasPrinted(used_extruders)
  544. for extruder_id in prime_tower_areas:
  545. for prime_tower_area in prime_tower_areas[extruder_id]:
  546. for area in result_areas[extruder_id]:
  547. if prime_tower_area.intersectsPolygon(area) is not None:
  548. prime_tower_collision = True
  549. break
  550. if prime_tower_collision: #Already found a collision.
  551. break
  552. if not prime_tower_collision:
  553. result_areas[extruder_id].extend(prime_tower_areas[extruder_id])
  554. else:
  555. self._error_areas.extend(prime_tower_areas[extruder_id])
  556. self._has_errors = len(self._error_areas) > 0
  557. self._disallowed_areas = []
  558. for extruder_id in result_areas:
  559. self._disallowed_areas.extend(result_areas[extruder_id])
  560. ## Computes the disallowed areas for objects that are printed with print
  561. # features.
  562. #
  563. # This means that the brim, travel avoidance and such will be applied to
  564. # these features.
  565. #
  566. # \return A dictionary with for each used extruder ID the disallowed areas
  567. # where that extruder may not print.
  568. def _computeDisallowedAreasPrinted(self, used_extruders):
  569. result = {}
  570. for extruder in used_extruders:
  571. result[extruder.getId()] = []
  572. #Currently, the only normally printed object is the prime tower.
  573. if ExtruderManager.getInstance().getResolveOrValue("prime_tower_enable"):
  574. prime_tower_size = self._global_container_stack.getProperty("prime_tower_size", "value")
  575. machine_width = self._global_container_stack.getProperty("machine_width", "value")
  576. machine_depth = self._global_container_stack.getProperty("machine_depth", "value")
  577. prime_tower_x = self._global_container_stack.getProperty("prime_tower_position_x", "value")
  578. prime_tower_y = - self._global_container_stack.getProperty("prime_tower_position_y", "value")
  579. if not self._global_container_stack.getProperty("machine_center_is_zero", "value"):
  580. prime_tower_x = prime_tower_x - machine_width / 2 #Offset by half machine_width and _depth to put the origin in the front-left.
  581. prime_tower_y = prime_tower_y + machine_depth / 2
  582. prime_tower_area = Polygon([
  583. [prime_tower_x - prime_tower_size, prime_tower_y - prime_tower_size],
  584. [prime_tower_x, prime_tower_y - prime_tower_size],
  585. [prime_tower_x, prime_tower_y],
  586. [prime_tower_x - prime_tower_size, prime_tower_y],
  587. ])
  588. prime_tower_area = prime_tower_area.getMinkowskiHull(Polygon.approximatedCircle(0))
  589. for extruder in used_extruders:
  590. result[extruder.getId()].append(prime_tower_area) #The prime tower location is the same for each extruder, regardless of offset.
  591. return result
  592. ## Computes the disallowed areas for the prime blobs.
  593. #
  594. # These are special because they are not subject to things like brim or
  595. # travel avoidance. They do get a dilute with the border size though
  596. # because they may not intersect with brims and such of other objects.
  597. #
  598. # \param border_size The size with which to offset the disallowed areas
  599. # due to skirt, brim, travel avoid distance, etc.
  600. # \param used_extruders The extruder stacks to generate disallowed areas
  601. # for.
  602. # \return A dictionary with for each used extruder ID the prime areas.
  603. def _computeDisallowedAreasPrimeBlob(self, border_size, used_extruders):
  604. result = {}
  605. machine_width = self._global_container_stack.getProperty("machine_width", "value")
  606. machine_depth = self._global_container_stack.getProperty("machine_depth", "value")
  607. for extruder in used_extruders:
  608. prime_blob_enabled = extruder.getProperty("prime_blob_enable", "value")
  609. prime_x = extruder.getProperty("extruder_prime_pos_x", "value")
  610. prime_y = -extruder.getProperty("extruder_prime_pos_y", "value")
  611. #Ignore extruder prime position if it is not set or if blob is disabled
  612. if (prime_x == 0 and prime_y == 0) or not prime_blob_enabled:
  613. result[extruder.getId()] = []
  614. continue
  615. if not self._global_container_stack.getProperty("machine_center_is_zero", "value"):
  616. prime_x = prime_x - machine_width / 2 #Offset by half machine_width and _depth to put the origin in the front-left.
  617. prime_y = prime_y + machine_depth / 2
  618. prime_polygon = Polygon.approximatedCircle(PRIME_CLEARANCE)
  619. prime_polygon = prime_polygon.getMinkowskiHull(Polygon.approximatedCircle(border_size))
  620. prime_polygon = prime_polygon.translate(prime_x, prime_y)
  621. result[extruder.getId()] = [prime_polygon]
  622. return result
  623. ## Computes the disallowed areas that are statically placed in the machine.
  624. #
  625. # It computes different disallowed areas depending on the offset of the
  626. # extruder. The resulting dictionary will therefore have an entry for each
  627. # extruder that is used.
  628. #
  629. # \param border_size The size with which to offset the disallowed areas
  630. # due to skirt, brim, travel avoid distance, etc.
  631. # \param used_extruders The extruder stacks to generate disallowed areas
  632. # for.
  633. # \return A dictionary with for each used extruder ID the disallowed areas
  634. # where that extruder may not print.
  635. def _computeDisallowedAreasStatic(self, border_size, used_extruders):
  636. #Convert disallowed areas to polygons and dilate them.
  637. machine_disallowed_polygons = []
  638. for area in self._global_container_stack.getProperty("machine_disallowed_areas", "value"):
  639. polygon = Polygon(numpy.array(area, numpy.float32))
  640. polygon = polygon.getMinkowskiHull(Polygon.approximatedCircle(border_size))
  641. machine_disallowed_polygons.append(polygon)
  642. # For certain machines we don't need to compute disallowed areas for each nozzle.
  643. # So we check here and only do the nozzle offsetting if needed.
  644. nozzle_offsetting_for_disallowed_areas = self._global_container_stack.getMetaDataEntry(
  645. "nozzle_offsetting_for_disallowed_areas", True)
  646. result = {}
  647. for extruder in used_extruders:
  648. extruder_id = extruder.getId()
  649. offset_x = extruder.getProperty("machine_nozzle_offset_x", "value")
  650. if offset_x is None:
  651. offset_x = 0
  652. offset_y = extruder.getProperty("machine_nozzle_offset_y", "value")
  653. if offset_y is None:
  654. offset_y = 0
  655. result[extruder_id] = []
  656. for polygon in machine_disallowed_polygons:
  657. result[extruder_id].append(polygon.translate(offset_x, offset_y)) #Compensate for the nozzle offset of this extruder.
  658. #Add the border around the edge of the build volume.
  659. left_unreachable_border = 0
  660. right_unreachable_border = 0
  661. top_unreachable_border = 0
  662. bottom_unreachable_border = 0
  663. # Only do nozzle offsetting if needed
  664. if nozzle_offsetting_for_disallowed_areas:
  665. #The build volume is defined as the union of the area that all extruders can reach, so we need to know the relative offset to all extruders.
  666. for other_extruder in ExtruderManager.getInstance().getActiveExtruderStacks():
  667. other_offset_x = other_extruder.getProperty("machine_nozzle_offset_x", "value")
  668. if other_offset_x is None:
  669. other_offset_x = 0
  670. other_offset_y = other_extruder.getProperty("machine_nozzle_offset_y", "value")
  671. if other_offset_y is None:
  672. other_offset_y = 0
  673. other_offset_y = -other_offset_y
  674. left_unreachable_border = min(left_unreachable_border, other_offset_x - offset_x)
  675. right_unreachable_border = max(right_unreachable_border, other_offset_x - offset_x)
  676. top_unreachable_border = min(top_unreachable_border, other_offset_y - offset_y)
  677. bottom_unreachable_border = max(bottom_unreachable_border, other_offset_y - offset_y)
  678. half_machine_width = self._global_container_stack.getProperty("machine_width", "value") / 2
  679. half_machine_depth = self._global_container_stack.getProperty("machine_depth", "value") / 2
  680. if self._shape != "elliptic":
  681. if border_size - left_unreachable_border > 0:
  682. result[extruder_id].append(Polygon(numpy.array([
  683. [-half_machine_width, -half_machine_depth],
  684. [-half_machine_width, half_machine_depth],
  685. [-half_machine_width + border_size - left_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border],
  686. [-half_machine_width + border_size - left_unreachable_border, -half_machine_depth + border_size - top_unreachable_border]
  687. ], numpy.float32)))
  688. if border_size + right_unreachable_border > 0:
  689. result[extruder_id].append(Polygon(numpy.array([
  690. [half_machine_width, half_machine_depth],
  691. [half_machine_width, -half_machine_depth],
  692. [half_machine_width - border_size - right_unreachable_border, -half_machine_depth + border_size - top_unreachable_border],
  693. [half_machine_width - border_size - right_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border]
  694. ], numpy.float32)))
  695. if border_size + bottom_unreachable_border > 0:
  696. result[extruder_id].append(Polygon(numpy.array([
  697. [-half_machine_width, half_machine_depth],
  698. [half_machine_width, half_machine_depth],
  699. [half_machine_width - border_size - right_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border],
  700. [-half_machine_width + border_size - left_unreachable_border, half_machine_depth - border_size - bottom_unreachable_border]
  701. ], numpy.float32)))
  702. if border_size - top_unreachable_border > 0:
  703. result[extruder_id].append(Polygon(numpy.array([
  704. [half_machine_width, -half_machine_depth],
  705. [-half_machine_width, -half_machine_depth],
  706. [-half_machine_width + border_size - left_unreachable_border, -half_machine_depth + border_size - top_unreachable_border],
  707. [half_machine_width - border_size - right_unreachable_border, -half_machine_depth + border_size - top_unreachable_border]
  708. ], numpy.float32)))
  709. else:
  710. sections = 32
  711. arc_vertex = [0, half_machine_depth - border_size]
  712. for i in range(0, sections):
  713. quadrant = math.floor(4 * i / sections)
  714. vertices = []
  715. if quadrant == 0:
  716. vertices.append([-half_machine_width, half_machine_depth])
  717. elif quadrant == 1:
  718. vertices.append([-half_machine_width, -half_machine_depth])
  719. elif quadrant == 2:
  720. vertices.append([half_machine_width, -half_machine_depth])
  721. elif quadrant == 3:
  722. vertices.append([half_machine_width, half_machine_depth])
  723. vertices.append(arc_vertex)
  724. angle = 2 * math.pi * (i + 1) / sections
  725. arc_vertex = [-(half_machine_width - border_size) * math.sin(angle), (half_machine_depth - border_size) * math.cos(angle)]
  726. vertices.append(arc_vertex)
  727. result[extruder_id].append(Polygon(numpy.array(vertices, numpy.float32)))
  728. if border_size > 0:
  729. result[extruder_id].append(Polygon(numpy.array([
  730. [-half_machine_width, -half_machine_depth],
  731. [-half_machine_width, half_machine_depth],
  732. [-half_machine_width + border_size, 0]
  733. ], numpy.float32)))
  734. result[extruder_id].append(Polygon(numpy.array([
  735. [-half_machine_width, half_machine_depth],
  736. [ half_machine_width, half_machine_depth],
  737. [ 0, half_machine_depth - border_size]
  738. ], numpy.float32)))
  739. result[extruder_id].append(Polygon(numpy.array([
  740. [ half_machine_width, half_machine_depth],
  741. [ half_machine_width, -half_machine_depth],
  742. [ half_machine_width - border_size, 0]
  743. ], numpy.float32)))
  744. result[extruder_id].append(Polygon(numpy.array([
  745. [ half_machine_width,-half_machine_depth],
  746. [-half_machine_width,-half_machine_depth],
  747. [ 0, -half_machine_depth + border_size]
  748. ], numpy.float32)))
  749. return result
  750. ## Private convenience function to get a setting from every extruder.
  751. #
  752. # For single extrusion machines, this gets the setting from the global
  753. # stack.
  754. #
  755. # \return A sequence of setting values, one for each extruder.
  756. def _getSettingFromAllExtruders(self, setting_key, property = "value"):
  757. all_values = ExtruderManager.getInstance().getAllExtruderSettings(setting_key, property)
  758. all_types = ExtruderManager.getInstance().getAllExtruderSettings(setting_key, "type")
  759. for i in range(len(all_values)):
  760. if not all_values[i] and (all_types[i] == "int" or all_types[i] == "float"):
  761. all_values[i] = 0
  762. return all_values
  763. ## Convenience function to calculate the disallowed radius around the edge.
  764. #
  765. # This disallowed radius is to allow for space around the models that is
  766. # not part of the collision radius, such as bed adhesion (skirt/brim/raft)
  767. # and travel avoid distance.
  768. def _getEdgeDisallowedSize(self):
  769. if not self._global_container_stack:
  770. return 0
  771. container_stack = self._global_container_stack
  772. used_extruders = ExtruderManager.getInstance().getUsedExtruderStacks()
  773. # If we are printing one at a time, we need to add the bed adhesion size to the disallowed areas of the objects
  774. if container_stack.getProperty("print_sequence", "value") == "one_at_a_time":
  775. return 0.1 # Return a very small value, so we do draw disallowed area's near the edges.
  776. adhesion_type = container_stack.getProperty("adhesion_type", "value")
  777. skirt_brim_line_width = self._global_container_stack.getProperty("skirt_brim_line_width", "value")
  778. initial_layer_line_width_factor = self._global_container_stack.getProperty("initial_layer_line_width_factor", "value")
  779. if adhesion_type == "skirt":
  780. skirt_distance = self._global_container_stack.getProperty("skirt_gap", "value")
  781. skirt_line_count = self._global_container_stack.getProperty("skirt_line_count", "value")
  782. bed_adhesion_size = skirt_distance + (skirt_brim_line_width * skirt_line_count) * initial_layer_line_width_factor / 100.0
  783. for extruder_stack in used_extruders:
  784. bed_adhesion_size += extruder_stack.getProperty("skirt_brim_line_width", "value") * extruder_stack.getProperty("initial_layer_line_width_factor", "value") / 100.0
  785. # We don't create an additional line for the extruder we're printing the skirt with.
  786. bed_adhesion_size -= skirt_brim_line_width * initial_layer_line_width_factor / 100.0
  787. elif adhesion_type == "brim":
  788. brim_line_count = self._global_container_stack.getProperty("brim_line_count", "value")
  789. bed_adhesion_size = skirt_brim_line_width * brim_line_count * initial_layer_line_width_factor / 100.0
  790. for extruder_stack in used_extruders:
  791. bed_adhesion_size += extruder_stack.getProperty("skirt_brim_line_width", "value") * extruder_stack.getProperty("initial_layer_line_width_factor", "value") / 100.0
  792. # We don't create an additional line for the extruder we're printing the brim with.
  793. bed_adhesion_size -= skirt_brim_line_width * initial_layer_line_width_factor / 100.0
  794. elif adhesion_type == "raft":
  795. bed_adhesion_size = self._global_container_stack.getProperty("raft_margin", "value")
  796. elif adhesion_type == "none":
  797. bed_adhesion_size = 0
  798. else:
  799. raise Exception("Unknown bed adhesion type. Did you forget to update the build volume calculations for your new bed adhesion type?")
  800. support_expansion = 0
  801. support_enabled = self._global_container_stack.getProperty("support_enable", "value")
  802. support_offset = self._global_container_stack.getProperty("support_offset", "value")
  803. if support_enabled and support_offset:
  804. support_expansion += support_offset
  805. farthest_shield_distance = 0
  806. if container_stack.getProperty("draft_shield_enabled", "value"):
  807. farthest_shield_distance = max(farthest_shield_distance, container_stack.getProperty("draft_shield_dist", "value"))
  808. if container_stack.getProperty("ooze_shield_enabled", "value"):
  809. farthest_shield_distance = max(farthest_shield_distance, container_stack.getProperty("ooze_shield_dist", "value"))
  810. move_from_wall_radius = 0 # Moves that start from outer wall.
  811. move_from_wall_radius = max(move_from_wall_radius, max(self._getSettingFromAllExtruders("infill_wipe_dist")))
  812. avoid_enabled_per_extruder = [stack.getProperty("travel_avoid_other_parts","value") for stack in used_extruders]
  813. travel_avoid_distance_per_extruder = [stack.getProperty("travel_avoid_distance", "value") for stack in used_extruders]
  814. for avoid_other_parts_enabled, avoid_distance in zip(avoid_enabled_per_extruder, travel_avoid_distance_per_extruder): #For each extruder (or just global).
  815. if avoid_other_parts_enabled:
  816. move_from_wall_radius = max(move_from_wall_radius, avoid_distance)
  817. # Now combine our different pieces of data to get the final border size.
  818. # Support expansion is added to the bed adhesion, since the bed adhesion goes around support.
  819. # Support expansion is added to farthest shield distance, since the shields go around support.
  820. border_size = max(move_from_wall_radius, support_expansion + farthest_shield_distance, support_expansion + bed_adhesion_size)
  821. return border_size
  822. def _clamp(self, value, min_value, max_value):
  823. return max(min(value, max_value), min_value)
  824. _machine_settings = ["machine_width", "machine_depth", "machine_height", "machine_shape", "machine_center_is_zero"]
  825. _skirt_settings = ["adhesion_type", "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "brim_width", "brim_line_count", "raft_margin", "draft_shield_enabled", "draft_shield_dist", "initial_layer_line_width_factor"]
  826. _raft_settings = ["adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers", "raft_surface_thickness", "raft_airgap", "layer_0_z_overlap"]
  827. _extra_z_settings = ["retraction_hop_enabled", "retraction_hop"]
  828. _prime_settings = ["extruder_prime_pos_x", "extruder_prime_pos_y", "extruder_prime_pos_z", "prime_blob_enable"]
  829. _tower_settings = ["prime_tower_enable", "prime_tower_size", "prime_tower_position_x", "prime_tower_position_y"]
  830. _ooze_shield_settings = ["ooze_shield_enabled", "ooze_shield_dist"]
  831. _distance_settings = ["infill_wipe_dist", "travel_avoid_distance", "support_offset", "support_enable", "travel_avoid_other_parts"]
  832. _extruder_settings = ["support_enable", "support_bottom_enable", "support_roof_enable", "support_infill_extruder_nr", "support_extruder_nr_layer_0", "support_bottom_extruder_nr", "support_roof_extruder_nr", "brim_line_count", "adhesion_extruder_nr", "adhesion_type"] #Settings that can affect which extruders are used.
  833. _limit_to_extruder_settings = ["wall_extruder_nr", "wall_0_extruder_nr", "wall_x_extruder_nr", "top_bottom_extruder_nr", "infill_extruder_nr", "support_infill_extruder_nr", "support_extruder_nr_layer_0", "support_bottom_extruder_nr", "support_roof_extruder_nr", "adhesion_extruder_nr"]