Fixed split with nested Compounds Issue #698

This commit is contained in:
gumyr 2024-10-04 11:40:25 -04:00
parent 2864f0556a
commit f1a9c58900
2 changed files with 9 additions and 5 deletions

View file

@ -2760,13 +2760,11 @@ class Shape(NodeMixin):
# Perform the splitting operation
splitter.Build()
if keep == Keep.BOTH:
result = Compound(downcast(splitter.Shape()))
else:
parts = list(Compound(downcast(splitter.Shape())))
result = Compound(downcast(splitter.Shape())).unwrap(fully=False)
if keep != Keep.BOTH:
tops = []
bottoms = []
for part in parts:
for part in result:
if plane.to_local_coords(part).center().Z >= 0:
tops.append(part)
else:

View file

@ -462,6 +462,12 @@ class TestSplit(unittest.TestCase):
split(bisect_by=Plane.YZ, keep=Keep.TOP)
self.assertAlmostEqual(test.part.volume, (2 / 3) * 1000 * pi, 5)
def test_wrapped_object(self):
obj = Box(1, 1, 1)
obj = fillet(obj.edges().group_by(Axis.Z)[-1], 0.1)
right = split(obj, bisect_by=Plane.YZ, keep=Keep.TOP)
self.assertLess(right.volume, obj.volume)
class TestThicken(unittest.TestCase):
def test_thicken(self):