You can now associate IFC elements with Brick elements and navigate to them

This commit is contained in:
Dion Moult
2021-11-17 13:27:07 +11:00
parent da6945b352
commit f9221717ff
12 changed files with 248 additions and 3 deletions
+29 -1
View File
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.core.brick as subject
from test.core.bootstrap import brick
from test.core.bootstrap import ifc, brick
class TestLoadBrickProject:
@@ -64,3 +64,31 @@ class TestCloseBrickProject:
def test_run(self, brick):
brick.clear_project().should_be_called()
subject.close_brick_project(brick)
class TestConvertBrickProject:
def test_run(self, ifc, brick):
brick.get_brick_path_name().should_be_called().will_return("foo.ttl")
ifc.run("library.add_library", name="foo.ttl").should_be_called().will_return("library")
brick.get_brick_path().should_be_called().will_return("/path/to/foo.ttl")
ifc.run(
"library.edit_library", library="library", attributes={"Location": "/path/to/foo.ttl"}
).should_be_called()
subject.convert_brick_project(ifc, brick)
class TestAssignBrickReference:
def test_assigning_to_a_new_reference(self, ifc, brick):
brick.get_library_brick_reference("library", "brick").should_be_called().will_return(None)
ifc.run("library.add_reference", library="library").should_be_called().will_return("reference")
brick.export_brick_attributes("brick").should_be_called().will_return("attributes")
ifc.run("library.edit_reference", reference="reference", attributes="attributes").should_be_called()
ifc.get_entity("obj").should_be_called().will_return("product")
ifc.run("library.assign_reference", product="product", reference="reference").should_be_called()
subject.assign_brick_reference(ifc, brick, obj="obj", library="library", brick_uri="brick")
def test_assigning_to_an_existing_reference(self, ifc, brick):
brick.get_library_brick_reference("library", "brick").should_be_called().will_return("reference")
ifc.get_entity("obj").should_be_called().will_return("product")
ifc.run("library.assign_reference", product="product", reference="reference").should_be_called()
subject.assign_brick_reference(ifc, brick, obj="obj", library="library", brick_uri="brick")