More robust type switching of parametric objects

This commit is contained in:
Dion Moult
2022-10-13 22:50:59 +11:00
parent ede9c5fca5
commit 2d37d3c914
4 changed files with 30 additions and 105 deletions
-44
View File
@@ -39,47 +39,3 @@ class TestAssignType:
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")
def test_updating_an_existing_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("representation")
type.get_representation_context("representation").should_be_called().will_return("context")
ifc.run(
"geometry.unassign_representation", product="element", representation="representation"
).should_be_called()
ifc.run("geometry.remove_representation", representation="representation").should_be_called()
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")
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")