mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Assigning library references now works on IFC2X3.
This commit is contained in:
@@ -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,)
|
||||
|
||||
Reference in New Issue
Block a user