Assigning library references now works on IFC2X3.

This commit is contained in:
Dion Moult
2021-11-29 20:16:25 +11:00
parent c0f547c6e4
commit d638405ff8
2 changed files with 29 additions and 1 deletions
@@ -18,3 +18,23 @@ class TestAssignReference(test.bootstrap.IFC4):
ifcopenshell.api.run("library.assign_reference", self.file, product=product, reference=reference)
ifcopenshell.api.run("library.assign_reference", self.file, product=product, reference=reference)
assert reference.LibraryRefForObjects[0].RelatedObjects == (product,)
class TestAssignReference(test.bootstrap.IFC2X3):
def test_assigning_a_reference(self):
reference = self.file.createIfcLibraryReference()
product = self.file.createIfcWall()
product2 = self.file.createIfcWall()
ifcopenshell.api.run("library.assign_reference", self.file, product=product, reference=reference)
rel = self.file.by_type("IfcRelAssociatesLibrary")[0]
assert rel.RelatedObjects == (product,)
ifcopenshell.api.run("library.assign_reference", self.file, product=product2, reference=reference)
assert rel.RelatedObjects == (product, product2)
def test_not_assigning_twice(self):
reference = self.file.createIfcLibraryReference()
product = self.file.createIfcWall()
ifcopenshell.api.run("library.assign_reference", self.file, product=product, reference=reference)
ifcopenshell.api.run("library.assign_reference", self.file, product=product, reference=reference)
rel = self.file.by_type("IfcRelAssociatesLibrary")[0]
assert rel.RelatedObjects == (product,)