mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
You can now remove bricks from a Brickschema model.
This commit is contained in:
@@ -50,6 +50,13 @@ Scenario: Assign brick reference
|
||||
When I press "bim.assign_brick_reference"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Add brick - vanilla brick with no IFC
|
||||
Given an empty Blender session
|
||||
And I press "bim.new_brick_file"
|
||||
And I set "scene.BIMBrickProperties.namespace" to "https://example.org/digitaltwin#"
|
||||
When I press "bim.add_brick"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Add brick - without a brick IFC library
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
@@ -58,7 +65,7 @@ Scenario: Add brick - without a brick IFC library
|
||||
And I press "bim.assign_class"
|
||||
And I press "bim.load_brick_project(filepath='{cwd}/test/files/spaces.ttl')"
|
||||
And the object "IfcChiller/Cube" is selected
|
||||
And I set "scene.BIMBrickProperties.namespace" to "http://example.org/digitaltwin#"
|
||||
And I set "scene.BIMBrickProperties.namespace" to "https://example.org/digitaltwin#"
|
||||
When I press "bim.add_brick"
|
||||
Then nothing happens
|
||||
|
||||
@@ -71,7 +78,7 @@ Scenario: Add brick - with a brick IFC library
|
||||
And I press "bim.load_brick_project(filepath='{cwd}/test/files/spaces.ttl')"
|
||||
And I press "bim.convert_brick_project"
|
||||
And the object "IfcChiller/Cube" is selected
|
||||
And I set "scene.BIMBrickProperties.namespace" to "http://example.org/digitaltwin#"
|
||||
And I set "scene.BIMBrickProperties.namespace" to "https://example.org/digitaltwin#"
|
||||
When I press "bim.add_brick"
|
||||
Then nothing happens
|
||||
|
||||
@@ -79,7 +86,7 @@ Scenario: Add brick feed
|
||||
Given an empty IFC project
|
||||
And I press "bim.load_brick_project(filepath='{cwd}/test/files/spaces.ttl')"
|
||||
And I press "bim.convert_brick_project"
|
||||
And I set "scene.BIMBrickProperties.namespace" to "http://example.org/digitaltwin#"
|
||||
And I set "scene.BIMBrickProperties.namespace" to "https://example.org/digitaltwin#"
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcUnitaryEquipment"
|
||||
@@ -101,7 +108,7 @@ Scenario: Convert IFC to brick
|
||||
Given an empty IFC project
|
||||
And I press "bim.load_brick_project(filepath='{cwd}/test/files/spaces.ttl')"
|
||||
And I press "bim.convert_brick_project"
|
||||
And I set "scene.BIMBrickProperties.namespace" to "http://example.org/digitaltwin#"
|
||||
And I set "scene.BIMBrickProperties.namespace" to "https://example.org/digitaltwin#"
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcUnitaryEquipment"
|
||||
@@ -120,3 +127,16 @@ Scenario: Refresh brick viewer
|
||||
And I press "bim.new_brick_file"
|
||||
When I press "bim.refresh_brick_viewer"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Remove brick - without a brick IFC library
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcChiller"
|
||||
And I press "bim.assign_class"
|
||||
And I press "bim.load_brick_project(filepath='{cwd}/test/files/spaces.ttl')"
|
||||
And the object "IfcChiller/Cube" is selected
|
||||
And I set "scene.BIMBrickProperties.namespace" to "https://example.org/digitaltwin#"
|
||||
And I press "bim.add_brick"
|
||||
When I press "bim.remove_brick"
|
||||
Then nothing happens
|
||||
|
||||
@@ -165,3 +165,23 @@ class TestRefreshBrickViewer:
|
||||
brick.run_view_brick_class(brick_class="class").should_be_called()
|
||||
brick.pop_brick_breadcrumb().should_be_called()
|
||||
subject.refresh_brick_viewer(brick)
|
||||
|
||||
|
||||
class TestRemoveBrick:
|
||||
def test_run(self, ifc, brick):
|
||||
brick.get_library_brick_reference("library", "brick_uri").should_be_called().will_return("reference")
|
||||
ifc.run("library.remove_reference", reference="reference").should_be_called()
|
||||
brick.remove_brick("brick_uri").should_be_called()
|
||||
brick.run_refresh_brick_viewer().should_be_called()
|
||||
subject.remove_brick(ifc, brick, library="library", brick_uri="brick_uri")
|
||||
|
||||
def test_do_not_remove_reference_if_no_reference_exists(self, ifc, brick):
|
||||
brick.get_library_brick_reference("library", "brick_uri").should_be_called().will_return(None)
|
||||
brick.remove_brick("brick_uri").should_be_called()
|
||||
brick.run_refresh_brick_viewer().should_be_called()
|
||||
subject.remove_brick(ifc, brick, library="library", brick_uri="brick_uri")
|
||||
|
||||
def test_do_not_check_references_if_no_library_specified(self, ifc, brick):
|
||||
brick.remove_brick("brick_uri").should_be_called()
|
||||
brick.run_refresh_brick_viewer().should_be_called()
|
||||
subject.remove_brick(ifc, brick, library=None, brick_uri="brick_uri")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@prefix digitaltwin: <http://example.org/digitaltwin#> .
|
||||
@prefix digitaltwin: <https://example.org/digitaltwin#> .
|
||||
@prefix brick: <https://brickschema.org/schema/Brick#> .
|
||||
@prefix unit: <http://qudt.org/vocab/unit/> .
|
||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||
|
||||
@@ -345,6 +345,18 @@ class TestPopBrickBreadcrumb(NewFile):
|
||||
assert bpy.context.scene.BIMBrickProperties.brick_breadcrumbs[0].name == "foo"
|
||||
|
||||
|
||||
class TestRemoveBrick(NewFile):
|
||||
def test_run(self):
|
||||
BrickStore.graph = brickschema.Graph()
|
||||
result = subject.add_brick("http://example.org/digitaltwin#", "https://brickschema.org/schema/Brick#Equipment")
|
||||
subject.remove_brick(result)
|
||||
assert not list(
|
||||
BrickStore.graph.triples(
|
||||
(URIRef(result), None, None)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class TestRunAssignBrickReference(NewFile):
|
||||
def test_nothing(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user