style.remove_style to handle IfcFillAreaStyleHatching

This commit is contained in:
Andrej730
2024-10-01 15:15:31 +05:00
parent 4b39631b98
commit 19f1c87437
2 changed files with 40 additions and 5 deletions
@@ -18,6 +18,7 @@
import pytest
import test.bootstrap
import ifcopenshell.api.material
import ifcopenshell.api.style
@@ -46,6 +47,28 @@ class TestRemoveStyle(test.bootstrap.IFC4):
ifcopenshell.api.style.remove_style(self.file, style=style)
assert len(self.file.by_type("IfcPresentationStyle")) == 0
def test_remove_curve_style_with_curve_style_hatching(self):
element = self.file.create_entity("IfcWall")
material = ifcopenshell.api.material.add_material(self.file)
ifcopenshell.api.material.assign_material(self.file, products=[element], material=material)
curve_style = self.file.create_entity("IfcCurveStyle")
fill_style = self.file.create_entity("IfcFillAreaStyleHatching", HatchLineAppearance=curve_style)
style = self.file.create_entity("IfcFillAreaStyle", FillStyles=[fill_style])
self.file.create_entity(
"IfcMaterialDefinitionRepresentation",
RepresentedMaterial=material,
Representations=[
self.file.create_entity(
"IfcStyledRepresentation",
Items=[self.file.create_entity("IfcStyledItem", Styles=[style])],
)
],
)
ifcopenshell.api.style.remove_style(self.file, curve_style)
assert len(self.file.by_type("IfcPresentationStyle")) == 0
assert len(self.file.by_type("IfcMaterialDefinitionRepresentation")) == 0
assert len(self.file.by_type("IfcStyledRepresentation")) == 0
class TestRemoveStyleIFC2X3(test.bootstrap.IFC2X3, TestRemoveStyle):
pass