From af03bc8f246b95a1a7cb218bf9b26ab5ba81bb65 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 2 Sep 2020 00:51:58 +0200 Subject: Adjust collision area based on shrinkage compensation ratio So now if the model is grown due to shrinkage compensation, its collision area will also grow. This prevents objects adjacent to each other from hitting each other. Contributes to issue CURA-7118. --- cura/Scene/ConvexHullDecorator.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cura/Scene') diff --git a/cura/Scene/ConvexHullDecorator.py b/cura/Scene/ConvexHullDecorator.py index 6717a98dcd..9e3e4e1a38 100644 --- a/cura/Scene/ConvexHullDecorator.py +++ b/cura/Scene/ConvexHullDecorator.py @@ -380,6 +380,10 @@ class ConvexHullDecorator(SceneNodeDecorator): influences the collision area. """ + scale_factor = self._getSettingProperty("material_shrinkage_percentage") / 100.0 + center = self.getNode().getBoundingBox().center + result = convex_hull.scale(scale_factor, [center.x, center.z]) # Yes, use Z instead of Y. Mixed conventions there with how the OpenGL coordinates are transmitted. + horizontal_expansion = max( self._getSettingProperty("xy_offset", "value"), self._getSettingProperty("xy_offset_layer_0", "value") @@ -396,9 +400,9 @@ class ConvexHullDecorator(SceneNodeDecorator): [hull_offset, hull_offset], [hull_offset, -hull_offset] ], numpy.float32)) - return convex_hull.getMinkowskiHull(expansion_polygon) + return result.getMinkowskiHull(expansion_polygon) else: - return convex_hull + return result def _onChanged(self, *args) -> None: self._raft_thickness = self._build_volume.getRaftThickness() @@ -469,7 +473,7 @@ class ConvexHullDecorator(SceneNodeDecorator): "adhesion_type", "raft_margin", "print_sequence", "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"] - _influencing_settings = {"xy_offset", "xy_offset_layer_0", "mold_enabled", "mold_width", "anti_overhang_mesh", "infill_mesh", "cutting_mesh"} + _influencing_settings = {"xy_offset", "xy_offset_layer_0", "mold_enabled", "mold_width", "anti_overhang_mesh", "infill_mesh", "cutting_mesh", "material_shrinkage_percentage"} """Settings that change the convex hull. If these settings change, the convex hull should be recalculated. -- cgit v1.2.3