mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 00:16:04 +08:00
Change shadows on buildplate for one-at-a-time printing
Inner: adhesion area Outer: full head In my opinion this allows the user to more easily see whether this object can be printed after another object.
This commit is contained in:
parent
254dde5b05
commit
558ed4b1e8
@ -175,10 +175,17 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
|||||||
self._convex_hull_node = None
|
self._convex_hull_node = None
|
||||||
return
|
return
|
||||||
|
|
||||||
convex_hull = self.getConvexHull()
|
if self._global_stack \
|
||||||
|
and self._global_stack.getProperty("print_sequence", "value") == "one_at_a_time" \
|
||||||
|
and not self.hasGroupAsParent(self._node):
|
||||||
|
# In one-at-a-time mode, every printed object gets it's own adhesion
|
||||||
|
printing_area = self.getAdhesionArea()
|
||||||
|
else:
|
||||||
|
printing_area = self.getConvexHull()
|
||||||
|
|
||||||
if self._convex_hull_node:
|
if self._convex_hull_node:
|
||||||
self._convex_hull_node.setParent(None)
|
self._convex_hull_node.setParent(None)
|
||||||
hull_node = ConvexHullNode.ConvexHullNode(self._node, convex_hull, self._raft_thickness, root)
|
hull_node = ConvexHullNode.ConvexHullNode(self._node, printing_area, self._raft_thickness, root)
|
||||||
self._convex_hull_node = hull_node
|
self._convex_hull_node = hull_node
|
||||||
|
|
||||||
def _onSettingValueChanged(self, key: str, property_name: str) -> None:
|
def _onSettingValueChanged(self, key: str, property_name: str) -> None:
|
||||||
|
@ -43,6 +43,7 @@ class ConvexHullNode(SceneNode):
|
|||||||
|
|
||||||
# The node this mesh is "watching"
|
# The node this mesh is "watching"
|
||||||
self._node = node
|
self._node = node
|
||||||
|
# Area of the head + fans for display as a shadow on the buildplate
|
||||||
self._convex_hull_head_mesh = None
|
self._convex_hull_head_mesh = None
|
||||||
|
|
||||||
self._node.decoratorsChanged.connect(self._onNodeDecoratorsChanged)
|
self._node.decoratorsChanged.connect(self._onNodeDecoratorsChanged)
|
||||||
@ -76,14 +77,17 @@ class ConvexHullNode(SceneNode):
|
|||||||
|
|
||||||
if self.getParent():
|
if self.getParent():
|
||||||
if self.getMeshData() and isinstance(self._node, SceneNode) and self._node.callDecoration("getBuildPlateNumber") == Application.getInstance().getMultiBuildPlateModel().activeBuildPlate:
|
if self.getMeshData() and isinstance(self._node, SceneNode) and self._node.callDecoration("getBuildPlateNumber") == Application.getInstance().getMultiBuildPlateModel().activeBuildPlate:
|
||||||
|
# The object itself (+ adhesion in one-at-a-time mode)
|
||||||
renderer.queueNode(self, transparent = True, shader = ConvexHullNode.shader, backface_cull = True, sort = -8)
|
renderer.queueNode(self, transparent = True, shader = ConvexHullNode.shader, backface_cull = True, sort = -8)
|
||||||
if self._convex_hull_head_mesh:
|
if self._convex_hull_head_mesh:
|
||||||
|
# The full head. Rendered as a hint to the user: If this area overlaps another object A; this object
|
||||||
|
# cannot be printed after A, because the head would hit A while printing the current object
|
||||||
renderer.queueNode(self, shader = ConvexHullNode.shader, transparent = True, mesh = self._convex_hull_head_mesh, backface_cull = True, sort = -8)
|
renderer.queueNode(self, shader = ConvexHullNode.shader, transparent = True, mesh = self._convex_hull_head_mesh, backface_cull = True, sort = -8)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _onNodeDecoratorsChanged(self, node: SceneNode) -> None:
|
def _onNodeDecoratorsChanged(self, node: SceneNode) -> None:
|
||||||
convex_hull_head = self._node.callDecoration("getConvexHullHead")
|
convex_hull_head = self._node.callDecoration("getConvexHullHeadFull")
|
||||||
if convex_hull_head:
|
if convex_hull_head:
|
||||||
convex_hull_head_builder = MeshBuilder()
|
convex_hull_head_builder = MeshBuilder()
|
||||||
convex_hull_head_builder.addConvexPolygon(convex_hull_head.getPoints(), self._mesh_height - self._thickness)
|
convex_hull_head_builder.addConvexPolygon(convex_hull_head.getPoints(), self._mesh_height - self._thickness)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user