示例#1
0
 def _execute(self, context):
     core.switch_representation(
         tool.Geometry,
         obj=bpy.data.objects.get(self.obj) if self.obj else context.active_object,
         representation=tool.Ifc.get().by_id(self.ifc_definition_id),
         should_reload=self.should_reload,
         enable_dynamic_voids=self.disable_opening_subtractions,
         is_global=self.should_switch_all_meshes,
         should_sync_changes_first=True,
     )
示例#2
0
 def test_not_switching_if_an_updated_representation_is_the_same_one_we_were_going_to_switch_to(self, geometry):
     geometry.is_edited("obj").should_be_called().will_return(True)
     geometry.is_box_representation("mapped_rep").should_be_called().will_return(False)
     geometry.get_representation_id("mapped_rep").should_be_called().will_return("representation_id")
     geometry.run_geometry_update_representation(obj="obj").should_be_called()
     geometry.does_representation_id_exist("representation_id").should_be_called().will_return(False)
     subject.switch_representation(
         geometry,
         obj="obj",
         representation="mapped_rep",
         should_reload=False,
         enable_dynamic_voids=False,
         is_global=False,
         should_sync_changes_first=True,
     )
示例#3
0
 def test_switching_to_non_dynamic_baked_voids(self, geometry):
     geometry.is_edited("obj").should_be_called().will_return(False)
     geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
     geometry.get_representation_data("representation").should_be_called().will_return("data")
     geometry.change_object_data("obj", "data", is_global=False).should_be_called()
     geometry.clear_modifiers("obj").should_be_called()
     subject.switch_representation(
         geometry,
         obj="obj",
         representation="mapped_rep",
         should_reload=False,
         enable_dynamic_voids=False,
         is_global=False,
         should_sync_changes_first=True,
     )
示例#4
0
 def execute(self, context):
     self.file = IfcStore.get_file()
     obj = context.active_object
     props = obj.data.BIMMeshProperties
     parameter = props.ifc_parameters[self.index]
     self.file.by_id(parameter.step_id)[parameter.index] = parameter.value
     show_representation_parameters = bool(props.ifc_parameters)
     core.switch_representation(
         tool.Geometry,
         obj=obj,
         representation=tool.Ifc.get().by_id(props.ifc_definition_id),
         should_reload=True,
         enable_dynamic_voids=False,
         is_global=True,
         should_sync_changes_first=False,
     )
     if show_representation_parameters:
         core.get_representation_ifc_parameters(tool.Geometry, obj=obj)
     return {"FINISHED"}
示例#5
0
 def test_updating_a_representation_if_the_blender_object_has_been_edited_prior_to_switching(self, geometry):
     geometry.is_edited("obj").should_be_called().will_return(True)
     geometry.is_box_representation("mapped_rep").should_be_called().will_return(False)
     geometry.get_representation_id("mapped_rep").should_be_called().will_return("representation_id")
     geometry.run_geometry_update_representation(obj="obj").should_be_called()
     geometry.does_representation_id_exist("representation_id").should_be_called().will_return(True)
     geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
     geometry.get_representation_data("representation").should_be_called().will_return("data")
     geometry.change_object_data("obj", "data", is_global=False).should_be_called()
     geometry.clear_modifiers("obj").should_be_called()
     subject.switch_representation(
         geometry,
         obj="obj",
         representation="mapped_rep",
         should_reload=False,
         enable_dynamic_voids=False,
         is_global=False,
         should_sync_changes_first=True,
     )
示例#6
0
 def test_switching_to_a_freshly_loaded_representation(self, geometry):
     geometry.is_edited("obj").should_be_called().will_return(False)
     geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
     geometry.get_representation_data("representation").should_be_called().will_return(None)
     geometry.import_representation(
         "obj", "representation", enable_dynamic_voids=True
     ).should_be_called().will_return("new_data")
     geometry.get_representation_name("representation").should_be_called().will_return("name")
     geometry.rename_object("new_data", "name").should_be_called()
     geometry.link("representation", "new_data").should_be_called()
     geometry.change_object_data("obj", "new_data", is_global=True).should_be_called()
     geometry.clear_modifiers("obj").should_be_called()
     geometry.is_body_representation("representation").should_be_called().will_return(True)
     geometry.create_dynamic_voids("obj").should_be_called()
     subject.switch_representation(
         geometry,
         obj="obj",
         representation="mapped_rep",
         should_reload=True,
         enable_dynamic_voids=True,
         is_global=True,
         should_sync_changes_first=True,
     )