diff options
author | Ghostkeeper <rubend@tutanota.com> | 2020-09-02 01:51:58 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2020-09-02 01:51:58 +0300 |
commit | af03bc8f246b95a1a7cb218bf9b26ab5ba81bb65 (patch) | |
tree | 3c737ba3f36442aaf6639d0eeb1ec41eae1742ab | |
parent | d18948504322a59fccc5a5f7a031377617f4b266 (diff) |
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.
-rw-r--r-- | cura/Scene/ConvexHullDecorator.py | 10 |
1 files changed, 7 insertions, 3 deletions
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. |