From aae06fe0fafc708d482253af588bff90b8fd678e Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 18 Jan 2019 12:54:42 +0100 Subject: [PATCH] Prevent calculations with brim width larger than build-plate. [CURA-6094] --- cura/BuildVolume.py | 6 ++++++ cura/Scene/ConvexHullDecorator.py | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index aa1f170707..fb13a32732 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -1043,6 +1043,12 @@ class BuildVolume(SceneNode): else: raise Exception("Unknown bed adhesion type. Did you forget to update the build volume calculations for your new bed adhesion type?") + max_length_available = 0.5 * min( + self._global_container_stack.getProperty("machine_width", "value"), + self._global_container_stack.getProperty("machine_depth", "value") + ) + bed_adhesion_size = min(bed_adhesion_size, max_length_available) + support_expansion = 0 support_enabled = self._global_container_stack.getProperty("support_enable", "value") support_offset = self._global_container_stack.getProperty("support_offset", "value") diff --git a/cura/Scene/ConvexHullDecorator.py b/cura/Scene/ConvexHullDecorator.py index 661106dec7..e37823b400 100644 --- a/cura/Scene/ConvexHullDecorator.py +++ b/cura/Scene/ConvexHullDecorator.py @@ -289,16 +289,21 @@ class ConvexHullDecorator(SceneNodeDecorator): # Add extra margin depending on adhesion type adhesion_type = self._global_stack.getProperty("adhesion_type", "value") + max_length_available = 0.5 * min( + self._getSettingProperty("machine_width", "value"), + self._getSettingProperty("machine_depth", "value") + ) + if adhesion_type == "raft": - extra_margin = max(0, self._getSettingProperty("raft_margin", "value")) + extra_margin = min(max_length_available, max(0, self._getSettingProperty("raft_margin", "value"))) elif adhesion_type == "brim": - extra_margin = max(0, self._getSettingProperty("brim_line_count", "value") * self._getSettingProperty("skirt_brim_line_width", "value")) + extra_margin = min(max_length_available, max(0, self._getSettingProperty("brim_line_count", "value") * self._getSettingProperty("skirt_brim_line_width", "value"))) elif adhesion_type == "none": extra_margin = 0 elif adhesion_type == "skirt": - extra_margin = max( + extra_margin = min(max_length_available, max( 0, self._getSettingProperty("skirt_gap", "value") + - self._getSettingProperty("skirt_line_count", "value") * self._getSettingProperty("skirt_brim_line_width", "value")) + self._getSettingProperty("skirt_line_count", "value") * self._getSettingProperty("skirt_brim_line_width", "value"))) else: raise Exception("Unknown bed adhesion type. Did you forget to update the convex hull calculations for your new bed adhesion type?")