Skip to content

Commit 74f8a35

Browse files
author
MichalO
committed
taking over new developmrnt from RFEM:
Design Situation and Combination Wizard tests update by @OndraMichal in dlubal-software/RFEM_Python_Client#317 Create CalculateInCloud function by @Rebecca-Coding21 in dlubal-software/RFEM_Python_Client#319 BUG: Missing definition of modelLst in init.Model.py by @jarabroz in dlubal-software/RFEM_Python_Client#324 Action and Action Combination by @OndraMichal in dlubal-software/RFEM_Python_Client#320 Heet aluminum design by @heetrojivadiya in dlubal-software/RFEM_Python_Client#325 VasStach concrete bridge example by @VasStach in dlubal-software/RFEM_Python_Client#326 unit tests: 141 passed, 5 skipped in 423.77s (0:07:03) RSTAB: 9.05.0004.232.9b37bf15c09
1 parent ab04b8b commit 74f8a35

21 files changed

Lines changed: 728 additions & 62 deletions

RSTAB/AluminumDesign/__init__.py

Whitespace-only changes.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
from RSTAB.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 (RSTAB 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 Aluminum Design SLS Configuration to Client Model
67+
model.clientModel.service.set_aluminum_design_sls_configuration(clientObject)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
from RSTAB.initModel import Model, clearAttributes, deleteEmptyAttributes, ConvertToDlString
2+
3+
class AluminumDesignULSConfigurations():
4+
5+
def __init__(self,
6+
no: int = 1,
7+
name: str = 'ULS1',
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 Ultimate 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 (RSTAB Class, optional): Model to be edited
23+
"""
24+
25+
# Client Model | Aluminum Design Ultimate Limit State Configurations
26+
clientObject = model.clientModel.factory.create('ns0:aluminum_design_uls_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 Aluminum Design ULS Configuration to Client Model
67+
model.clientModel.service.set_aluminum_design_uls_configuration(clientObject)
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
from RSTAB.initModel import Model, clearAttributes, deleteEmptyAttributes, ConvertStrToListOfInt
2+
from RSTAB.enums import ActionCategoryType, ActionType, ObjectTypes
3+
4+
class Action():
5+
def __init__(self,
6+
no: int = 1,
7+
action_category = ActionCategoryType.ACTION_CATEGORY_PERMANENT_G,
8+
action_type = ActionType.ACTING_ALTERNATIVELY,
9+
action_items: list = None,
10+
name: str = '',
11+
is_active: bool = True,
12+
comment: str = '',
13+
params: dict = None,
14+
model = Model):
15+
'''
16+
Combination Wizard Action
17+
18+
Args:
19+
no (int, optional): Action number
20+
action_category (enum, optional): Action category
21+
action_type (enum, optional): Action type
22+
action_items (list or list of lists, optional):
23+
- if action_type == 'ACTING_DIFFERENTLY': [[Load_case, acting_group], ...]
24+
- else: [Load_case, Load_case, ...]
25+
name (str, optional): Action name
26+
is_active (bool, optional): Define if active
27+
comment (str, optional): Comments
28+
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
29+
model (RSTAB Class, optional): Model to be edited
30+
'''
31+
32+
# Client model | Action
33+
clientObject = model.clientModel.factory.create('ns0:action')
34+
35+
# Clears object atributes | Sets all atributes to None
36+
clearAttributes(clientObject)
37+
38+
# Action No.
39+
clientObject.no = no
40+
41+
# Action Category
42+
clientObject.action_category = action_category.name
43+
44+
# Action Type
45+
clientObject.action_type = action_type.name
46+
47+
# Action Items
48+
if action_items:
49+
for i in action_items:
50+
if action_type == ActionType.ACTING_DIFFERENTLY:
51+
if not isinstance(i, list) or len(i) != 2:
52+
ValueError('WARNING: Object Action, parameter action_items, size of the nested list must be 2.')
53+
if isinstance(i[0], int) or isinstance(i[1], int):
54+
pass
55+
else:
56+
ValueError('WARNING: Object Action, parameter action_items, items in the nested list must be integers.')
57+
else:
58+
if not isinstance(i, int):
59+
ValueError('WARNING: Object Action, parameter action_items must be list of integers.')
60+
61+
items = model.clientModel.factory.create('ns0:array_of_action_items')
62+
for i,j in enumerate(action_items):
63+
item = model.clientModel.factory.create('ns0:action_items_row')
64+
item.no = i+1
65+
item.row = model.clientModel.factory.create('ns0:action_items')
66+
clearAttributes(item.row)
67+
if action_type == ActionType.ACTING_DIFFERENTLY:
68+
item.row.load_case_item = j[0]
69+
item.row.acting_group_number = j[1]
70+
else:
71+
item.row.load_case_item = j
72+
73+
items.action_items.append(item)
74+
75+
# Active
76+
clientObject.is_active = is_active
77+
78+
# Name
79+
if name:
80+
clientObject.user_defined_name_enabled = True
81+
clientObject.name = name
82+
83+
# Comment
84+
clientObject.comment = comment
85+
86+
# Adding optional parameters via dictionary
87+
if params:
88+
for key in params:
89+
clientObject[key] = params[key]
90+
91+
# Clearing unused attributes
92+
deleteEmptyAttributes(clientObject)
93+
94+
# Add Action to client model
95+
model.clientModel.service.set_action(clientObject)
96+
97+
98+
@staticmethod
99+
def DeleteAction(action_no: str = '1 2', model = Model):
100+
'''
101+
Delete Action objects
102+
103+
Args:
104+
actions_no (str): Numbers of Actions to be deleted
105+
model (RSTAB Class, optional): Model to be edited
106+
'''
107+
108+
# Delete Actions from client model
109+
for action in ConvertStrToListOfInt(action_no):
110+
model.clientModel.service.delete_object(ObjectTypes.E_OBJECT_TYPE_ACTION.name, action)
111+
112+
@staticmethod
113+
def GetAction(object_index: int = 1, model = Model):
114+
115+
'''
116+
Args:
117+
obejct_index (int): Action Index
118+
model (RSTAB Class, optional): Model to be edited
119+
'''
120+
121+
# Get Action from client model
122+
return model.clientModel.service.get_action(object_index)
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
from RSTAB.initModel import Model, clearAttributes, deleteEmptyAttributes, ConvertStrToListOfInt
2+
from RSTAB.enums import ObjectTypes
3+
4+
def ActionCombinationItem(model = Model, **kwargs):
5+
'''
6+
Set Action Combination Item.
7+
8+
Args:
9+
model (RSTAB Class): Model to be edited
10+
**kwargs - pass a keyworded, variable-length argument list. Following are all possible keywords:
11+
12+
action_item, operator_type, left_parenthesis, right_parenthesis, group_factor, action_factor,
13+
action_load_type, group_load_type, action, is_leading, gamma, psi, xi, k_fi, c_esl, k_def,
14+
psi_0, psi_1, psi_2, fi, gamma_0, alfa, k_f, phi, omega_0, gamma_l_1, k_creep, gamma_n, j_2
15+
Usage:
16+
aci1 = ActionCombinationItem(Model, action_item=1, operator_type=OperatorType.OPERATOR_AND.name, action_factor=1.0, action=1)
17+
18+
'''
19+
20+
# Action Combination Item
21+
clientObject = model.clientModel.factory.create('ns0:action_combination_items')
22+
clearAttributes(clientObject)
23+
24+
for key, value in kwargs.items():
25+
if key in clientObject.__keylist__:
26+
clientObject[key] = value
27+
28+
deleteEmptyAttributes(clientObject)
29+
30+
return clientObject
31+
32+
33+
class ActionCombination():
34+
def __init__(self,
35+
no: int = 1,
36+
design_situation: int = 1,
37+
action_combination_items: list = None,
38+
name: str = '',
39+
active: bool = True,
40+
comment: str = '',
41+
params: dict = None,
42+
model = Model):
43+
'''
44+
Action Combination
45+
46+
Attribute: Design Situation
47+
WARNING: Only design situations with an assigned combination wizard where a user-defined action combination is set are valid.
48+
49+
Args:
50+
no (int, mandatory): Action number
51+
design_situation (int, mandatory): Design Situation
52+
action_combination_items (list, mandatory): Action Combination Items list
53+
name (str, optional): Action Combination name
54+
active (bool, optional): Define if Active
55+
comment (str, optional): Comments
56+
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
57+
model (RSTAB Class, optional): Model to be edited
58+
'''
59+
60+
# Client model | Action
61+
clientObject = model.clientModel.factory.create('ns0:action_combination')
62+
63+
# Clears object atributes | Sets all atributes to None
64+
clearAttributes(clientObject)
65+
66+
# Action Combination No.
67+
clientObject.no = no
68+
69+
# Design Situation
70+
clientObject.design_situation = design_situation
71+
72+
# Action Combination Items
73+
if action_combination_items:
74+
items = model.clientModel.factory.create('ns0:array_of_action_combination_items')
75+
for i,j in enumerate(action_combination_items):
76+
item = model.clientModel.factory.create('ns0:action_combination_items_row')
77+
item.no = i+1
78+
item.row = j
79+
80+
items.action_combination_items.append(item)
81+
82+
clientObject.items = items
83+
# Active
84+
clientObject.active = active
85+
86+
# Name
87+
if name:
88+
clientObject.user_defined_name_enabled = True
89+
clientObject.name = name
90+
91+
# Comment
92+
clientObject.comment = comment
93+
94+
# Adding optional parameters via dictionary
95+
if params:
96+
for key in params:
97+
clientObject[key] = params[key]
98+
99+
# Clearing unused attributes
100+
deleteEmptyAttributes(clientObject)
101+
102+
# Add Action to client model
103+
model.clientModel.service.set_action_combination(clientObject)
104+
105+
@staticmethod
106+
def DeleteActionCombination(action_combination_no: str = '1 2', model = Model):
107+
'''
108+
Delete Action Combination object(s)
109+
110+
Args:
111+
actions_no (str): Numbers of Action Combinations to be deleted
112+
model (RSTAB Class, optional): Model to be edited
113+
'''
114+
115+
# Delete Action Combinations from client model
116+
for ac in ConvertStrToListOfInt(action_combination_no):
117+
model.clientModel.service.delete_object(ObjectTypes.E_OBJECT_TYPE_ACTION_COMBINATION.name, ac)
118+
119+
@staticmethod
120+
def GetActionCombination(object_index: int = 1, model = Model):
121+
'''
122+
Get action Combination object
123+
124+
Args:
125+
obejct_index (int): Action Combination Index
126+
model (RSTAB Class, optional): Model to be edited
127+
'''
128+
129+
# Get Action Combination from client model
130+
return model.clientModel.service.get_action_combination(object_index)

0 commit comments

Comments
 (0)