Example #1
0
    def test_creating_a_new_body_if_there_is_a_parametric_material_usage(
            self, ifc, type):
        ifc.run("type.assign_type",
                related_object="element",
                relating_type="type").should_be_called()

        type.has_material_usage("element").should_be_called().will_return(True)
        type.get_body_representation("element").should_be_called().will_return(
            None)
        type.get_body_context().should_be_called().will_return("context")
        type.get_ifc_representation_class(
            "element").should_be_called().will_return("class")
        type.get_profile_set_usage("element").should_be_called().will_return(
            "usage")
        type.run_geometry_add_representation(
            obj="obj",
            context="context",
            ifc_representation_class="class",
            profile_set_usage="usage").should_be_called().will_return(
                "mapped_rep")

        ifc.get_object("element").should_be_called().will_return("obj")
        type.has_dynamic_voids("obj").should_be_called().will_return(False)
        type.run_geometry_switch_representation(
            obj="obj",
            representation="mapped_rep",
            should_reload=True,
            enable_dynamic_voids=False,
            is_global=False).should_be_called()
        type.disable_editing("obj").should_be_called()
        subject.assign_type(ifc, type, element="element", type="type")
Example #2
0
 def test_run(self, ifc, spatial):
     ifc.get_entity("obj").should_be_called().will_return("element")
     spatial.get_container("element").should_be_called().will_return("container")
     spatial.get_decomposed_elements("container").should_be_called().will_return(["contained_element"])
     ifc.get_object("contained_element").should_be_called().will_return("contained_obj")
     spatial.select_object("contained_obj").should_be_called()
     subject.select_similar_container(ifc, spatial, obj="obj")
Example #3
0
 def test_assigning_and_not_changing_data_if_the_type_has_no_data(
         self, ifc, type):
     ifc.run("type.assign_type",
             related_object="element",
             relating_type="type").should_be_called()
     type.has_material_usage("element").should_be_called().will_return(
         False)
     ifc.get_object("type").should_be_called().will_return("type_obj")
     type.get_object_data("type_obj").should_be_called().will_return(None)
     ifc.get_object("element").should_be_called().will_return("obj")
     type.disable_editing("obj").should_be_called()
     subject.assign_type(ifc, type, element="element", type="type")
Example #4
0
    def test_using_an_absolute_matrix_if_there_is_no_from_container(self, ifc, spatial):
        ifc.get_entity("obj").should_be_called().will_return("element")
        spatial.get_container("element").should_be_called().will_return(None)
        spatial.get_object_matrix("obj").should_be_called().will_return("matrix")

        ifc.get_object("to_container").should_be_called().will_return("to_container_obj")
        spatial.duplicate_object_and_data("obj").should_be_called().will_return("new_obj")
        spatial.set_relative_object_matrix("new_obj", "to_container_obj", "matrix").should_be_called()
        spatial.run_root_copy_class(obj="new_obj").should_be_called()
        spatial.run_spatial_assign_container(structure_obj="to_container_obj", element_obj="new_obj").should_be_called()

        spatial.disable_editing("obj").should_be_called()

        subject.copy_to_container(ifc, spatial, obj="obj", containers=["to_container"])
Example #5
0
 def test_assigning_and_switching_to_an_existing_type_data(self, ifc, type):
     ifc.run("type.assign_type",
             related_object="element",
             relating_type="type").should_be_called()
     type.has_material_usage("element").should_be_called().will_return(
         False)
     ifc.get_object("type").should_be_called().will_return("type_obj")
     type.get_object_data("type_obj").should_be_called().will_return(
         "type_obj_data")
     type.change_object_data("obj", "type_obj_data",
                             is_global=False).should_be_called()
     ifc.get_object("element").should_be_called().will_return("obj")
     type.disable_editing("obj").should_be_called()
     subject.assign_type(ifc, type, element="element", type="type")
Example #6
0
 def test_removing_an_actively_used_mapped_representation_by_remapping_usages_to_an_empty(self, ifc, geometry):
     ifc.get_entity("obj").should_be_called().will_return("element")
     geometry.is_mapped_representation("mapped_rep").should_be_called().will_return(False)
     geometry.is_type_product("element").should_be_called().will_return(True)
     geometry.get_element_type("element").should_be_called().will_return("type")
     geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
     geometry.get_representation_data("representation").should_be_called().will_return("data")
     geometry.has_data_users("data").should_be_called().will_return(True)
     geometry.get_elements_of_type("type").should_be_called().will_return(["element"])
     ifc.get_object("element").should_be_called().will_return("obj")
     geometry.replace_object_with_empty("obj").should_be_called()
     ifc.get_object("type").should_be_called().will_return("type_obj")
     geometry.replace_object_with_empty("type_obj").should_be_called()
     ifc.run("geometry.unassign_representation", product="type", representation="representation").should_be_called()
     ifc.run("geometry.remove_representation", representation="representation").should_be_called()
     subject.remove_representation(ifc, geometry, obj="obj", representation="mapped_rep")
Example #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")
Example #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")
Example #9
0
 def test_run(self, ifc, spatial):
     ifc.get_entity("obj").should_be_called().will_return("element")
     spatial.get_container("element").should_be_called().will_return("container")
     ifc.get_object("container").should_be_called().will_return("container_obj")
     spatial.set_active_object("container_obj").should_be_called()
     subject.select_container(ifc, spatial, obj="obj")