mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix and test importing style attributes twice (#1784)
* Test importing surface attributes twice * Fix style attributes not cleared when re-importing
This commit is contained in:
@@ -103,6 +103,7 @@ class Style(blenderbim.core.tool.Style):
|
||||
|
||||
@classmethod
|
||||
def import_surface_attributes(cls, style, obj):
|
||||
obj.BIMStyleProperties.attributes.clear()
|
||||
blenderbim.bim.helper.import_attributes2(style, obj.BIMStyleProperties.attributes)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -163,6 +163,19 @@ class TestImportSurfaceAttributes(NewFile):
|
||||
assert obj.BIMStyleProperties.attributes.get("Name").string_value == "Name"
|
||||
assert obj.BIMStyleProperties.attributes.get("Side").enum_value == "BOTH"
|
||||
|
||||
def test_importing_surface_attributes_twice(self):
|
||||
ifc = ifcopenshell.file()
|
||||
style = ifc.createIfcSurfaceStyle("Name", "BOTH")
|
||||
obj = bpy.data.materials.new("Material")
|
||||
subject.import_surface_attributes(style, obj)
|
||||
assert len(obj.BIMStyleProperties.attributes) == 2
|
||||
assert obj.BIMStyleProperties.attributes.get("Name").string_value == "Name"
|
||||
assert obj.BIMStyleProperties.attributes.get("Side").enum_value == "BOTH"
|
||||
subject.import_surface_attributes(style, obj)
|
||||
assert len(obj.BIMStyleProperties.attributes) == 2
|
||||
assert obj.BIMStyleProperties.attributes.get("Name").string_value == "Name"
|
||||
assert obj.BIMStyleProperties.attributes.get("Side").enum_value == "BOTH"
|
||||
|
||||
|
||||
class TestLink(NewFile):
|
||||
def test_run(self):
|
||||
|
||||
Reference in New Issue
Block a user