mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Port root, bimtester and sequence to feature tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
[pytest]
|
||||
markers =
|
||||
aggregate
|
||||
bimtester
|
||||
context
|
||||
geometry
|
||||
material
|
||||
@@ -11,6 +12,7 @@ markers =
|
||||
pset_template
|
||||
qto
|
||||
root
|
||||
sequence
|
||||
spatial
|
||||
style
|
||||
type
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@bimtester
|
||||
Feature: Bimtester
|
||||
|
||||
Scenario: Execute Bimtester
|
||||
Given an empty IFC project
|
||||
When I set "scene.BimTesterProperties.should_load_from_memory" to "True"
|
||||
And I set "scene.BimTesterProperties.feature" to "{cwd}/test/files/sample-ids.xml"
|
||||
And I press "bim.execute_bim_tester"
|
||||
Then the file "{cwd}/test/files/sample-ids.xml.html" should contain "Tests passed: <strong>1 / 1</strong> (100%)"
|
||||
@@ -1,5 +1,6 @@
|
||||
@root
|
||||
Feature: Root
|
||||
Covers IFC class operations on Blender objects
|
||||
|
||||
Scenario: Unlink object
|
||||
Given an empty IFC project
|
||||
@@ -14,7 +15,6 @@ Scenario: Unlink object
|
||||
And the material "Material" is not an IFC material
|
||||
And the material "Material" is not an IFC style
|
||||
|
||||
|
||||
Scenario: Copy class
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
@@ -23,3 +23,90 @@ Scenario: Copy class
|
||||
And I press "bim.assign_class"
|
||||
When I press "bim.copy_class(obj='IfcWall/Cube')"
|
||||
Then the object "IfcWall/Cube" is an "IfcWall"
|
||||
|
||||
Scenario: Assign a class to a cube
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcWall/Cube" is an "IfcWall"
|
||||
And the object "IfcWall/Cube" is in the collection "Collection"
|
||||
And the object "IfcWall/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
|
||||
Scenario: Assign a type class to a cube
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcWallType/Cube" is an "IfcWallType"
|
||||
And the object "IfcWallType/Cube" is in the collection "Types"
|
||||
And the object "IfcWallType/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
|
||||
Scenario: Assign a spatial class to a cube
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcSpatialElement"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcBuilding"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcBuilding/Cube" is an "IfcBuilding"
|
||||
And the object "IfcBuilding/Cube" is in the collection "IfcBuilding/Cube"
|
||||
And the object "IfcBuilding/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
|
||||
Scenario: Assign an opening class to a cube
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
|
||||
And the object "IfcOpeningElement/Cube" should display as "WIRE"
|
||||
And the object "IfcOpeningElement/Cube" is in the collection "IfcOpeningElements"
|
||||
And the object "IfcOpeningElement/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
|
||||
Scenario: Assign a class to a cube in a collection
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And the object "Cube" is placed in the collection "IfcBuildingStorey/My Storey"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcWall/Cube" is contained in "My Storey"
|
||||
|
||||
Scenario: Copy a wall
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And I duplicate the selected objects
|
||||
Then the object "IfcWall/Cube" and "IfcWall/Cube.001" are different elements
|
||||
|
||||
Scenario: Copy a storey
|
||||
Given an empty IFC project
|
||||
And the object "IfcBuildingStorey/My Storey" is selected
|
||||
When I duplicate the selected objects
|
||||
Then the object "IfcBuildingStorey/My Storey" and "IfcBuildingStorey/My Storey.001" are different elements
|
||||
And the object "IfcBuildingStorey/My Storey" is in the collection "IfcBuildingStorey/My Storey"
|
||||
And the object "IfcBuildingStorey/My Storey.001" is in the collection "IfcBuildingStorey/My Storey.001"
|
||||
And the collection "IfcBuildingStorey/My Storey.001" is in the collection "IfcBuilding/My Building"
|
||||
|
||||
Scenario: Copy an opening
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And additionally the object "IfcWall/Cube" is selected
|
||||
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
|
||||
And the object "IfcOpeningElement/Cube" is selected
|
||||
And I duplicate the selected objects
|
||||
Then the object "IfcOpeningElement/Cube" and "IfcOpeningElement/Cube.001" are different elements
|
||||
And the object "IfcWall/Cube" has a boolean difference by "IfcOpeningElement/Cube"
|
||||
And the object "IfcWall/Cube" has a boolean difference by "IfcOpeningElement/Cube.001"
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
@sequence
|
||||
Feature: Sequence
|
||||
Covers Visualising Work Schedule Date Range.
|
||||
|
||||
Scenario: See the current frame date as text
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then the object "Timeline" has a body of "2021-01-01"
|
||||
When I am on frame "2"
|
||||
Then the object "Timeline" has a body of "2021-01-02"
|
||||
|
||||
Scenario: Animate the construction of a wall
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type('IfcTask')[0].id()"
|
||||
And I press "bim.enable_editing_task(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get('PredefinedType').enum_value" to "CONSTRUCTION"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleStart').string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleFinish').string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
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 press "bim.assign_product(task={task}, relating_product='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[0.0, 1.0, 0.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
|
||||
Scenario: Animate the demolition of a wall
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type('IfcTask')[0].id()"
|
||||
And I press "bim.enable_editing_task(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get('PredefinedType').enum_value" to "DEMOLITION"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleStart').string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleFinish').string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
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 press "bim.assign_product(task={task}, relating_product='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[1.0, 0.0, 0.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
|
||||
Scenario: Animate the operation of a wall
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type('IfcTask')[0].id()"
|
||||
And I press "bim.enable_editing_task(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get('PredefinedType').enum_value" to "OPERATION"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleStart').string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleFinish').string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
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 press "bim.assign_product(task={task}, relating_product='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 1.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
|
||||
Scenario: Animate the movement of a wall
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type('IfcTask')[0].id()"
|
||||
And I press "bim.enable_editing_task(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get('PredefinedType').enum_value" to "MOVE"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleStart').string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleFinish').string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
And I add a cube
|
||||
And I rename the object "Cube" to "ToObject"
|
||||
And the object "ToObject" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/ToObject" is selected
|
||||
And I press "bim.assign_product(task={task}, relating_product='')"
|
||||
When I add a cube
|
||||
And I rename the object "Cube" to "FromObject"
|
||||
And the object "FromObject" is selected
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/FromObject" is selected
|
||||
And I press "bim.assign_process(task={task}, related_object_type='PRODUCT', related_object='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "True"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[1.0, 0.5, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').color" is "[1.0, 1.0, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "False"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
Then "scene.objects.get('IfcWall/FromObject').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/FromObject').hide_render" is "True"
|
||||
And "scene.objects.get('IfcWall/ToObject').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "False"
|
||||
|
||||
Scenario: Animate the consumption of a wall
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type('IfcTask')[0].id()"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleStart').string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get('ScheduleFinish').string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
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 press "bim.assign_process(task={task}, related_object_type='PRODUCT', related_object='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
@@ -1,17 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
@@ -1,31 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import test.bim.bootstrap
|
||||
|
||||
|
||||
class TestExecuteBIMTester(test.bim.bootstrap.NewFile):
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_executing_bimtester(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
When I enable "scene.BimTesterProperties.should_load_from_memory"
|
||||
And I set "scene.BimTesterProperties.feature" to "{cwd}/test/files/sample-ids.xml"
|
||||
And I press "bim.execute_bim_tester"
|
||||
Then the file "{cwd}/test/files/sample-ids.xml.html" should contain "Tests passed: <strong>1 / 1</strong> (100%)"
|
||||
"""
|
||||
@@ -1,17 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
@@ -1,134 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import test.bim.bootstrap
|
||||
|
||||
|
||||
class TestAssignClass(test.bim.bootstrap.NewFile):
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_assigning_a_class_to_a_cube(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcWall/Cube" is an "IfcWall"
|
||||
And the object "IfcWall/Cube" is in the collection "Collection"
|
||||
And the object "IfcWall/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_assigning_a_type_class_to_a_cube(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcWallType/Cube" is an "IfcWallType"
|
||||
And the object "IfcWallType/Cube" is in the collection "Types"
|
||||
And the object "IfcWallType/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_assigning_a_spatial_class_to_a_cube(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcSpatialElement"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcBuilding"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcBuilding/Cube" is an "IfcBuilding"
|
||||
And the object "IfcBuilding/Cube" is in the collection "IfcBuilding/Cube"
|
||||
And the object "IfcBuilding/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_assigning_an_opening_class_to_a_cube(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElement"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
|
||||
And the object "IfcOpeningElement/Cube" should display as "WIRE"
|
||||
And the object "IfcOpeningElement/Cube" is in the collection "IfcOpeningElements"
|
||||
And the object "IfcOpeningElement/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_assigning_a_class_to_a_cube_in_a_collection(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And the object "Cube" is placed in the collection "IfcBuildingStorey/My Storey"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
Then the object "IfcWall/Cube" is contained in "My Storey"
|
||||
"""
|
||||
|
||||
|
||||
class TestCopyClass(test.bim.bootstrap.NewFile):
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_copying_a_wall(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And I duplicate the selected objects
|
||||
Then the object "IfcWall/Cube" and "IfcWall/Cube.001" are different elements
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_copying_a_storey(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And the object "IfcBuildingStorey/My Storey" is selected
|
||||
When I duplicate the selected objects
|
||||
Then the object "IfcBuildingStorey/My Storey" and "IfcBuildingStorey/My Storey.001" are different elements
|
||||
And the object "IfcBuildingStorey/My Storey" is in the collection "IfcBuildingStorey/My Storey"
|
||||
And the object "IfcBuildingStorey/My Storey.001" is in the collection "IfcBuildingStorey/My Storey.001"
|
||||
And the collection "IfcBuildingStorey/My Storey.001" is in the collection "IfcBuilding/My Building"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_copying_an_opening(self):
|
||||
return """
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
When the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And additionally the object "IfcWall/Cube" is selected
|
||||
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
|
||||
And the object "IfcOpeningElement/Cube" is selected
|
||||
And I duplicate the selected objects
|
||||
Then the object "IfcOpeningElement/Cube" and "IfcOpeningElement/Cube.001" are different elements
|
||||
And the object "IfcWall/Cube" has a boolean difference by "IfcOpeningElement/Cube"
|
||||
And the object "IfcWall/Cube" has a boolean difference by "IfcOpeningElement/Cube.001"
|
||||
"""
|
||||
@@ -1,17 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
@@ -1,253 +0,0 @@
|
||||
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of BlenderBIM Add-on.
|
||||
#
|
||||
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import test.bim.bootstrap
|
||||
|
||||
|
||||
class TestVisualiseWorkScheduleDateRange(test.bim.bootstrap.NewFile):
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_seeing_the_current_frame_date_as_text(self):
|
||||
return """
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then the object "Timeline" has a body of "2021-01-01"
|
||||
When I am on frame "2"
|
||||
Then the object "Timeline" has a body of "2021-01-02"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_construction_of_a_wall(self):
|
||||
return """
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type("IfcTask")[0].id()"
|
||||
And I press "bim.enable_editing_task(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get("PredefinedType").enum_value" to "CONSTRUCTION"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
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 press "bim.assign_product(task={task}, relating_product='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[0.0, 1.0, 0.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_demolition_of_a_wall(self):
|
||||
return """
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type("IfcTask")[0].id()"
|
||||
And I press "bim.enable_editing_task(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get("PredefinedType").enum_value" to "DEMOLITION"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
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 press "bim.assign_product(task={task}, relating_product='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[1.0, 0.0, 0.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
And "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_operation_of_a_wall(self):
|
||||
return """
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type("IfcTask")[0].id()"
|
||||
And I press "bim.enable_editing_task(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get("PredefinedType").enum_value" to "OPERATION"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
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 press "bim.assign_product(task={task}, relating_product='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 1.0, 1]"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_movement_of_a_wall(self):
|
||||
return """
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type("IfcTask")[0].id()"
|
||||
And I press "bim.enable_editing_task(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_attributes.get("PredefinedType").enum_value" to "MOVE"
|
||||
And I press "bim.edit_task"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
And I add a cube
|
||||
And I rename the object "Cube" to "ToObject"
|
||||
And the object "ToObject" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/ToObject" is selected
|
||||
And I press "bim.assign_product(task={task}, relating_product='')"
|
||||
When I add a cube
|
||||
And I rename the object "Cube" to "FromObject"
|
||||
And the object "FromObject" is selected
|
||||
And I press "bim.assign_class"
|
||||
And the object "IfcWall/FromObject" is selected
|
||||
And I press "bim.assign_process(task={task}, related_object_type="PRODUCT", related_object='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "True"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "True"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[1.0, 0.5, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/FromObject').hide_render" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').color" is "[1.0, 1.0, 0.0, 1]"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "False"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/FromObject').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
Then "scene.objects.get('IfcWall/FromObject').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/FromObject').hide_render" is "True"
|
||||
And "scene.objects.get('IfcWall/ToObject').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/ToObject').hide_render" is "False"
|
||||
"""
|
||||
|
||||
@test.bim.bootstrap.scenario
|
||||
def test_animating_the_consumption_of_a_wall(self):
|
||||
return """
|
||||
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_tasks(work_schedule={work_schedule})"
|
||||
And I press "bim.add_summary_task(work_schedule={work_schedule})"
|
||||
And the variable "task" is "IfcStore.get_file().by_type("IfcTask")[0].id()"
|
||||
And I press "bim.enable_editing_task_time(task={task})"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleStart").string_value" to "2021-01-02"
|
||||
And I set "scene.BIMWorkScheduleProperties.task_time_attributes.get("ScheduleFinish").string_value" to "2021-01-06"
|
||||
And I press "bim.edit_task_time"
|
||||
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 press "bim.assign_process(task={task}, related_object_type="PRODUCT", related_object='')"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_start" to "01/01/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.visualisation_finish" to "01/02/21"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_types" to "FRAME_SPEED"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_animation_frames" to "7"
|
||||
And I set "scene.BIMWorkScheduleProperties.speed_real_duration" to "P1W"
|
||||
And I press "bim.visualise_work_schedule_date_range(work_schedule={work_schedule})"
|
||||
When I am on frame "1"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[1.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
When I am on frame "2"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 1.0, 1.0, 1]"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_viewport" is "False"
|
||||
And "scene.objects.get('IfcWall/Cube').hide_render" is "False"
|
||||
When I am on frame "6"
|
||||
Then "scene.objects.get('IfcWall/Cube').color" is "[0.0, 0.0, 0.0, 1]"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_viewport" is "True"
|
||||
Then "scene.objects.get('IfcWall/Cube').hide_render" is "True"
|
||||
"""
|
||||
@@ -20,6 +20,7 @@ import os
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.bim
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from pytest_bdd import scenarios, given, when, then, parsers
|
||||
from mathutils import Vector
|
||||
@@ -104,6 +105,12 @@ def i_press_operator(operator):
|
||||
exec(f"bpy.ops.{operator}()")
|
||||
|
||||
|
||||
@when("I duplicate the selected objects")
|
||||
def i_duplicate_the_selected_objects():
|
||||
bpy.ops.object.duplicate_move()
|
||||
blenderbim.bim.handler.active_object_callback()
|
||||
|
||||
|
||||
@when("I deselect all objects")
|
||||
def i_deselect_all_objects():
|
||||
bpy.context.view_layer.objects.active = None
|
||||
@@ -117,6 +124,13 @@ def the_object_name_is_selected(name):
|
||||
additionally_the_object_name_is_selected(name)
|
||||
|
||||
|
||||
@when(parsers.parse('the object "{name}" is placed in the collection "{collection}"'))
|
||||
def the_object_name_is_placed_in_the_collection_collection(name, collection):
|
||||
obj = the_object_name_exists(name)
|
||||
[c.objects.unlink(obj) for c in obj.users_collection]
|
||||
bpy.data.collections.get(collection).objects.link(obj)
|
||||
|
||||
|
||||
@given(parsers.parse('additionally the object "{name}" is selected'))
|
||||
@when(parsers.parse('additionally the object "{name}" is selected'))
|
||||
def additionally_the_object_name_is_selected(name):
|
||||
@@ -127,6 +141,12 @@ def additionally_the_object_name_is_selected(name):
|
||||
obj.select_set(True)
|
||||
|
||||
|
||||
@given(parsers.parse('I rename the object "{name1}" to "{name2}"'))
|
||||
@when(parsers.parse('I rename the object "{name1}" to "{name2}"'))
|
||||
def i_rename_the_object_name1_to_name2(name1, name2):
|
||||
the_object_name_exists(name1).name = 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):
|
||||
@@ -141,6 +161,11 @@ def i_set_prop_to_value(prop, value):
|
||||
exec(f"bpy.context.{prop} = {value}")
|
||||
|
||||
|
||||
@when(parsers.parse('I am on frame "{number}"'))
|
||||
def i_am_on_frame_number(number):
|
||||
bpy.context.scene.frame_set(int(number))
|
||||
|
||||
|
||||
@when("I delete the selected objects")
|
||||
def i_delete_the_selected_objects():
|
||||
bpy.ops.object.delete()
|
||||
@@ -166,6 +191,29 @@ def the_object_name_exists(name) -> bpy.types.Object:
|
||||
return obj
|
||||
|
||||
|
||||
@then(parsers.parse('the object "{name1}" and "{name2}" are different elements'))
|
||||
def the_object_name1_and_name2_are_different_elements(name1, name2):
|
||||
ifc = an_ifc_file_exists()
|
||||
element1 = ifc.by_id(the_object_name_exists(name1).BIMObjectProperties.ifc_definition_id)
|
||||
element2 = ifc.by_id(the_object_name_exists(name2).BIMObjectProperties.ifc_definition_id)
|
||||
assert element1 != element2, f"Objects {name1} and {name2} have same elements {element1} and {element2}"
|
||||
|
||||
|
||||
@then(parsers.parse('the object "{name}" has a body of "{value}"'))
|
||||
def the_object_name_has_a_body_of_value(name, value):
|
||||
assert the_object_name_exists(name).data.body == value
|
||||
|
||||
|
||||
@then(parsers.parse('the object "{name}" has a "{_type}" representation of "{context}"'))
|
||||
def the_object_name_has_a_type_representation_of_context(name, _type, context):
|
||||
ifc = an_ifc_file_exists()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
context, subcontext, target_view = context.split("/")
|
||||
assert ifcopenshell.util.representation.get_representation(
|
||||
element, context, subcontext or None, target_view or None
|
||||
)
|
||||
|
||||
|
||||
@then(parsers.parse('the material "{name}" exists'))
|
||||
def the_material_name_exists(name) -> bpy.types.Material:
|
||||
obj = bpy.data.materials.get(name)
|
||||
@@ -330,7 +378,7 @@ def prop_is_value(prop, value):
|
||||
|
||||
|
||||
@then(parsers.parse('the object "{name}" has the material "{material}"'))
|
||||
def the_object_name_is_in_the_collection_collection(name, 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]
|
||||
|
||||
|
||||
@@ -357,6 +405,16 @@ def the_object_name_is_at_location(name, location):
|
||||
).length < 0.1, f"Object is at {obj_location}"
|
||||
|
||||
|
||||
@then(parsers.parse('the object "{name}" is contained in "{container_name}"'))
|
||||
def the_object_name_is_contained_in_container_name(name, container_name):
|
||||
ifc = an_ifc_file_exists()
|
||||
element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id)
|
||||
container = ifcopenshell.util.element.get_container(element)
|
||||
if not container:
|
||||
assert False, f'Object "{name}" is not in any container'
|
||||
assert container.Name == container_name, f'Object "{name}" is in {container}'
|
||||
|
||||
|
||||
@then(parsers.parse('the file "{name}" should contain "{value}"'))
|
||||
def the_file_name_should_contain_value(name, value):
|
||||
name = replace_variables(name)
|
||||
|
||||
Reference in New Issue
Block a user