You can now associate annotations with objects for smart annotations in IFC. See #1153.

This commit is contained in:
Dion Moult
2022-01-14 18:00:08 +11:00
parent 258ca7fb8c
commit f8c7f48674
15 changed files with 311 additions and 73 deletions
+49
View File
@@ -37,6 +37,14 @@ class TestDisableEditingText(NewFile):
assert obj.BIMTextProperties.is_editing == False
class TestDisableEditingTextProduct(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", None)
obj.BIMTextProperties.is_editing_product = True
subject.disable_editing_text_product(obj)
assert obj.BIMTextProperties.is_editing_product == False
class TestEnableEditingText(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", None)
@@ -44,6 +52,13 @@ class TestEnableEditingText(NewFile):
assert obj.BIMTextProperties.is_editing == True
class TestEnableEditingTextProduct(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", None)
subject.enable_editing_text_product(obj)
assert obj.BIMTextProperties.is_editing_product == True
class TestExportTextLiteralAttributes(NewFile):
def test_run(self):
TestImportTextAttributes().test_run()
@@ -69,6 +84,16 @@ class TestGetTextLiteral(NewFile):
assert subject.get_text_literal(obj) == item
class TestGetTextProduct(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
wall = ifc.createIfcWall()
label = ifc.createIfcAnnotation()
ifcopenshell.api.run("drawing.assign_product", ifc, relating_product=wall, related_object=label)
assert subject.get_text_product(label) == wall
class TestImportTextAttributes(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
@@ -88,6 +113,30 @@ class TestImportTextAttributes(NewFile):
assert props.attributes.get("BoxAlignment").string_value == "BoxAlignment"
class TestImportTextProduct(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
wall = ifc.createIfcWall()
label = ifc.createIfcAnnotation()
ifcopenshell.api.run("drawing.assign_product", ifc, relating_product=wall, related_object=label)
wall_obj = bpy.data.objects.new("Object", None)
label_obj = bpy.data.objects.new("Object", None)
tool.Ifc.link(wall, wall_obj)
tool.Ifc.link(label, label_obj)
subject.import_text_product(label_obj)
assert label_obj.BIMTextProperties.relating_product == wall_obj
def test_doing_nothing_if_no_product_to_import(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
label = ifc.createIfcAnnotation()
label_obj = bpy.data.objects.new("Object", None)
tool.Ifc.link(label, label_obj)
subject.import_text_product(label_obj)
assert label_obj.BIMTextProperties.relating_product is None
class TestUpdateTextValue(NewFile):
def test_run(self):
TestGetTextLiteral().test_run()