mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Create section and elevation contexts on new projects. See #1153.
This commit is contained in:
@@ -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
|
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)
|
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
|
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=site, ifc_class="IfcSite", context=body)
|
||||||
project.run_root_assign_class(obj=building, ifc_class="IfcBuilding", context=body)
|
project.run_root_assign_class(obj=building, ifc_class="IfcBuilding", context=body)
|
||||||
|
|||||||
@@ -53,6 +53,12 @@ class TestCreateProject:
|
|||||||
project.run_context_add_context(
|
project.run_context_add_context(
|
||||||
context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan"
|
context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan"
|
||||||
).should_be_called()
|
).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="site", ifc_class="IfcSite", context="body").should_be_called()
|
||||||
project.run_root_assign_class(obj="building", ifc_class="IfcBuilding", 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(
|
project.run_context_add_context(
|
||||||
context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan"
|
context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan"
|
||||||
).should_be_called()
|
).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="site", ifc_class="IfcSite", context="body").should_be_called()
|
||||||
project.run_root_assign_class(obj="building", ifc_class="IfcBuilding", 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(
|
project.run_context_add_context(
|
||||||
context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan"
|
context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan"
|
||||||
).should_be_called()
|
).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="site", ifc_class="IfcSite", context="body").should_be_called()
|
||||||
project.run_root_assign_class(obj="building", ifc_class="IfcBuilding", context="body").should_be_called()
|
project.run_root_assign_class(obj="building", ifc_class="IfcBuilding", context="body").should_be_called()
|
||||||
|
|||||||
Reference in New Issue
Block a user