Exemplo n.º 1
0
 def _execute(self, context):
     props = context.scene.BIMProjectProperties
     template = None if props.template_file == "0" else props.template_file
     core.create_project(tool.Ifc,
                         tool.Project,
                         schema=props.export_schema,
                         template=template)
Exemplo n.º 2
0
    def test_create_an_ifc2x3_project_with_owner_defaults(self, ifc, project):
        ifc.get().should_be_called().will_return(None)
        ifc.run("project.create_file", version="IFC2X3").should_be_called().will_return("ifc")
        ifc.set("ifc").should_be_called()

        project.run_owner_add_person().should_be_called().will_return("person")
        project.run_owner_add_organisation().should_be_called().will_return("organisation")
        project.run_owner_add_person_and_organisation(
            person="person", organisation="organisation"
        ).should_be_called().will_return("user")
        project.run_owner_set_user(user="******").should_be_called()

        project.create_empty("My Project").should_be_called().will_return("project")
        project.create_empty("My Site").should_be_called().will_return("site")
        project.create_empty("My Building").should_be_called().will_return("building")
        project.create_empty("My Storey").should_be_called().will_return("storey")
        project.run_root_assign_class(obj="project", ifc_class="IfcProject").should_be_called()
        project.run_unit_assign_scene_units().should_be_called()

        project.run_context_add_context(
            context_type="Model", context_identifier="", target_view="", parent=0
        ).should_be_called().will_return("model")
        project.run_context_add_context(
            context_type="Model", context_identifier="Body", target_view="MODEL_VIEW", parent="model"
        ).should_be_called().will_return("body")
        project.run_context_add_context(
            context_type="Model", context_identifier="Box", target_view="MODEL_VIEW", parent="model"
        ).should_be_called()
        project.run_context_add_context(
            context_type="Plan", context_identifier="", target_view="", parent=0
        ).should_be_called().will_return("plan")
        project.run_context_add_context(
            context_type="Plan", context_identifier="Annotation", target_view="PLAN_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()
        project.run_root_assign_class(obj="storey", ifc_class="IfcBuildingStorey", context="body").should_be_called()

        project.run_aggregate_assign_object(relating_obj="project", related_obj="site").should_be_called()
        project.run_aggregate_assign_object(relating_obj="site", related_obj="building").should_be_called()
        project.run_aggregate_assign_object(relating_obj="building", related_obj="storey").should_be_called()

        project.set_context("body").should_be_called()

        subject.create_project(ifc, project, schema="IFC2X3", template=None)
Exemplo n.º 3
0
    def test_appending_project_template_types_if_specified(self, ifc, project):
        ifc.get().should_be_called().will_return(None)
        ifc.run("project.create_file", version="IFC4").should_be_called().will_return("ifc")
        ifc.set("ifc").should_be_called()

        project.create_empty("My Project").should_be_called().will_return("project")
        project.create_empty("My Site").should_be_called().will_return("site")
        project.create_empty("My Building").should_be_called().will_return("building")
        project.create_empty("My Storey").should_be_called().will_return("storey")
        project.run_root_assign_class(obj="project", ifc_class="IfcProject").should_be_called()
        project.run_unit_assign_scene_units().should_be_called()

        project.run_context_add_context(
            context_type="Model", context_identifier="", target_view="", parent=0
        ).should_be_called().will_return("model")
        project.run_context_add_context(
            context_type="Model", context_identifier="Body", target_view="MODEL_VIEW", parent="model"
        ).should_be_called().will_return("body")
        project.run_context_add_context(
            context_type="Model", context_identifier="Box", target_view="MODEL_VIEW", parent="model"
        ).should_be_called()
        project.run_context_add_context(
            context_type="Plan", context_identifier="", target_view="", parent=0
        ).should_be_called().will_return("plan")
        project.run_context_add_context(
            context_type="Plan", context_identifier="Annotation", target_view="PLAN_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()
        project.run_root_assign_class(obj="storey", ifc_class="IfcBuildingStorey", context="body").should_be_called()

        project.run_aggregate_assign_object(relating_obj="project", related_obj="site").should_be_called()
        project.run_aggregate_assign_object(relating_obj="site", related_obj="building").should_be_called()
        project.run_aggregate_assign_object(relating_obj="building", related_obj="storey").should_be_called()

        project.set_context("body").should_be_called()

        project.append_all_types_from_template("template").should_be_called()

        subject.create_project(ifc, project, schema="IFC4", template="template")
Exemplo n.º 4
0
 def test_do_nothing_if_a_project_already_exists(self, ifc, project):
     ifc.get().should_be_called().will_return("ifc")
     subject.create_project(ifc, project, schema="IFC4", template=None)