From 3f42824ffa62324aa17b09591ac2c9f57de3df6d Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 18 Nov 2025 11:48:40 -0600 Subject: [PATCH] Part: fix splitting of a split that is a container / group (#25293) --- src/Mod/Part/BOPTools/SplitFeatures.py | 34 ++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/BOPTools/SplitFeatures.py b/src/Mod/Part/BOPTools/SplitFeatures.py index 05c8e08e29..9360179f03 100644 --- a/src/Mod/Part/BOPTools/SplitFeatures.py +++ b/src/Mod/Part/BOPTools/SplitFeatures.py @@ -299,9 +299,39 @@ class FeatureSlice: def execute(self, selfobj): if len(selfobj.Tools) < 1: raise ValueError("No slicing objects supplied!") + + # helper function to get the shape from object or group + def get_shape(obj): + """get shape from a part object or compound from a group.""" + if hasattr(obj, "Shape"): + return obj.Shape + elif hasattr(obj, "Group"): # it's a group/container from ie. slice apart + shapes = [] + for child in obj.Group: + if hasattr(child, "Shape"): + shapes.append(child.Shape) + if shapes: + return Part.makeCompound(shapes) + return None + + # get base shape + base_shape = get_shape(selfobj.Base) + if base_shape is None or base_shape.isNull(): + raise ValueError("Base object has no valid shape!") + + # get tool shapes + tool_shapes = [] + for tool in selfobj.Tools: + shape = get_shape(tool) + if shape is not None and not shape.isNull(): + tool_shapes.append(shape) + + if len(tool_shapes) < 1: + raise ValueError("No valid tool shapes available") + selfobj.Shape = SplitAPI.slice( - selfobj.Base.Shape, - [obj.Shape for obj in selfobj.Tools], + base_shape, + tool_shapes, selfobj.Mode, selfobj.Tolerance, )