mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
You can now partially load an IFC filtered by spatial containers.
This commit is contained in:
@@ -129,6 +129,10 @@ def an_ifc_file_exists():
|
||||
return ifc
|
||||
|
||||
|
||||
def the_object_name_does_not_exist(name):
|
||||
assert bpy.data.objects.get(name) is None, "Object exists"
|
||||
|
||||
|
||||
def the_object_name_is_an_ifc_class(name, ifc_class):
|
||||
ifc = an_ifc_file_exists()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
@@ -245,6 +249,7 @@ definitions = {
|
||||
'"(.*)" is "(.*)"': prop_is_value,
|
||||
'I enable "(.*)"': i_enable_prop,
|
||||
'I press "(.*)"': i_press_operator,
|
||||
'the object "(.*)" does not exist': the_object_name_does_not_exist,
|
||||
'the object "(.*)" is an "(.*)"': the_object_name_is_an_ifc_class,
|
||||
'the object "(.*)" is not an IFC element': the_object_name_is_not_an_ifc_element,
|
||||
'the object "(.*)" is in the collection "(.*)"': the_object_name_is_in_the_collection_collection,
|
||||
|
||||
@@ -52,7 +52,8 @@ class TestLoadProjectElements(test.bim.bootstrap.NewFile):
|
||||
return """
|
||||
Given I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
|
||||
When I set "scene.BIMProjectProperties.collection_mode" to "DECOMPOSITION"
|
||||
And I press "bim.load_project_elements(mode='ALL')"
|
||||
And I set "scene.BIMProjectProperties.filter_mode" to "NONE"
|
||||
And I press "bim.load_project_elements"
|
||||
Then the object "IfcProject/My Project" is an "IfcProject"
|
||||
And the object "IfcSite/My Site" is an "IfcSite"
|
||||
And the object "IfcBuilding/My Building" is an "IfcBuilding"
|
||||
@@ -68,3 +69,28 @@ class TestLoadProjectElements(test.bim.bootstrap.NewFile):
|
||||
And the object "IfcWall/Wall" is in the collection "IfcBuildingStorey/Level 1"
|
||||
And "scene.BIMProjectProperties.is_loading" is "False"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_loading_objects_filtered_by_decomposition(self):
|
||||
return """
|
||||
Given I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
|
||||
When I set "scene.BIMProjectProperties.collection_mode" to "DECOMPOSITION"
|
||||
And I set "scene.BIMProjectProperties.filter_mode" to "DECOMPOSITION"
|
||||
Then "scene.BIMProjectProperties.filter_categories['IfcSite/My Site'].total_elements" is "0"
|
||||
Then "scene.BIMProjectProperties.filter_categories['IfcBuilding/My Building'].total_elements" is "0"
|
||||
Then "scene.BIMProjectProperties.filter_categories['IfcBuildingStorey/Ground Floor'].total_elements" is "1"
|
||||
Then "scene.BIMProjectProperties.filter_categories['IfcBuildingStorey/Level 1'].total_elements" is "1"
|
||||
When I set "scene.BIMProjectProperties.filter_categories['IfcBuildingStorey/Ground Floor'].is_selected" to "True"
|
||||
And I press "bim.load_project_elements"
|
||||
Then the object "IfcProject/My Project" is an "IfcProject"
|
||||
And the object "IfcSite/My Site" is an "IfcSite"
|
||||
And the object "IfcBuilding/My Building" is an "IfcBuilding"
|
||||
And the object "IfcBuildingStorey/Ground Floor" is an "IfcBuildingStorey"
|
||||
And the object "IfcSlab/Slab" is an "IfcSlab"
|
||||
And the object "IfcSite/My Site" is in the collection "IfcSite/My Site"
|
||||
And the object "IfcBuilding/My Building" is in the collection "IfcBuilding/My Building"
|
||||
And the object "IfcBuildingStorey/Ground Floor" is in the collection "IfcBuildingStorey/Ground Floor"
|
||||
And the object "IfcSlab/Slab" is in the collection "IfcBuildingStorey/Ground Floor"
|
||||
And the object "IfcBuildingStorey/Level 1" does not exist
|
||||
And the object "IfcWall/Wall" does not exist
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user