mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Head size & settings for one at a time & all at once printing
This commit is contained in:
parent
5abb6c1635
commit
a18f133e29
3 changed files with 264 additions and 190 deletions
|
@ -1,4 +1,5 @@
|
||||||
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
|
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
|
||||||
|
from UM.Application import Application
|
||||||
|
|
||||||
class ConvexHullDecorator(SceneNodeDecorator):
|
class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -6,7 +7,19 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
self._convex_hull = None
|
self._convex_hull = None
|
||||||
self._convex_hull_node = None
|
self._convex_hull_node = None
|
||||||
self._convex_hull_job = None
|
self._convex_hull_job = None
|
||||||
|
settings = Application.getInstance().getActiveMachine()
|
||||||
|
print_sequence_setting = settings.getSettingByKey("print_sequence")
|
||||||
|
if print_sequence_setting:
|
||||||
|
print_sequence_setting.valueChanged.connect(self._onPrintSequenceSettingChanged)
|
||||||
|
|
||||||
|
def _onPrintSequenceSettingChanged(self, setting):
|
||||||
|
if self._convex_hull_job:
|
||||||
|
self._convex_hull_job.cancel()
|
||||||
|
self.setConvexHull(None)
|
||||||
|
if self._convex_hull_node:
|
||||||
|
self._convex_hull_node.setParent(None)
|
||||||
|
self._convex_hull_node = None
|
||||||
|
|
||||||
def getConvexHull(self):
|
def getConvexHull(self):
|
||||||
return self._convex_hull
|
return self._convex_hull
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,15 @@ class ConvexHullJob(Job):
|
||||||
|
|
||||||
# First, calculate the normal convex hull around the points
|
# First, calculate the normal convex hull around the points
|
||||||
hull = hull.getConvexHull()
|
hull = hull.getConvexHull()
|
||||||
#print("hull: " , self._node.callDecoration("isGroup"), " " , hull.getPoints())
|
|
||||||
# Then, do a Minkowski hull with a simple 1x1 quad to outset and round the normal convex hull.
|
# Then, do a Minkowski hull with a simple 1x1 quad to outset and round the normal convex hull.
|
||||||
|
# This is done because of rounding errors.
|
||||||
hull = hull.getMinkowskiHull(Polygon(numpy.array([[-1, -1], [-1, 1], [1, 1], [1, -1]], numpy.float32)))
|
hull = hull.getMinkowskiHull(Polygon(numpy.array([[-1, -1], [-1, 1], [1, 1], [1, -1]], numpy.float32)))
|
||||||
|
settings = Application.getInstance().getActiveMachine()
|
||||||
|
|
||||||
|
if settings.getSettingValueByKey("print_sequence") == "One at a time" and not self._node.getParent().callDecoration("isGroup"):
|
||||||
|
# Printing one at a time and it's not an object in a group
|
||||||
|
hull = hull.getMinkowskiHull(Polygon(numpy.array(settings.getSettingValueByKey("machine_head_polygon"),numpy.float32)))
|
||||||
hull_node = ConvexHullNode.ConvexHullNode(self._node, hull, Application.getInstance().getController().getScene().getRoot())
|
hull_node = ConvexHullNode.ConvexHullNode(self._node, hull, Application.getInstance().getController().getScene().getRoot())
|
||||||
self._node.callDecoration("setConvexHullNode", hull_node)
|
self._node.callDecoration("setConvexHullNode", hull_node)
|
||||||
self._node.callDecoration("setConvexHull", hull)
|
self._node.callDecoration("setConvexHull", hull)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue