Fix regression with editing material psets

This commit is contained in:
Dion Moult
2023-02-08 17:43:50 +11:00
parent ea91f4302c
commit 1279b9848f
2 changed files with 184 additions and 1 deletions
@@ -250,7 +250,7 @@ class EditPset(bpy.types.Operator, Operator):
e[value_name] for e in prop.enumerated_value.enumerated_values if e.is_selected
]
if tool.Ifc.get().by_id(pset_id).is_a("IfcPropertySet"):
if tool.Ifc.get().by_id(pset_id).is_a() in ("IfcPropertySet", "IfcMaterialProperties", "IfcProfileProperties"):
ifcopenshell.api.run(
"pset.edit_pset",
self.file,
@@ -76,6 +76,7 @@ Scenario: Enable pset editing - work schedule
And I press "bim.add_pset(obj_type='WorkSchedule')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
When I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='WorkSchedule')"
Then nothing happens
Scenario: Enable pset editing - resource with time series properties
Given an empty IFC project
@@ -112,6 +113,188 @@ Scenario: Enable pset editing - task
When I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Task')"
Then nothing happens
Scenario: Disable pset editing - object
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And I set "active_object.PsetProperties.pset_name" to "Pset_WallCommon"
And I press "bim.add_pset(obj='IfcWall/Cube', obj_type='Object')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='IfcWall/Cube', obj_type='Object')"
When I press "bim.disable_pset_editing(obj='IfcWall/Cube', obj_type='Object')"
Then nothing happens
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_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 the variable "pset" is "{ifc}.by_type('IfcMaterialProperties')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='Default', obj_type='Material')"
When I press "bim.disable_pset_editing(obj='Default', obj_type='Material')"
Then nothing happens
Scenario: Disable pset editing - profile
Given an empty IFC project
And I press "bim.load_profiles"
And I press "bim.add_profile_def"
And I set "scene.ProfilePsetProperties.pset_name" to "Pset_ProfileMechanical"
And I press "bim.add_pset(obj_type='Profile')"
And the variable "pset" is "{ifc}.by_type('IfcProfileProperties')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Profile')"
When I press "bim.disable_pset_editing(obj='', obj_type='Profile')"
Then nothing happens
Scenario: Disable pset editing - work schedule
Given an empty IFC project
And I press "bim.add_work_schedule"
And the variable "work_schedule" is "{ifc}.by_type('IfcWorkSchedule')[0].id()"
And I press "bim.enable_editing_work_schedule_tasks(work_schedule={work_schedule})"
And I set "scene.WorkSchedulePsetProperties.pset_name" to "Pset_WorkControlCommon"
And I press "bim.add_pset(obj_type='WorkSchedule')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='WorkSchedule')"
When I press "bim.disable_pset_editing(obj='', obj_type='WorkSchedule')"
Then nothing happens
Scenario: Disable pset editing - resource with time series properties
Given an empty IFC project
And I press "bim.load_resources"
And I press "bim.add_resource(ifc_class='IfcSubContractResource', parent_resource=0)"
And I set "scene.ResourcePsetProperties.pset_name" to "Pset_ConstructionResource"
And I press "bim.add_pset(obj_type='Resource')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Resource')"
When I press "bim.disable_pset_editing(obj='', obj_type='Resource')"
Then nothing happens
Scenario: Disable pset editing - resource with regular single properties
Given an empty IFC project
And I press "bim.load_resources"
And I press "bim.add_resource(ifc_class='IfcCrewResource', parent_resource=0)"
And the variable "resource" is "{ifc}.by_type('IfcCrewResource')[-1].id()"
And I press "bim.add_resource(ifc_class='IfcLaborResource', parent_resource={resource})"
And I set "scene.BIMResourceProperties.active_resource_index" to "1"
And I set "scene.ResourcePsetProperties.pset_name" to "EPset_Productivity"
And I press "bim.add_pset(obj_type='Resource')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Resource')"
When I press "bim.disable_pset_editing(obj='', obj_type='Resource')"
Then nothing happens
Scenario: Disable pset editing - task
Given an empty IFC project
And I press "bim.add_work_schedule"
And the variable "work_schedule" is "IfcStore.get_file().by_type('IfcWorkSchedule')[0].id()"
And I press "bim.enable_editing_work_schedule_tasks(work_schedule={work_schedule})"
And I press "bim.add_summary_task(work_schedule={work_schedule})"
And I set "scene.TaskPsetProperties.qto_name" to "Qto_TaskBaseQuantities"
And I press "bim.add_qto(obj_type='Task')"
And the variable "pset" is "{ifc}.by_type('IfcElementQuantity')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Task')"
When I press "bim.disable_pset_editing(obj='', obj_type='Task')"
Then nothing happens
Scenario: Edit pset - object
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And I set "active_object.PsetProperties.pset_name" to "Pset_WallCommon"
And I press "bim.add_pset(obj='IfcWall/Cube', obj_type='Object')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='IfcWall/Cube', obj_type='Object')"
When I press "bim.edit_pset(obj='IfcWall/Cube', obj_type='Object')"
Then nothing happens
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_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 the variable "pset" is "{ifc}.by_type('IfcMaterialProperties')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='Default', obj_type='Material')"
When I press "bim.edit_pset(obj='Default', obj_type='Material')"
Then nothing happens
Scenario: Edit pset - profile
Given an empty IFC project
And I press "bim.load_profiles"
And I press "bim.add_profile_def"
And I set "scene.ProfilePsetProperties.pset_name" to "Pset_ProfileMechanical"
And I press "bim.add_pset(obj_type='Profile')"
And the variable "pset" is "{ifc}.by_type('IfcProfileProperties')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Profile')"
When I press "bim.edit_pset(obj='', obj_type='Profile')"
Then nothing happens
Scenario: Edit pset - work schedule
Given an empty IFC project
And I press "bim.add_work_schedule"
And the variable "work_schedule" is "{ifc}.by_type('IfcWorkSchedule')[0].id()"
And I press "bim.enable_editing_work_schedule_tasks(work_schedule={work_schedule})"
And I set "scene.WorkSchedulePsetProperties.pset_name" to "Pset_WorkControlCommon"
And I press "bim.add_pset(obj_type='WorkSchedule')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='WorkSchedule')"
When I press "bim.edit_pset(obj='', obj_type='WorkSchedule')"
Then nothing happens
Scenario: Enable pset editing - resource with time series properties
Given an empty IFC project
And I press "bim.load_resources"
And I press "bim.add_resource(ifc_class='IfcSubContractResource', parent_resource=0)"
And I set "scene.ResourcePsetProperties.pset_name" to "Pset_ConstructionResource"
And I press "bim.add_pset(obj_type='Resource')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Resource')"
When I press "bim.edit_pset(obj='', obj_type='Resource')"
Then nothing happens
Scenario: Enable pset editing - resource with regular single properties
Given an empty IFC project
And I press "bim.load_resources"
And I press "bim.add_resource(ifc_class='IfcCrewResource', parent_resource=0)"
And the variable "resource" is "{ifc}.by_type('IfcCrewResource')[-1].id()"
And I press "bim.add_resource(ifc_class='IfcLaborResource', parent_resource={resource})"
And I set "scene.BIMResourceProperties.active_resource_index" to "1"
And I set "scene.ResourcePsetProperties.pset_name" to "EPset_Productivity"
And I press "bim.add_pset(obj_type='Resource')"
And the variable "pset" is "{ifc}.by_type('IfcPropertySet')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Resource')"
When I press "bim.edit_pset(obj='', obj_type='Resource')"
Then nothing happens
Scenario: Enable pset editing - task
Given an empty IFC project
And I press "bim.add_work_schedule"
And the variable "work_schedule" is "IfcStore.get_file().by_type('IfcWorkSchedule')[0].id()"
And I press "bim.enable_editing_work_schedule_tasks(work_schedule={work_schedule})"
And I press "bim.add_summary_task(work_schedule={work_schedule})"
And I set "scene.TaskPsetProperties.qto_name" to "Qto_TaskBaseQuantities"
And I press "bim.add_qto(obj_type='Task')"
And the variable "pset" is "{ifc}.by_type('IfcElementQuantity')[-1].id()"
And I press "bim.enable_pset_editing(pset_id={pset}, obj='', obj_type='Task')"
When I press "bim.edit_pset(obj='', obj_type='Task')"
Then nothing happens
Scenario: Copy property to selected - copy property
Given an empty IFC project
And I add a cube