Fix #3547. Bug where using existing clippings were not preserved when editing profile or wall representations.

This commit is contained in:
Dion Moult
2023-08-08 22:35:27 +10:00
parent 706aa70899
commit e43347161a
2 changed files with 12 additions and 4 deletions
@@ -63,7 +63,11 @@ class Usecase:
def apply_clippings(self, first_operand):
while self.settings["clippings"]:
clipping = self.settings["clippings"].pop()
if clipping["operand_type"] == "IfcHalfSpaceSolid":
if isinstance(clipping, ifcopenshell.entity_instance):
new = ifcopenshell.util.element.copy(self.file, clipping)
new.FirstOperand = first_operand
first_operand = new
elif clipping["operand_type"] == "IfcHalfSpaceSolid":
matrix = clipping["matrix"]
second_operand = self.file.createIfcHalfSpaceSolid(
self.file.createIfcPlane(
@@ -81,7 +85,7 @@ class Usecase:
),
False,
)
first_operand = self.file.create_entity(clipping["type"], "DIFFERENCE", first_operand, second_operand)
first_operand = self.file.create_entity(clipping["type"], "DIFFERENCE", first_operand, second_operand)
return first_operand
def convert_si_to_unit(self, co):
@@ -95,7 +95,11 @@ class Usecase:
def apply_clippings(self, first_operand):
while self.settings["clippings"]:
clipping = self.settings["clippings"].pop()
if clipping["operand_type"] == "IfcHalfSpaceSolid":
if isinstance(clipping, ifcopenshell.entity_instance):
new = ifcopenshell.util.element.copy(self.file, clipping)
new.FirstOperand = first_operand
first_operand = new
elif clipping["operand_type"] == "IfcHalfSpaceSolid":
matrix = clipping["matrix"]
second_operand = self.file.createIfcHalfSpaceSolid(
self.file.createIfcPlane(
@@ -113,7 +117,7 @@ class Usecase:
),
False,
)
first_operand = self.file.create_entity(clipping["type"], "DIFFERENCE", first_operand, second_operand)
first_operand = self.file.create_entity(clipping["type"], "DIFFERENCE", first_operand, second_operand)
return first_operand
def convert_si_to_unit(self, co):