From c4c62cbba2228032d1a37d23f4834b0aba9e58bb Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 27 Sep 2019 14:15:31 +0200 Subject: [PATCH] Take nozzle offset into account in _getHeadAndFans() CURA-6785 --- cura/OneAtATimeIterator.py | 2 +- cura/Scene/ConvexHullDecorator.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cura/OneAtATimeIterator.py b/cura/OneAtATimeIterator.py index ab97534ff4..900eaf2273 100644 --- a/cura/OneAtATimeIterator.py +++ b/cura/OneAtATimeIterator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Ultimaker B.V. +# Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from UM.Scene.Iterator import Iterator diff --git a/cura/Scene/ConvexHullDecorator.py b/cura/Scene/ConvexHullDecorator.py index 2d8224eecc..bde7cde807 100644 --- a/cura/Scene/ConvexHullDecorator.py +++ b/cura/Scene/ConvexHullDecorator.py @@ -266,9 +266,13 @@ class ConvexHullDecorator(SceneNodeDecorator): return offset_hull def _getHeadAndFans(self) -> Polygon: - if self._global_stack: - return Polygon(numpy.array(self._global_stack.getHeadAndFansCoordinates(), numpy.float32)) - return Polygon() + if not self._global_stack: + return Polygon() + + polygon = Polygon(numpy.array(self._global_stack.getHeadAndFansCoordinates(), numpy.float32)) + offset_x = self._getSettingProperty("machine_nozzle_offset_x", "value") + offset_y = self._getSettingProperty("machine_nozzle_offset_y", "value") + return polygon.translate(-offset_x, -offset_y) def _compute2DConvexHeadFull(self) -> Optional[Polygon]: convex_hull = self._compute2DConvexHull()