Пример #1
0
    def test_copy_with_new_geometry_added_afresh_for_speed(
            self, ifc, collector, geometry, root):
        ifc.get_entity("obj").should_be_called().will_return(
            "original_element")
        ifc.run("root.copy_class",
                product="original_element").should_be_called().will_return(
                    "element")
        ifc.link("element", "obj").should_be_called()
        root.get_element_type("element").should_be_called().will_return("type")
        root.does_type_have_representations(
            "type").should_be_called().will_return(False)

        root.get_object_representation("obj").should_be_called().will_return(
            "representation")
        root.get_representation_context(
            "representation").should_be_called().will_return("context")
        geometry.get_ifc_representation_class(
            "element", "representation").should_be_called().will_return(
                "ifc_representation_class")
        geometry.get_profile_set_usage(
            "element").should_be_called().will_return("profile_set_usage")
        root.run_geometry_add_representation(
            obj="obj",
            context="context",
            ifc_representation_class="ifc_representation_class",
            profile_set_usage="profile_set_usage",
        ).should_be_called()
        collector.assign("obj").should_be_called()
        root.is_opening_element("element").should_be_called().will_return(
            False)
        subject.copy_class(ifc, collector, geometry, root, obj="obj")
Пример #2
0
    def test_adding_a_style_linked_to_a_material(self, ifc, style):
        style.get_name("obj").should_be_called().will_return("name")
        ifc.run("style.add_style",
                name="name").should_be_called().will_return("style")
        ifc.link("style", "obj").should_be_called()

        style.can_support_rendering_style(
            "obj").should_be_called().will_return(False)
        style.get_surface_shading_attributes(
            "obj").should_be_called().will_return("attributes")
        ifc.run("style.add_surface_style",
                style="style",
                ifc_class="IfcSurfaceStyleShading",
                attributes="attributes").should_be_called()

        style.can_support_texture_style("obj").should_be_called().will_return(
            False)

        ifc.get_entity("obj").should_be_called().will_return("material")
        style.get_context("obj").should_be_called().will_return("context")
        ifc.run("style.assign_material_style",
                material="material",
                style="style",
                context="context").should_be_called()
        assert subject.add_style(ifc, style, obj="obj") == "style"
Пример #3
0
 def test_not_adding_a_representation_if_requested(self, ifc, collector,
                                                   root):
     ifc.get_entity("obj").should_be_called().will_return(None)
     root.get_object_name("obj").should_be_called().will_return("name")
     ifc.run("root.create_entity",
             ifc_class="ifc_class",
             predefined_type="predefined_type",
             name="name").should_be_called().will_return("element")
     root.set_object_name("obj", "element").should_be_called()
     ifc.link("element", "obj").should_be_called()
     root.set_element_specific_display_settings(
         "obj", "element").should_be_called()
     collector.sync("obj").should_be_called()
     collector.assign("obj").should_be_called()
     subject.assign_class(
         ifc,
         collector,
         root,
         obj="obj",
         ifc_class="ifc_class",
         predefined_type="predefined_type",
         should_add_representation=False,
         context="context",
         ifc_representation_class="ifc_representation_class",
     )
Пример #4
0
 def test_assign_a_class_with_geometry_and_autodetected_spatial_container(
         self, ifc, collector, root):
     ifc.get_entity("obj").should_be_called().will_return(None)
     root.get_object_name("obj").should_be_called().will_return("name")
     ifc.run("root.create_entity",
             ifc_class="ifc_class",
             predefined_type="predefined_type",
             name="name").should_be_called().will_return("element")
     root.set_object_name("obj", "element").should_be_called()
     ifc.link("element", "obj").should_be_called()
     root.run_geometry_add_representation(
         obj="obj",
         context="context",
         ifc_representation_class="ifc_representation_class",
         profile_set_usage=None).should_be_called()
     root.set_element_specific_display_settings(
         "obj", "element").should_be_called()
     collector.sync("obj").should_be_called()
     collector.assign("obj").should_be_called()
     subject.assign_class(
         ifc,
         collector,
         root,
         obj="obj",
         ifc_class="ifc_class",
         predefined_type="predefined_type",
         should_add_representation=True,
         context="context",
         ifc_representation_class="ifc_representation_class",
     )
