From 371c54036d8427b8fb725015a56e70f44972cbb8 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 26 Oct 2023 17:19:51 +0500 Subject: [PATCH] test creating mep transition --- src/blenderbim/test/bim/feature/model.feature | 25 +++++++++++++++++++ src/blenderbim/test/bim/test_feature.py | 14 +++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/blenderbim/test/bim/feature/model.feature b/src/blenderbim/test/bim/feature/model.feature index 3aa74ffaee..d49c455625 100644 --- a/src/blenderbim/test/bim/feature/model.feature +++ b/src/blenderbim/test/bim/feature/model.feature @@ -525,3 +525,28 @@ Scenario: Create a door, undo and create a new door And I press "mesh.add_door()" Then nothing happens And the object "IfcDoor/IfcDoor" exists + +Scenario: Create a MEP transition + Given an empty IFC project + And I create default MEP types + And the variable "element_types" is "[str(e.id()) for e in {ifc}.by_type('IfcDuctSegmentType')]" + And I set "scene.BIMModelProperties.relating_type_id" to "{element_types}[0]" + And I press "bim.add_constr_type_instance" + And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/RectSegment" + + And I set "scene.BIMModelProperties.relating_type_id" to "{element_types}[1]" + And I press "bim.add_constr_type_instance" + And I rename the object "IfcDuctSegment/DuctSegment" to "IfcDuctSegment/CircleSegment" + + And the object "IfcDuctSegment/RectSegment" is moved to "0,0,0" + And the object "IfcDuctSegment/CircleSegment" is moved to "2.5,0,0" + And the object "IfcDuctSegment/CircleSegment" is selected + And additionally the object "IfcDuctSegment/RectSegment" is selected + And I press "bim.mep_add_transition()" + + Then the object "IfcDuctSegment/RectSegment" is at "0,0,0" + And the object "IfcDuctSegment/RectSegment" dimensions are "0.4,0.2,2.370096" + And the object "IfcDuctSegment/CircleSegment" is at "3.1299,0,0" + And the object "IfcDuctSegment/CircleSegment" dimensions are "0.1000, 0.09927, 2.370096" + And the object "IfcDuctFitting/DuctFitting" is at "2.370096, 0.0000, 0.0000" + And the object "IfcDuctFitting/DuctFitting" dimensions are "0.4000, 0.2000, 0.759807" diff --git a/src/blenderbim/test/bim/test_feature.py b/src/blenderbim/test/bim/test_feature.py index 9fd1c4317f..87787caf66 100644 --- a/src/blenderbim/test/bim/test_feature.py +++ b/src/blenderbim/test/bim/test_feature.py @@ -108,6 +108,20 @@ def i_load_a_new_pset_template_file(): IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path) +@given("I create default MEP types") +def i_create_default_mep_types(): + model_props = bpy.context.scene.BIMModelProperties + + model_props.type_class = "IfcDuctSegmentType" + model_props.type_name = "RECT1" + model_props.type_template = "FLOW_SEGMENT_RECTANGULAR" + bpy.ops.bim.add_type() + + model_props.type_template = "FLOW_SEGMENT_CIRCULAR" + model_props.type_name = "RECT2" + bpy.ops.bim.add_type() + + @given("I add a cube") @when("I add a cube") def i_add_a_cube():