mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fix #3605. Bug where invalid representation type was created when booleans are added / removed.
This commit is contained in:
@@ -39,15 +39,29 @@ class Usecase:
|
||||
|
||||
def execute(self):
|
||||
self.settings["unit_scale"] = ifcopenshell.util.unit.calculate_unit_scale(self.file)
|
||||
self.settings["representation"].RepresentationType = "Clipping"
|
||||
if self.settings["type"] == "IfcHalfSpaceSolid":
|
||||
result = self.create_half_space_solid()
|
||||
elif self.settings["type"] == "Mesh":
|
||||
if self.settings["blender_obj"]:
|
||||
result = self.create_blender_mesh()
|
||||
representation_type = "Clipping"
|
||||
items = []
|
||||
for item in self.settings["representation"].Items:
|
||||
items.append(self.file.createIfcBooleanResult(self.settings["operator"], item, result))
|
||||
if self.settings["operator"] == "DIFFERENCE":
|
||||
queue = [item]
|
||||
while queue:
|
||||
queue_item = queue.pop()
|
||||
if queue_item.is_a() == "IfcBooleanResult":
|
||||
representation_type = "CSG"
|
||||
break
|
||||
if queue_item.is_a("IfcBooleanClippingResult"):
|
||||
queue.append(item.FirstOperand)
|
||||
queue.append(item.SecondOperand)
|
||||
items.append(self.file.createIfcBooleanClippingResult(self.settings["operator"], item, result))
|
||||
else:
|
||||
representation_type = "CSG"
|
||||
items.append(self.file.createIfcBooleanResult(self.settings["operator"], item, result))
|
||||
self.settings["representation"].RepresentationType = representation_type
|
||||
self.settings["representation"].Items = items
|
||||
|
||||
def create_half_space_solid(self):
|
||||
|
||||
@@ -42,8 +42,13 @@ class Usecase:
|
||||
self.file.remove(item)
|
||||
ifcopenshell.util.element.remove_deep2(self.file, second_operand)
|
||||
|
||||
if not [i for i in representation.Items if i.is_a("IfcBooleanResult")]:
|
||||
representation.RepresentationType == "SweptSolid"
|
||||
item_classes = {i.is_a() for i in representation.Items}
|
||||
if "IfcBooleanResult" in item_classes:
|
||||
representation.RepresentationType = "CSG"
|
||||
elif "IfcBooleanClippingResult" in item_classes:
|
||||
representation.RepresentationType = "Clipping"
|
||||
else:
|
||||
representation.RepresentationType = "SweptSolid"
|
||||
|
||||
def get_representation(self, item):
|
||||
for inverse in self.file.get_inverse(item):
|
||||
|
||||
Reference in New Issue
Block a user