From aeef5b0b1bb97e54dcdcf8dcd5bed26e9fa57eec Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 4 Jan 2016 15:33:11 +0100 Subject: [PATCH] Hacked some stuff to build volume. Fixes CURA-435 --- cura/BuildVolume.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index fddd6a5369..2146f642a9 100644 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -130,8 +130,11 @@ class BuildVolume(SceneNode): mb.addFace(first, previous_point, new_point, color = color) previous_point = new_point - # Find the largest disallowed area to exclude it from the maximum scale bounds - size = abs(numpy.max(points[:, 1]) - numpy.min(points[:, 1])) + # Find the largest disallowed area to exclude it from the maximum scale bounds. + # This is a very nasty hack. This pretty much only works for UM machines. This disallowed area_size needs + # A -lot- of rework at some point in the future: TODO + if numpy.min(points[:, 1]) >= 0: # This filters out all areas that have points to the left of the centre. This is done to filter the skirt area. + size = abs(numpy.max(points[:, 1]) - numpy.min(points[:, 1])) disallowed_area_size = max(size, disallowed_area_size) self._disallowed_area_mesh = mb.getData() @@ -146,9 +149,12 @@ class BuildVolume(SceneNode): if profile: skirt_size = self._getSkirtSize(profile) + # As this works better for UM machines, we only add the dissallowed_area_size for the z direction. + # This is probably wrong in all other cases. TODO! + # The +2 and -2 is added as there is always a bit of extra room required to work properly. scale_to_max_bounds = AxisAlignedBox( - minimum = Vector(min_w + skirt_size, min_h, min_d + skirt_size + disallowed_area_size), - maximum = Vector(max_w - skirt_size, max_h, max_d - skirt_size - disallowed_area_size) + minimum = Vector(min_w + skirt_size + 2, min_h, min_d + disallowed_area_size), + maximum = Vector(max_w - skirt_size - 2, max_h, max_d - disallowed_area_size) ) Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds @@ -192,6 +198,7 @@ class BuildVolume(SceneNode): skirt_size = self._getSkirtSize(self._active_profile) if disallowed_areas: + # Extend every area already in the disallowed_areas with the skirt size. for area in disallowed_areas: poly = Polygon(numpy.array(area, numpy.float32)) poly = poly.getMinkowskiHull(Polygon(numpy.array([ @@ -207,6 +214,7 @@ class BuildVolume(SceneNode): areas.append(poly) + # Add the skirt areas arround the borders of the build plate. if skirt_size > 0: half_machine_width = self._active_instance.getMachineSettingValue("machine_width") / 2 half_machine_depth = self._active_instance.getMachineSettingValue("machine_depth") / 2