|
| 1 | +from RFEM.initModel import Model, clearAttributes, deleteEmptyAttributes, ConvertToDlString |
| 2 | + |
| 3 | +class AluminumDesignSLSConfigurations(): |
| 4 | + |
| 5 | + def __init__(self, |
| 6 | + no: int = 1, |
| 7 | + name: str = 'SLS1', |
| 8 | + members_no: str = 'All', |
| 9 | + member_sets_no: str = 'All', |
| 10 | + comment: str = '', |
| 11 | + params: dict = None, |
| 12 | + model = Model): |
| 13 | + |
| 14 | + """ |
| 15 | + Args: |
| 16 | + no (int): Aluminum Design Serviceability Limit State Configuration Tag |
| 17 | + name (str): User Defined Configuration Name |
| 18 | + members_no (str): Assign Configuration to Selected Members |
| 19 | + member_sets_no (str): Assign Configuration to Selected Member Sets |
| 20 | + comment (str, optional): Comment |
| 21 | + params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary |
| 22 | + model (RFEM Class, optional): Model to be edited |
| 23 | + """ |
| 24 | + |
| 25 | + # Client Model | Aluminum Design Serviceability Limit State Configurations |
| 26 | + clientObject = model.clientModel.factory.create('ns0:aluminum_design_sls_configuration') |
| 27 | + |
| 28 | + # Clears object atributes | Sets all atributes to None |
| 29 | + clearAttributes(clientObject) |
| 30 | + |
| 31 | + # ULS Configuration No. |
| 32 | + clientObject.no = no |
| 33 | + |
| 34 | + # User Defined Name |
| 35 | + if name: |
| 36 | + clientObject.user_defined_name_enabled = True |
| 37 | + clientObject.name = name |
| 38 | + |
| 39 | + # Assigned Members |
| 40 | + if members_no == 'All': |
| 41 | + clientObject.assigned_to_all_members = True |
| 42 | + |
| 43 | + else: |
| 44 | + clientObject.assigned_to_all_members = False |
| 45 | + clientObject.assigned_to_members = ConvertToDlString(members_no) |
| 46 | + |
| 47 | + # Assigned Member Sets |
| 48 | + if member_sets_no == 'All': |
| 49 | + clientObject.assigned_to_all_member_sets = True |
| 50 | + |
| 51 | + else: |
| 52 | + clientObject.assigned_to_all_member_sets = False |
| 53 | + clientObject.assigned_to_member_sets = ConvertToDlString(member_sets_no) |
| 54 | + |
| 55 | + # Comment |
| 56 | + clientObject.comment = comment |
| 57 | + |
| 58 | + # Adding optional parameters via dictionary |
| 59 | + if params: |
| 60 | + for key in params: |
| 61 | + clientObject[key] = params[key] |
| 62 | + |
| 63 | + # Delete None attributes for improved performance |
| 64 | + deleteEmptyAttributes(clientObject) |
| 65 | + |
| 66 | + # Add Global Parameters to Client Model |
| 67 | + model.clientModel.service.set_aluminum_design_sls_configuration(clientObject) |
0 commit comments