mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
You can now associate IFC elements with Brick elements and navigate to them
This commit is contained in:
@@ -11,4 +11,10 @@ class Usecase:
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
if self.file.schema == "IFC2X3":
|
||||
reference = self.file.createIfcLibraryReference()
|
||||
references = list(self.settings["library"].LibraryReference or [])
|
||||
references.append(reference)
|
||||
self.settings["library"].LibraryReference = references
|
||||
return reference
|
||||
return self.file.createIfcLibraryReference(ReferencedLibrary=self.settings["library"])
|
||||
|
||||
@@ -8,3 +8,11 @@ class TestAddReference(test.bootstrap.IFC4):
|
||||
reference = ifcopenshell.api.run("library.add_reference", self.file, library=library)
|
||||
assert reference.is_a("IfcLibraryReference")
|
||||
assert reference.ReferencedLibrary == library
|
||||
|
||||
|
||||
class TestAddReferenceIFC2X3(test.bootstrap.IFC2X3):
|
||||
def test_adding_a_reference(self):
|
||||
library = ifcopenshell.api.run("library.add_library", self.file, name="Name")
|
||||
reference = ifcopenshell.api.run("library.add_reference", self.file, library=library)
|
||||
assert reference.is_a("IfcLibraryReference")
|
||||
assert library.LibraryReference == (reference,)
|
||||
|
||||
Reference in New Issue
Block a user