From 7f11c0c3cfc0c44b47396b836e24832aedd1ba6e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 29 Dec 2015 15:08:09 +0100 Subject: [PATCH] Correct convex hull in one-at-a-time mode The new convex hull should be the hull with head and fans intersected with the mirrored head and fans. This is because it can determine the correct order to print the objects without getting the fans in the way as much as possible. Contributes to issue CURA-260. --- cura/ConvexHullJob.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cura/ConvexHullJob.py b/cura/ConvexHullJob.py index 2388d1c9aa..18810ffed0 100644 --- a/cura/ConvexHullJob.py +++ b/cura/ConvexHullJob.py @@ -54,7 +54,12 @@ class ConvexHullJob(Job): if profile.getSettingValue("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 self._node.callDecoration("setConvexHullBoundary", copy.deepcopy(hull)) - head_hull = hull.getMinkowskiHull(Polygon(numpy.array(profile.getSettingValue("machine_head_with_fans_polygon"),numpy.float32))) + head_and_fans = Polygon(numpy.array(profile.getSettingValue("machine_head_with_fans_polygon"), numpy.float32)) + mirrored = copy.deepcopy(head_and_fans) + mirrored.mirror([0, 0], [0, 1]) #Mirror horizontally. + mirrored.mirror([0, 0], [1, 0]) #Mirror vertically. + head_and_fans = head_and_fans.intersectionConvexHulls(mirrored) + head_hull = hull.getMinkowskiHull(head_and_fans) self._node.callDecoration("setConvexHullHead", head_hull) hull = hull.getMinkowskiHull(Polygon(numpy.array(profile.getSettingValue("machine_head_polygon"),numpy.float32))) else: