[docs]@register_api_implementation(core_class=LinkLoad)classLinkLoadSetup(LoadSetup,TranslationSettableMixin,RotationSettableMixin):""" The API handler for link loads The following example shows how to create a link load using the API, it is assumed that these steps were performed in each of the examples for other methods in this class. .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> lcc_setup = simulation_setup.create_load_case_container_setup().set_name(name='Example LCC') >>> lc_setup = lcc_setup.create_load_case_setup(lc_type='Mechanical load case').set_name(name='Example LC') >>> link_load_setup = lc_setup.create_load_setup(load_type='Link load') .. >>> isinstance(link_load_setup, LinkLoadSetup) True >>> isinstance(link_load_setup._load, LinkLoad) True The next example shows how to get an API object for an already existing load. .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> lcc_setup = simulation_setup.create_load_case_container_setup().set_name(name='Example LCC') >>> lc_setup = lcc_setup.create_load_case_setup(lc_type='Mechanical load case').set_name(name='Example LC') .. >>> link_load_setup = lc_setup.create_load_setup(load_type='Link load') >>> link_load_setup = lc_setup.get_load_setup(index=0) # The load under this index must already exist .. >>> isinstance(link_load_setup, LinkLoadSetup) True >>> isinstance(link_load_setup._load, LinkLoad) True """
[docs]defset_u(self,value:float)->'LinkLoadSetup':""" Sets the 'u' value of the load vector See example at the top for how to create a link load setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link_load_setup = link_load_setup.set_u(value=10) .. >>> link_load_setup._load.generalized_force_vector.u == 10 True >>> link_load_setup.set_u(value='wrong value') Traceback (most recent call last): ... TypeError: ... Returns ------- self: LinkLoadSetup Raises ------ TypeError Raised if the supplied value is not a floating point number """self.set_dof_dict(dof_values_dict={'u':value})returnself
[docs]defset_v(self,value:float)->'LinkLoadSetup':""" Sets the 'v' value of the load vector See example at the top for how to create a link load setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link_load_setup = link_load_setup.set_v(value=10) .. >>> link_load_setup._load.generalized_force_vector.v == 10 True >>> link_load_setup.set_v(value='wrong value') Traceback (most recent call last): ... TypeError: ... Returns ------- self: LinkLoadSetup Raises ------ TypeError Raised if the supplied value is not a floating point number """self.set_dof_dict(dof_values_dict={'v':value})returnself
[docs]defset_w(self,value:float)->'LinkLoadSetup':""" Sets the 'w' value of the load vector See example at the top for how to create a link load setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link_load_setup = link_load_setup.set_w(value=10) .. >>> link_load_setup._load.generalized_force_vector.w == 10 True >>> link_load_setup.set_w(value='wrong value') Traceback (most recent call last): ... TypeError: ... Returns ------- self: LinkLoadSetup Raises ------ TypeError Raised if the supplied value is not a floating point number """self.set_dof_dict(dof_values_dict={'w':value})returnself
[docs]defset_ru(self,value:float)->'LinkLoadSetup':""" Sets the 'ru' value of the load vector See example at the top for how to create a link load setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link_load_setup = link_load_setup.set_ru(value=10) .. >>> link_load_setup._load.generalized_force_vector.ru == 10 True >>> link_load_setup.set_ru(value='wrong value') Traceback (most recent call last): ... TypeError: ... Returns ------- self: LinkLoadSetup Raises ------ TypeError Raised if the supplied value is not a floating point number """self.set_dof_dict(dof_values_dict={'ru':value})returnself
[docs]defset_rv(self,value:float)->'LinkLoadSetup':""" Sets the 'rv' value of the load vector See example at the top for how to create a link load setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link_load_setup = link_load_setup.set_rv(value=10) .. >>> link_load_setup._load.generalized_force_vector.rv == 10 True >>> link_load_setup.set_rv(value='wrong value') Traceback (most recent call last): ... TypeError: ... Returns ------- self: LinkLoadSetup Raises ------ TypeError Raised if the supplied value is not a floating point number """self.set_dof_dict(dof_values_dict={'rv':value})returnself
[docs]defset_rw(self,value:float)->'LinkLoadSetup':""" Sets the 'rw' value of the load vector See example at the top for how to create a link load setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link_load_setup = link_load_setup.set_rw(value=10) .. >>> link_load_setup._load.generalized_force_vector.rw == 10 True >>> link_load_setup.set_rw(value='wrong value') Traceback (most recent call last): ... TypeError: ... Returns ------- self: LinkLoadSetup Raises ------ TypeError Raised if the supplied value is not a floating point number """self.set_dof_dict(dof_values_dict={'rw':value})returnself
[docs]defset_dof_dict(self,dof_values_dict:typing.Dict[str,float])->'LinkLoadSetup':""" Sets the values of the load vector to those given in the dictionary See example at the top for how to create a link load setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link_load_setup = link_load_setup.set_dof_dict(dof_values_dict={'u': 5, 'ru': 10, 'v': 2.0}) .. >>> link_load_setup._load.generalized_force_vector.u == 5 True >>> link_load_setup._load.generalized_force_vector.ru == 10 True >>> link_load_setup._load.generalized_force_vector.v == 2.0 True >>> link_load_setup.set_dof_dict(dof_values_dict={'u': 'wrong value'}) Traceback (most recent call last): ... TypeError: ... >>> link_load_setup.set_dof_dict(dof_values_dict={'wrong dof': 10}) Traceback (most recent call last): ... more.api.exceptions.api_exception.NameNotFoundError: ... Returns ------- self: LinkLoadSetup Raises ------ TypeError Raised if the supplied value is not a floating point number NameNotFoundError Raised if a key in the supplied dictionary is not a recognized dof """self._load.generalized_force_vector.set_dof_dict(dof_values_dict=dof_values_dict)returnself
[docs]defset_link_by_name(self,link_name:str)->'LinkLoadSetup':""" Sets the link for the associated link load See example at the top for how to create a link load setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link = proj.comp.add_link(physics='mech') >>> link.name = 'example link' >>> link_load_setup = link_load_setup.set_link_by_name(link_name='example link') # The link with this name must already exist .. >>> link_load_setup._load.link_selector.selected_entity == link True >>> link_load_setup = link_load_setup.set_link_by_name(link_name='nonexistent name') Traceback (most recent call last): ... more.api.exceptions.api_exception.NameNotFoundError: ... Returns ------- self: LinkLoadSetup Raises ------ NameNotFoundError Raised if the supplied link name was not found """self._load.link_selector.select_entity_by_name(name=link_name)returnself
[docs]defset_link(self,link)->'LinkLoadSetup':""" Deprecated method .. admonition:: Deprecated :class: warning `set_link` will be removed in a future MORe release, it is replaced by :meth:`~.set_link_by_name` """logger.warning('Deprecation: \"set_link\" will be removed in a future MORe release, it is replaced by \"set_link_by_name\"')returnself.set_link_by_name(link_name=link.name)
[docs]defset_dof(self,dof_name,value)->'LinkLoadSetup':""" Sets the value of an element of the DOF vector See example at the top for how to create the setup object .. admonition:: Example :class: note .. >>> import more.project >>> proj = more.project.Project() >>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> link_load_setup = _link_load_api_setup(api) >>> link_load_setup = link_load_setup.set_dof(dof_name='v', value=10) .. >>> link_load_setup._load.generalized_force_vector.v == 10 True >>> link_load_setup.set_dof(dof_name='v', value='wrong value') Traceback (most recent call last): ... TypeError: ... >>> link_load_setup.set_dof(dof_name='wrong dof', value=10) Traceback (most recent call last): ... more.api.exceptions.api_exception.NameNotFoundError: ... Returns ------- self: LinkLoadSetup Raises ------ TypeError Raised if the supplied value is not a floating point number NameNotFoundError Raised if the given name is not a recognized DOF """returnself.set_dof_dict(dof_values_dict={dof_name:value})