Пример #5
0
 def test_copy_with_no_new_geometry(self, ifc, collector, geometry, root):
     ifc.get_entity("obj").should_be_called().will_return(
         "original_element")
     ifc.run("root.copy_class",
             product="original_element").should_be_called().will_return(
                 "element")
     ifc.link("element", "obj").should_be_called()
     root.get_element_type("element").should_be_called().will_return("type")
     root.does_type_have_representations(
         "type").should_be_called().will_return(False)
     root.get_object_representation("obj").should_be_called().will_return(
         None)
     collector.assign("obj").should_be_called()
     root.is_opening_element("element").should_be_called().will_return(
         False)
     subject.copy_class(ifc, collector, geometry, root, obj="obj")
Пример #6
0
    def test_it_adds_a_style_with_rendering_attributes(self, ifc, style):
        style.get_name("obj").should_be_called().will_return("name")
        ifc.run("style.add_style",
                name="name").should_be_called().will_return("style")
        ifc.link("style", "obj").should_be_called()

        style.can_support_rendering_style(
            "obj").should_be_called().will_return(True)
        style.get_surface_rendering_attributes(
            "obj").should_be_called().will_return("attributes")
        ifc.run("style.add_surface_style",
                style="style",
                ifc_class="IfcSurfaceStyleRendering",
                attributes="attributes").should_be_called()

        style.can_support_texture_style("obj").should_be_called().will_return(
            False)

        ifc.get_entity("obj").should_be_called().will_return(None)
        assert subject.add_style(ifc, style, obj="obj") == "style"
Пример #7
0
 def test_copied_openings_have_dynamic_voids_added(self, ifc, collector,
                                                   root):
     ifc.get_entity("obj").should_be_called().will_return(
         "original_element")
     ifc.run("root.copy_class",
             product="original_element").should_be_called().will_return(
                 "element")
     ifc.link("element", "obj").should_be_called()
     root.get_element_type("element").should_be_called().will_return("type")
     root.does_type_have_representations(
         "type").should_be_called().will_return(True)
     ifc.run("type.map_type_representations",
             related_object="element",
             relating_type="type").should_be_called()
     ifc.get_object("type").should_be_called().will_return("type_obj")
     root.link_object_data("type_obj", "obj").should_be_called()
     collector.assign("obj").should_be_called()
     root.is_opening_element("element").should_be_called().will_return(True)
     root.add_dynamic_opening_voids("element", "obj").should_be_called()
     subject.copy_class(ifc, collector, geometry, root, obj="obj")
Пример #8
0
 def test_copy_with_new_geometry_derived_from_the_type(
         self, ifc, collector, root):
     ifc.get_entity("obj").should_be_called().will_return(
         "original_element")
     ifc.run("root.copy_class",
             product="original_element").should_be_called().will_return(
                 "element")
     ifc.link("element", "obj").should_be_called()
     root.get_element_type("element").should_be_called().will_return("type")
     root.does_type_have_representations(
         "type").should_be_called().will_return(True)
     ifc.run("type.map_type_representations",
             related_object="element",
             relating_type="type").should_be_called()
     ifc.get_object("type").should_be_called().will_return("type_obj")
     root.link_object_data("type_obj", "obj").should_be_called()
     collector.assign("obj").should_be_called()
     root.is_opening_element("element").should_be_called().will_return(
         False)
     subject.copy_class(ifc, collector, geometry, root, obj="obj")
Пример #9
0
 def test_run(self, ifc, material):
     material.add_default_material_object().should_be_called().will_return("obj")
     ifc.run("material.add_material", name="Default").should_be_called().will_return("material")
     ifc.link("material", "obj").should_be_called()
     assert subject.add_default_material(ifc, material) == "obj"