From a37ab8f4b1e61e3cc33c4e21d245cf688f2bfc83 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 11 Nov 2016 12:46:53 +0100 Subject: [PATCH] Use approximated circle for the prime polygons It's much easier to create, more obvious code, and better approximates the area that we seek to use for our prime location. Contributes to issue CURA-2625. --- cura/BuildVolume.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index ad478976e1..d5d19b9bc7 100644 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -401,13 +401,8 @@ class BuildVolume(SceneNode): prime_x = extruder.getProperty("extruder_prime_pos_x", "value") - machine_width / 2 prime_y = machine_depth / 2 - extruder.getProperty("extruder_prime_pos_y", "value") - prime_polygon = Polygon([ - [prime_x - PRIME_CLEARANCE, prime_y - PRIME_CLEARANCE], - [prime_x + PRIME_CLEARANCE, prime_y - PRIME_CLEARANCE], - [prime_x + PRIME_CLEARANCE, prime_y + PRIME_CLEARANCE], - [prime_x - PRIME_CLEARANCE, prime_y + PRIME_CLEARANCE], - ]) - prime_polygon = prime_polygon.getMinkowskiHull(Polygon.approximatedCircle(0)) + prime_polygon = Polygon.approximatedCircle(PRIME_CLEARANCE) + prime_polygon = prime_polygon.translate(prime_x, prime_y) collision = False # Check if prime polygon is intersecting with any of the other disallowed areas. @@ -469,6 +464,16 @@ class BuildVolume(SceneNode): self._has_errors = prime_tower_collision or prime_collision self._disallowed_areas = result_areas + ## Computes the disallowed areas for objects that are printed. + # + # These disallowed areas are not offset with the negative of the nozzle + # offset, since the engine already performs the offset for us to make sure + # they are printed in head-coordinates instead of nozzle-coordinates. + # + # \return A list of polygons that represent the disallowed areas. + def _computeDisallowedAreasPrinted(self): + result = [] + ## Computes the disallowed areas that are statically placed in the machine. # # These disallowed areas need to be offset with the negative of the nozzle