|
| 1 | +from RFEM.initModel import Model, clearAttributes, deleteEmptyAttributes, ConvertToDlString |
| 2 | +from RFEM.dataTypes import inf |
| 3 | +from RFEM.enums import SurfaceTranslationalReleaseNonlinearity, SurfaceReleaseTypeLocalAxisSystemType |
| 4 | + |
| 5 | +class SurfaceReleaseType(): |
| 6 | + |
| 7 | + def __init__(self, |
| 8 | + no: int = 1, |
| 9 | + spring_constant: list = [inf, inf, inf], |
| 10 | + translational_release_ux_nonlinearity = SurfaceTranslationalReleaseNonlinearity.NONLINEARITY_TYPE_NONE, |
| 11 | + translational_release_uy_nonlinearity = SurfaceTranslationalReleaseNonlinearity.NONLINEARITY_TYPE_NONE, |
| 12 | + translational_release_uz_nonlinearity = SurfaceTranslationalReleaseNonlinearity.NONLINEARITY_TYPE_NONE, |
| 13 | + local_axis_system_type = SurfaceReleaseTypeLocalAxisSystemType.LOCAL_AXIS_SYSTEM_TYPE_REVERSED_TO_ORIGINAL_SURFACE, |
| 14 | + surface_releases: str = None, |
| 15 | + name: str = None, |
| 16 | + comment: str = '', |
| 17 | + params: dict = None, |
| 18 | + model = Model): |
| 19 | + |
| 20 | + ''' |
| 21 | + Surface Release Type |
| 22 | +
|
| 23 | + Args: |
| 24 | + no (int): Surface Release Type Tag |
| 25 | + spring_constant (list): Spring Constant List |
| 26 | + spring_constant = [translational_release_u_x, translational_release_u_y, translational_release_u_z] |
| 27 | + translational_release_ux_nonlinearity (enum): Surface Translation Release along X Direction Nonliniearity Enumeration |
| 28 | + translational_release_uy_nonlinearity (enum): Surface Translation Release along Y Direction Nonliniearity Enumeration |
| 29 | + translational_release_uz_nonlinearity (enum): Surface Translation Release along Z Direction Nonliniearity Enumeration |
| 30 | + local_axis_system_type (enum): Surface Release Local Axis System Enumeration |
| 31 | + surface_releases (str, optional): Assign Surface Release |
| 32 | + name (str, optional): User Defined Surface Release Type Name |
| 33 | + comment (str, optional): Comment |
| 34 | + params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary |
| 35 | + model (RFEM Class, optional): Model to be edited |
| 36 | + ''' |
| 37 | + |
| 38 | + # Client model | Surface Release Type |
| 39 | + clientObject = model.clientModel.factory.create('ns0:surface_release_type') |
| 40 | + |
| 41 | + # Clears object atributes | Sets all atributes to None |
| 42 | + clearAttributes(clientObject) |
| 43 | + |
| 44 | + # Surface Release Type No. |
| 45 | + clientObject.no = no |
| 46 | + |
| 47 | + # Surface Release Type Condition |
| 48 | + clientObject.translational_release_u_x = spring_constant[0] |
| 49 | + clientObject.translational_release_u_y = spring_constant[1] |
| 50 | + clientObject.translational_release_u_z = spring_constant[2] |
| 51 | + |
| 52 | + # Surface Release Nonlinearity Type |
| 53 | + clientObject.translational_release_u_x_nonlinearity = translational_release_ux_nonlinearity.name |
| 54 | + clientObject.translational_release_u_y_nonlinearity = translational_release_uy_nonlinearity.name |
| 55 | + clientObject.translational_release_u_z_nonlinearity = translational_release_uz_nonlinearity.name |
| 56 | + |
| 57 | + # Surface Release Local Axis System |
| 58 | + clientObject.local_axis_system_type = local_axis_system_type.name |
| 59 | + |
| 60 | + # Assign Surface Releases |
| 61 | + if surface_releases: |
| 62 | + clientObject.surface_releases = ConvertToDlString(surface_releases) |
| 63 | + |
| 64 | + # Surface Release Type User defined name |
| 65 | + if name: |
| 66 | + clientObject.user_defined_name_enabled = True |
| 67 | + clientObject.name = name |
| 68 | + |
| 69 | + # Comment |
| 70 | + clientObject.comment = comment |
| 71 | + |
| 72 | + # Adding optional parameters via dictionary |
| 73 | + if params: |
| 74 | + for key in params: |
| 75 | + clientObject[key] = params[key] |
| 76 | + |
| 77 | + # Delete None attributes for improved performance |
| 78 | + deleteEmptyAttributes(clientObject) |
| 79 | + |
| 80 | + # Add Surface Release Type to Client Model |
| 81 | + model.clientModel.service.set_surface_release_type(clientObject) |
0 commit comments