From 578ab140cc82f1f9fdcc94b45baf734f3bbe1954 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 9 Mar 2022 21:44:19 +1100 Subject: [PATCH] Create section and elevation contexts on new projects. See #1153. --- src/blenderbim/blenderbim/core/project.py | 8 +++++++- src/blenderbim/test/core/test_project.py | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/core/project.py b/src/blenderbim/blenderbim/core/project.py index c562bffb06..1407b19a1f 100644 --- a/src/blenderbim/blenderbim/core/project.py +++ b/src/blenderbim/blenderbim/core/project.py @@ -45,9 +45,15 @@ def create_project(ifc, project, schema=None, template=None): context_type="Model", context_identifier="Box", target_view="MODEL_VIEW", parent=model ) plan = project.run_context_add_context(context_type="Plan", context_identifier="", target_view="", parent=0) - annotation = project.run_context_add_context( + project.run_context_add_context( context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent=plan ) + project.run_context_add_context( + context_type="Plan", context_identifier="Annotation", target_view="SECTION_VIEW", parent=plan + ) + project.run_context_add_context( + context_type="Plan", context_identifier="Annotation", target_view="ELEVATION_VIEW", parent=plan + ) project.run_root_assign_class(obj=site, ifc_class="IfcSite", context=body) project.run_root_assign_class(obj=building, ifc_class="IfcBuilding", context=body) diff --git a/src/blenderbim/test/core/test_project.py b/src/blenderbim/test/core/test_project.py index 1ff903b180..e02bd149c0 100644 --- a/src/blenderbim/test/core/test_project.py +++ b/src/blenderbim/test/core/test_project.py @@ -53,6 +53,12 @@ class TestCreateProject: project.run_context_add_context( context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan" ).should_be_called() + project.run_context_add_context( + context_type="Plan", context_identifier="Annotation", target_view="SECTION_VIEW", parent="plan" + ).should_be_called() + project.run_context_add_context( + context_type="Plan", context_identifier="Annotation", target_view="ELEVATION_VIEW", parent="plan" + ).should_be_called() project.run_root_assign_class(obj="site", ifc_class="IfcSite", context="body").should_be_called() project.run_root_assign_class(obj="building", ifc_class="IfcBuilding", context="body").should_be_called() @@ -94,6 +100,12 @@ class TestCreateProject: project.run_context_add_context( context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan" ).should_be_called() + project.run_context_add_context( + context_type="Plan", context_identifier="Annotation", target_view="SECTION_VIEW", parent="plan" + ).should_be_called() + project.run_context_add_context( + context_type="Plan", context_identifier="Annotation", target_view="ELEVATION_VIEW", parent="plan" + ).should_be_called() project.run_root_assign_class(obj="site", ifc_class="IfcSite", context="body").should_be_called() project.run_root_assign_class(obj="building", ifc_class="IfcBuilding", context="body").should_be_called() @@ -144,6 +156,12 @@ class TestCreateProject: project.run_context_add_context( context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan" ).should_be_called() + project.run_context_add_context( + context_type="Plan", context_identifier="Annotation", target_view="SECTION_VIEW", parent="plan" + ).should_be_called() + project.run_context_add_context( + context_type="Plan", context_identifier="Annotation", target_view="ELEVATION_VIEW", parent="plan" + ).should_be_called() project.run_root_assign_class(obj="site", ifc_class="IfcSite", context="body").should_be_called() project.run_root_assign_class(obj="building", ifc_class="IfcBuilding", context="body").should_be_called()