From a57a0eb4eb22c6c8b6a366181b8e28a5dd550088 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 19 Jan 2025 01:09:11 +1100 Subject: [PATCH] See #5972. Prioritise clipping results where possible. --- .../ifcopenshell/api/geometry/add_boolean.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_boolean.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_boolean.py index 105c4d4d65..f5d0a31456 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_boolean.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_boolean.py @@ -106,7 +106,18 @@ def add_boolean( first.Closed = True # For now, trust the user to do the right thing. if second_item.is_a("IfcTesselatedFaceSet"): second_item.Closed = True # For now, trust the user to do the right thing. - first = file.create_entity("IfcBooleanResult", operator, first, second_item) + if ( + operator == "DIFFERENCE" + and second_item.is_a("IfcHalfSpaceSolid") + and ( + first.is_a("IfcSweptAreaSolid") + or first.is_a("IfcSweptDiskSolid") + or first.is_a("IfcBooleanClippingResult") + ) + ): + first = file.create_entity("IfcBooleanClippingResult", operator, first, second_item) + else: + first = file.create_entity("IfcBooleanResult", operator, first, second_item) booleans.append(first) for inverse in to_replace: