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.
This commit is contained in:
Ghostkeeper 2020-09-02 00:51:58 +02:00
parent d189485043
commit af03bc8f24
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -380,6 +380,10 @@ class ConvexHullDecorator(SceneNodeDecorator):
influences the collision area. 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( horizontal_expansion = max(
self._getSettingProperty("xy_offset", "value"), self._getSettingProperty("xy_offset", "value"),
self._getSettingProperty("xy_offset_layer_0", "value") self._getSettingProperty("xy_offset_layer_0", "value")
@ -396,9 +400,9 @@ class ConvexHullDecorator(SceneNodeDecorator):
[hull_offset, hull_offset], [hull_offset, hull_offset],
[hull_offset, -hull_offset] [hull_offset, -hull_offset]
], numpy.float32)) ], numpy.float32))
return convex_hull.getMinkowskiHull(expansion_polygon) return result.getMinkowskiHull(expansion_polygon)
else: else:
return convex_hull return result
def _onChanged(self, *args) -> None: def _onChanged(self, *args) -> None:
self._raft_thickness = self._build_volume.getRaftThickness() self._raft_thickness = self._build_volume.getRaftThickness()
@ -469,7 +473,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
"adhesion_type", "raft_margin", "print_sequence", "adhesion_type", "raft_margin", "print_sequence",
"skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"] "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. """Settings that change the convex hull.
If these settings change, the convex hull should be recalculated. If these settings change, the convex hull should be recalculated.