fix materials / styles bim tests #4843

This commit is contained in:
Andrej730
2024-07-29 17:51:13 +05:00
parent 5e849d7b81
commit 52130a3eb6
10 changed files with 190 additions and 174 deletions
@@ -192,13 +192,14 @@ Scenario: Add classification reference - material
And the variable "classification" is "{classification_ifc}.by_type('IfcClassification')[0].id()"
And I set "scene.BIMClassificationProperties.available_classifications" to "{classification}"
And I press "bim.add_classification"
And I add a cube
And I add a material
And I press "bim.add_material(obj='Material')"
And I press "bim.add_material(name='Material')"
And I press "bim.load_materials"
And I press "bim.expand_material_category(category='Uncategorised')"
And I set "scene.BIMMaterialProperties.active_material_index" to "1"
And the variable "material" is "{ifc}.by_type('IfcMaterial')[0].id()"
And I press "bim.change_classification_level(parent_id={classification})"
And the variable "reference" is "{classification_ifc}.by_type('IfcClassificationReference')[0].id()"
When I press "bim.add_classification_reference(reference={reference}, obj='Material', obj_type='Material')"
When I press "bim.add_classification_reference(reference={reference}, obj_type='Material')"
Then nothing happens
Scenario: Remove classification reference - material
@@ -207,14 +208,14 @@ Scenario: Remove classification reference - material
And the variable "classification" is "{classification_ifc}.by_type('IfcClassification')[0].id()"
And I set "scene.BIMClassificationProperties.available_classifications" to "{classification}"
And I press "bim.add_classification"
And I add a cube
And I add a material
And I press "bim.add_material(obj='Material')"
And the variable "material" is "{ifc}.by_type('IfcMaterial')[0].id()"
And I press "bim.add_material(name='Material')"
And I press "bim.load_materials"
And I press "bim.expand_material_category(category='Uncategorised')"
And I set "scene.BIMMaterialProperties.active_material_index" to "1"
And I press "bim.change_classification_level(parent_id={classification})"
And the variable "reference" is "{classification_ifc}.by_type('IfcClassificationReference')[0].id()"
And I press "bim.add_classification_reference(reference={reference}, obj='Material', obj_type='Material')"
When I press "bim.remove_classification_reference(reference={reference}, obj='Material', obj_type='Material')"
And I press "bim.add_classification_reference(reference={reference}, obj_type='Material')"
When I press "bim.remove_classification_reference(reference={reference}, obj_type='Material')"
Then nothing happens
Scenario: Add classification reference - cost
@@ -207,7 +207,7 @@ Scenario: Update representation - updating a layered extrusion
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -235,7 +235,7 @@ Scenario: Update representation - updating a profiled extrusion
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -327,19 +327,24 @@ Scenario: Override duplicate move - copying a coloured representation
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I add a material
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And the material "Material" colour is set to "1,0,0,1"
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I set "scene.BIMStylesProperties.surface_colour" to "[1.0,0.0,0.0]"
And I press "bim.add_presentation_style"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
And I press "bim.assign_style_to_selected(style_id={style})"
When I duplicate the selected objects
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
And an empty Blender session is started
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc', should_start_fresh_session=False)"
Then the material "Material" colour is "1,0,0,1"
And the object "IfcWall/Cube" has the material "Material"
And the object "IfcWall/Cube.001" has the material "Material"
Then the material "Style" colour is "1,0,0,1"
And the object "IfcWall/Cube" has the material "Style"
And the object "IfcWall/Cube.001" has the material "Style"
Scenario: Override duplicate move - copying a type instance with a representation map
Given an empty IFC project
@@ -369,7 +374,7 @@ Scenario: Override duplicate move - copying a layered extrusion
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -399,7 +404,7 @@ Scenario: Override duplicate move - copying a profiled extrusion
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -3,13 +3,13 @@ Feature: Material
Scenario: Load materials
Given an empty IFC project
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
When I press "bim.load_materials"
Then nothing happens
Scenario: Disable editing materials
Given an empty IFC project
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I press "bim.load_materials"
When I press "bim.disable_editing_materials"
Then nothing happens
@@ -17,8 +17,8 @@ Scenario: Disable editing materials
Scenario: Load materials - then add material
Given an empty IFC project
And I press "bim.load_materials"
When I press "bim.add_material(obj='')"
Then the material "Default" exists
When I press "bim.add_material()"
Then the IFC material "Default" exists
Scenario: Load materials - then add material set
Given an empty IFC project
@@ -29,26 +29,8 @@ Scenario: Load materials - then add material set
Scenario: Add default material
Given an empty IFC project
When I press "bim.add_material(obj='')"
Then the material "Default" exists
Scenario: Add material
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I add a material
When I press "bim.add_material(obj='Material')"
Then the material "Material" is an IFC material
Scenario: Remove material
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I add a material
And I press "bim.add_material(obj='Material')"
And the variable "material" is "{ifc}.by_type('IfcMaterial')[0].id()"
When I press "bim.remove_material(material={material})"
Then the material "Material" does not exist
When I press "bim.add_material()"
Then the IFC material "Default" exists
Scenario: Remove material set
Given an empty IFC project
@@ -66,10 +48,10 @@ Scenario: Assign material - single material
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
When I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
Then the object "IfcWall/Cube" has the material "Default"
Then the object "IfcWall/Cube" has the IFC material "Default"
Scenario: Unassign material - single material
Given an empty IFC project
@@ -78,7 +60,7 @@ Scenario: Unassign material - single material
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
When I press "bim.unassign_material"
@@ -91,7 +73,7 @@ Scenario: Enable editing assigned material - single material
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
When I press "bim.enable_editing_assigned_material"
@@ -104,7 +86,7 @@ Scenario: Disable editing assigned material - single material
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -118,7 +100,7 @@ Scenario: Edit assigned material - single material
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -133,7 +115,7 @@ Scenario: Assign material - material layer set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
When I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
Then the object "IfcWallType/Empty" does not have the material "Default"
@@ -146,7 +128,7 @@ Scenario: Unassign material - material layer set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
When I press "bim.unassign_material"
@@ -166,7 +148,7 @@ Scenario: Unassign material - removing inherited material
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
@@ -191,7 +173,7 @@ Scenario: Enable editing assigned material - material layer set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
When I press "bim.enable_editing_assigned_material"
@@ -209,7 +191,7 @@ Scenario: Disable editing assigned material - material layer set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -228,7 +210,7 @@ Scenario: Edit assigned material - material layer set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -243,7 +225,7 @@ Scenario: Assign material - material profile set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
When I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
Then the object "IfcWallType/Empty" does not have the material "Default"
@@ -256,7 +238,7 @@ Scenario: Unassign material - material profile set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
When I press "bim.unassign_material"
@@ -274,7 +256,7 @@ Scenario: Enable editing assigned material - material profile set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
When I press "bim.enable_editing_assigned_material"
@@ -292,7 +274,7 @@ Scenario: Disable editing assigned material - material profile set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -311,7 +293,7 @@ Scenario: Edit assigned material - material profile set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -326,7 +308,7 @@ Scenario: Assign material - material constituent set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
When I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
Then nothing happens
@@ -338,7 +320,7 @@ Scenario: Unassign material - material constituent set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
When I press "bim.unassign_material"
@@ -351,7 +333,7 @@ Scenario: Enable editing assigned material - material constituent set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
When I press "bim.enable_editing_assigned_material"
@@ -364,7 +346,7 @@ Scenario: Disable editing assigned material - material constituent set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -378,7 +360,7 @@ Scenario: Edit assigned material - material constituent set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -389,7 +371,7 @@ Scenario: Edit assigned material - material constituent set
Scenario: Select by material
Given an empty IFC project
And I press "bim.load_materials"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And the variable "material" is "{ifc}.by_type('IfcMaterial')[0].id()"
When I press "bim.select_by_material(material={material})"
Then nothing happens
@@ -397,14 +379,14 @@ Scenario: Select by material
Scenario: Expand material category
Given an empty IFC project
And I press "bim.load_materials"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
When I press "bim.expand_material_category(category='')"
Then nothing happens
Scenario: Contract material category
Given an empty IFC project
And I press "bim.load_materials"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I press "bim.expand_material_category(category='')"
When I press "bim.contract_material_category(category='')"
Then nothing happens
@@ -435,7 +417,7 @@ Scenario: Add material set layer
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
@@ -457,7 +439,7 @@ Scenario: Remove material set layer
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
@@ -909,19 +909,3 @@ Scenario: Export IFC - with changed object scale synchronised
And an empty Blender session is started
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
Then the object "IfcWall/Cube" dimensions are "4,4,4"
Scenario: Export IFC - with changed style element synchronised
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I add a material
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
When I add a material
And the material "Material.001" colour is set to "1,0,0,1"
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
And an empty Blender session is started
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc', should_start_fresh_session=False)"
Then the material "Material.001" colour is "1,0,0,1"
+19 -33
View File
@@ -50,20 +50,16 @@ Scenario: Enable pset editing - object
Scenario: Enable pset editing - material
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
And the object "IfcWall/Cube" is selected
And I press "bim.add_pset(obj='Default', obj_type='Material')"
And I set "active_object.active_material.PsetProperties.properties[0].metadata.float_value" to "0.42"
And I press "bim.edit_pset(obj='Default', obj_type='Material')"
And I press "bim.add_material()"
And I press "bim.load_materials"
And I press "bim.expand_material_category(category='Uncategorised')"
And I set "scene.BIMMaterialProperties.active_material_index" to "1"
And I set "scene.MaterialPsetProperties.pset_name" to "Pset_MaterialCommon"
And I press "bim.add_pset(obj='', obj_type='Material')"
And I set "scene.MaterialPsetProperties.properties[0].metadata.float_value" to "0.42"
And I press "bim.edit_pset(obj='', obj_type='Material')"
And the variable "pset" is "{ifc}.by_type('IfcMaterialProperties')[-1].id()"
When I press "bim.enable_pset_editing(pset_id={pset}, obj='Default', obj_type='Material')"
When I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Material')"
Then nothing happens
Scenario: Enable pset editing - profile
@@ -143,15 +139,10 @@ Scenario: Disable pset editing - object
Scenario: Disable pset editing - material
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
And the object "IfcWall/Cube" is selected
And I press "bim.add_material()"
And I press "bim.load_materials"
And I press "bim.expand_material_category(category='Uncategorised')"
And I set "scene.BIMMaterialProperties.active_material_index" to "1"
And I press "bim.add_pset(obj='Default', obj_type='Material')"
When I press "bim.disable_pset_editing(obj='Default', obj_type='Material')"
Then nothing happens
@@ -236,17 +227,12 @@ Scenario: Edit qto - object
Scenario: Edit pset - material
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
And the object "IfcWall/Cube" is selected
And I press "bim.add_pset(obj='Default', obj_type='Material')"
When I press "bim.edit_pset(obj='Default', obj_type='Material')"
And I press "bim.add_material()"
And I press "bim.load_materials"
And I press "bim.expand_material_category(category='Uncategorised')"
And I set "scene.BIMMaterialProperties.active_material_index" to "1"
And I press "bim.add_pset(obj='', obj_type='Material')"
When I press "bim.edit_pset(obj='', obj_type='Material')"
Then nothing happens
Scenario: Edit pset - profile
+9 -4
View File
@@ -20,15 +20,20 @@ Scenario: Unlink object
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I add a material
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I press "bim.add_style()"
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I press "bim.add_presentation_style"
And the object "IfcWall/Cube" is selected
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
And I press "bim.assign_style_to_selected(style_id={style})"
When I press "bim.unlink_object(obj='IfcWall/Cube')"
Then the object "Cube" is not an IFC element
And the material "Material" is an IFC style
And the material "Material.001" is not an IFC style
And the material "Style" is an IFC style
And the material "Style.001" is not an IFC style
Scenario: Copy class
Given an empty IFC project
+66 -39
View File
@@ -1,94 +1,121 @@
@style
Feature: Style
Scenario: Update style colours
Given an empty IFC project
And I add a cube
And I add a material
And I press "bim.add_style"
When I press "bim.update_style_colours"
Then nothing happens
Scenario: Remove style
Given an empty IFC project
And I add a cube
And I add a material
And I press "bim.add_style"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
When I press "bim.remove_style(style={style})"
Then nothing happens
Scenario: Add style to current blender material
Given an empty IFC project
And I add a cube
And I add a material
When I press "bim.add_style"
Then nothing happens
Scenario: Unlink style
Given an empty IFC project
And I add a cube
And I add a material
And I press "bim.add_style"
When I press "bim.unlink_style"
Then the material "Material" is not an IFC style
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I press "bim.add_presentation_style"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
And I press "bim.assign_style_to_selected(style_id={style})"
When I press "bim.unlink_style(blender_material='Style')"
Then the material "Style" is not an IFC style
Scenario: Add a new style
Given an empty IFC project
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I set "scene.BIMStylesProperties.surface_colour" to "[1.0,0.0,0.0]"
When I press "bim.add_presentation_style"
Then nothing happens
Then the material "Style" colour is "1,0,0,1"
And the material "Style" is an IFC style
Scenario: Disable adding a new style
Given an empty IFC project
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
When I press "bim.disable_adding_presentation_style"
Then nothing happens
Scenario: Remove style
Given an empty IFC project
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I set "scene.BIMStylesProperties.surface_colour" to "[1.0,0.0,0.0]"
And I press "bim.add_presentation_style"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
When I press "bim.remove_style(style={style})"
Then the material "Style" does not exist
Scenario: Edit style
Given an empty IFC project
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I press "bim.add_presentation_style"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
And I press "bim.enable_editing_style(style={style})"
And I set "scene.BIMStylesProperties.attributes[0].string_value" to "NewStyle"
When I press "bim.edit_style"
Then nothing happens
Then the material "Style" does not exist
And the material "NewStyle" exists
Scenario: Disable editing style
Given an empty IFC project
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I press "bim.add_presentation_style"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
And I press "bim.enable_editing_style(style={style})"
And I set "scene.BIMStylesProperties.attributes[0].string_value" to "NewStyle"
When I press "bim.disable_editing_style"
Then nothing happens
Then the material "NewStyle" does not exist
And the material "Style" exists
Scenario: Load styles
Given an empty IFC project
And I add a cube
And I add a material
And I press "bim.add_style"
When I press "bim.load_styles(style_type='IfcSurfaceStyle')"
Then nothing happens
Scenario: Disable editing styles
Given an empty IFC project
And I add a cube
And I add a material
And I press "bim.add_style"
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
When I press "bim.disable_editing_styles"
Then nothing happens
Scenario: Assign style to selected
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I press "bim.add_presentation_style"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
When I press "bim.assign_style_to_selected(style_id={style})"
Then the object "IfcWall/Cube" has the material "Style"
Scenario: Select by style
Given an empty IFC project
And I add a cube
And I add a material
And I press "bim.add_style"
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And I press "bim.load_styles(style_type='IfcSurfaceStyle')"
And I press "bim.enable_adding_presentation_style"
And I set "scene.BIMStylesProperties.style_name" to "Style"
And I press "bim.add_presentation_style"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
When I press "bim.select_by_style(style={style})"
Then nothing happens
And I press "bim.assign_style_to_selected(style_id={style})"
And the variable "style" is "{ifc}.by_type('IfcSurfaceStyle')[0].id()"
When I deselect all objects
And I press "bim.select_by_style(style={style})"
Then the object "IfcWall/Cube" is selected
+3 -5
View File
@@ -85,13 +85,12 @@ Scenario: Assign type - assign to a type with a material layer set, which automa
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
When the variable "type" is "{ifc}.by_type('IfcWallType')[0].id()"
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
Then the object "IfcWall/Cube" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
And the object "IfcWall/Cube" has the material "Default"
And the object "IfcWall/Cube" has a "100" thick layered material containing the material "Default"
And the object "IfcWall/Cube" dimensions are "2,.1,3"
@@ -108,7 +107,7 @@ Scenario: Assign type - assign to a different type with a material layer set
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And the variable "type" is "{ifc}.by_type('IfcWallType')[-1].id()"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
And I add an empty
@@ -127,7 +126,6 @@ Scenario: Assign type - assign to a different type with a material layer set
And I press "bim.edit_assigned_material(material_set={layer_set})"
When I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
Then the object "IfcWall/Cube" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
And the object "IfcWall/Cube" has the material "Default"
And the object "IfcWall/Cube" has a "100" thick layered material containing the material "Default"
And the object "IfcWall/Cube" dimensions are "2,.1,3"
When I press "bim.assign_type(relating_type={type2}, related_object='IfcWall/Cube')"
@@ -146,7 +144,7 @@ Scenario: Assign type - assign to a type with a material profile set
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
And I press "bim.add_material(obj='')"
And I press "bim.add_material()"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
+34 -6
View File
@@ -22,6 +22,7 @@ import traceback
import webbrowser
import numpy as np
import ifcopenshell
import ifcopenshell.util.element
import blenderbim.tool as tool
import blenderbim.bim
from blenderbim.bim.ifc import IfcStore
@@ -31,6 +32,7 @@ from pytest_bdd import scenarios, given, when, then, parsers
from mathutils import Vector
from math import radians
from pathlib import Path
from typing import Union
scenarios("feature")
@@ -324,7 +326,7 @@ def i_rename_the_object_name1_to_name2(name1, name2):
@given(parsers.parse('I set "{prop}" to "{value}"'))
@when(parsers.parse('I set "{prop}" to "{value}"'))
def i_set_prop_to_value(prop, value):
def i_set_prop_to_value(prop: str, value: str) -> None:
value = replace_variables(value)
try:
eval(f"bpy.context.{prop}")
@@ -467,7 +469,7 @@ def the_object_name_data_is_a_type_representation_of_context(name, type, context
@then(parsers.parse('the material "{name}" exists'))
def the_material_name_exists(name) -> bpy.types.Material:
def the_material_name_exists(name: str) -> bpy.types.Material:
obj = bpy.data.materials.get(name)
if not obj:
assert False, f'The material "{name}" does not exist'
@@ -479,6 +481,25 @@ def the_material_name_does_not_exist(name):
assert bpy.data.materials.get(name) is None, "Material exists"
def get_ifc_material_by_name(name: str) -> Union[ifcopenshell.entity_instance, None]:
ifc_file = tool.Ifc.get()
material = next((m for m in ifc_file.by_type("IfcMaterial") if m.Name == name), None)
return material
@then(parsers.parse('the IFC material "{name}" exists'))
def the_ifc_material_name_exists(name: str) -> ifcopenshell.entity_instance:
material = get_ifc_material_by_name(name)
if not material:
assert False, f'The IFC material "{name}" does not exist'
return material
@then(parsers.parse('the material "{name}" does not exist'))
def the_ifc_material_name_does_not_exist(name):
assert get_ifc_material_by_name(name) is None, "IFC Material exists"
@then("an IFC file does not exist")
def an_ifc_file_does_not_exist():
ifc = IfcStore.get_file()
@@ -678,7 +699,7 @@ def prop_is_roughly_value(prop, value):
@then(parsers.parse('the object "{name}" has a cartesian point offset of "{offset}"'))
def the_object_name_has_a_cartesian_point_offset_of_offset(name, offset):
def the_object_name_has_a_cartesian_point_offset_of_offset(name: str, offset: str) -> None:
offset = replace_variables(offset)
obj = the_object_name_exists(name)
assert obj.BIMObjectProperties.blender_offset_type == "CARTESIAN_POINT"
@@ -688,8 +709,15 @@ def the_object_name_has_a_cartesian_point_offset_of_offset(name, offset):
@then(parsers.parse('the object "{name}" has the material "{material}"'))
def the_object_name_has_the_material_material(name, material):
assert material in [ms.material.name for ms in the_object_name_exists(name).material_slots]
def the_object_name_has_the_material_material(name: str, material: str) -> None:
assert material in [ms.material.name for ms in the_object_name_exists(name).material_slots if ms.material]
@then(parsers.parse('the object "{name}" has the IFC material "{material_name}"'))
def the_object_name_has_the_ifc_material_material_name(name: str, material_name: str):
element = tool.Ifc.get_entity(the_object_name_exists(name))
material = ifcopenshell.util.element.get_material(element)
assert material and material.Name == material_name
@then(
@@ -715,7 +743,7 @@ def the_object_name_has_a_thickness_thick_layered_material_containing_the_materi
@then(parsers.parse('the object "{name}" has no IFC materials'))
def the_object_has_no_ifc_materials(name):
def the_object_has_no_ifc_materials(name: str) -> None:
element = tool.Ifc.get_entity(the_object_name_exists(name))
material = ifcopenshell.util.element.get_material(element)
assert material is None
+1 -1
View File
@@ -54,6 +54,7 @@ class TestRemoveStyle:
ifc.unlink(element="style").should_be_called()
ifc.run("style.remove_style", style="style").should_be_called()
style.delete_object("obj").should_be_called()
style.get_active_style_type().should_be_called().will_return("style_type")
def test_removing_a_style(self, ifc, style):
self.remove_a_style_common(ifc, style)
@@ -63,7 +64,6 @@ class TestRemoveStyle:
def test_removing_a_style_and_reloading_imported_styles(self, ifc, style):
self.remove_a_style_common(ifc, style)
style.is_editing_styles().should_be_called().will_return(True)
style.get_active_style_type().should_be_called().will_return("style_type")
style.import_presentation_styles("style_type").should_be_called()
subject.remove_style(ifc, style, style="style")