Skip to content

Commit 9536a0f

Browse files
create designSupport.py
1 parent b25ab10 commit 9536a0f

2 files changed

Lines changed: 130 additions & 0 deletions

File tree

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
from RFEM.initModel import Model, clearAttributes, deleteEmptyAttributes, ConvertToDlString
2+
from RFEM.enums import DesignSupportOrientationZType
3+
4+
class DesignSupport():
5+
6+
def __init__(self,
7+
no: int = 1,
8+
members: str = '1',
9+
member_sets: str = None,
10+
nodes: str = '1 2',
11+
support_in_z: list = [True, True, DesignSupportOrientationZType.DESIGN_SUPPORT_ORIENTATION_ZAXIS_POSITIVE, 0.1],
12+
support_in_y: list = None,
13+
name: str = None,
14+
comment: str = '',
15+
params: dict = None,
16+
model = Model):
17+
18+
'''
19+
Design Support Type General
20+
21+
Args:
22+
no (int): Design Support Tag
23+
members (str): Assigned Members
24+
member_sets (str): Assigned Member Sets
25+
nodes (str): Assigned Nodes
26+
support_in_z (list): List of Parameters for Support in Z Axis
27+
support_in_y (list): List of Parameters for Support in Y Axis
28+
for support_depth_by_section_width_of_member_z/y_enabled = True:
29+
support_in_z/y = [activate support in z/y (bool), consider support in deflection design z/y (bool), design support orientation z/y type (enum), support width z/y (float)]
30+
for support_depth_by_section_width_of_member_z/y_enabled = False:
31+
support_in_z/y = [activate support in z/y (bool), consider support in deflection design z/y (bool), design support orientation z/y type (enum), support width z/y (float), support depth z/y (float)]
32+
name (str, option): User Defined Design Support 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 | Design Support
39+
clientObject = model.clientModel.factory.create('ns0:design_support')
40+
41+
# Clears object atributes | Sets all atributes to None
42+
clearAttributes(clientObject)
43+
44+
# Design Support No.
45+
clientObject.no = no
46+
47+
# Design Support Type
48+
clientObject.type = 'DESIGN_SUPPORT_TYPE_GENERAL'
49+
50+
# Assigned Members (e.g. '5 6 7 12')
51+
if members:
52+
clientObject.assigned_to_members = ConvertToDlString(members)
53+
54+
# Assigned Member Sets (e.g. '5 6 7 12')
55+
if member_sets:
56+
clientObject.assigned_to_member_sets = ConvertToDlString(member_sets)
57+
58+
# Assigned Nodes (e.g. '5 6 7 12')
59+
clientObject.assigned_to_nodes = ConvertToDlString(nodes)
60+
61+
# Support in Z
62+
if isinstance(support_in_z, list) and support_in_z[0] == True:
63+
clientObject.activate_in_z = support_in_z[0]
64+
clientObject.consider_in_deflection_design_z = support_in_z[1]
65+
clientObject.design_support_orientation_z = support_in_z[2].name
66+
clientObject.support_width_z = support_in_z[3]
67+
if len(support_in_z) == 5:
68+
clientObject.support_depth_by_section_width_of_member_z_enabled = False
69+
clientObject.support_depth_z = support_in_z[4]
70+
elif len(support_in_z) == 4:
71+
clientObject.support_depth_by_section_width_of_member_z_enabled = True
72+
else:
73+
raise ValueError('WARNING!: The suport in Z parameter needs to be length of 4 or 5. Kindly check list inputs for completeness and correctness.')
74+
75+
elif support_in_z == None or support_in_z == False:
76+
clientObject.activate_in_z = False
77+
78+
else:
79+
raise TypeError("WARNING! First parameter of list must be type bool. Kindly check list inputs completeness and correctness.")
80+
81+
# Support in Y
82+
if isinstance(support_in_y, list) and support_in_y[0] == True:
83+
clientObject.activate_in_y = support_in_y[0]
84+
clientObject.consider_in_deflection_design_y = support_in_y[1]
85+
clientObject.design_support_orientation_y = support_in_y[2].name
86+
clientObject.support_width_y = support_in_y[3]
87+
if len(support_in_y) == 5:
88+
clientObject.support_depth_by_section_width_of_member_y_enabled = False
89+
clientObject.support_depth_y = support_in_y[4]
90+
elif len(support_in_y) == 4:
91+
clientObject.support_depth_by_section_width_of_member_y_enabled = True
92+
else:
93+
raise ValueError('WARNING!: The suport in Y parameter needs to be length of 4 or 5. Kindly check list inputs for completeness and correctness.')
94+
95+
elif support_in_y == None or support_in_y == False:
96+
clientObject.activate_in_y = False
97+
98+
else:
99+
raise TypeError("WARNING! First parameter of list must be type bool. Kindly check list inputs completeness and correctness.")
100+
101+
# User Defined Name
102+
if name:
103+
clientObject.user_defined_name_enabled = True
104+
clientObject.name = name
105+
106+
# Comment
107+
clientObject.comment = comment
108+
109+
# Adding optional parameters via dictionary
110+
if params:
111+
for key in params:
112+
clientObject[key] = params[key]
113+
114+
# Delete None attributes for improved performance
115+
deleteEmptyAttributes(clientObject)
116+
117+
# Add Design Support to client model
118+
model.clientModel.service.set_design_support(clientObject)

RFEM/enums.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,3 +2629,15 @@ class PoissonRatioEditableGroupType(Enum):
26292629
Poisson Ratio Editable Group Type
26302630
'''
26312631
POISSON_RATIOS_GROUP_MAJOR_2D, POISSON_RATIOS_GROUP_MAJOR_3D, POISSON_RATIOS_GROUP_MINOR_2D, POISSON_RATIOS_GROUP_MINOR_3D = range(4)
2632+
2633+
class DesignSupportOrientationZType(Enum):
2634+
'''
2635+
Design Support Orientation Z Type
2636+
'''
2637+
DESIGN_SUPPORT_ORIENTATION_ZAXIS_BOTH, DESIGN_SUPPORT_ORIENTATION_ZAXIS_NEGATIVE, DESIGN_SUPPORT_ORIENTATION_ZAXIS_POSITIVE = range(3)
2638+
2639+
class DesignSupportOrientationYType(Enum):
2640+
'''
2641+
Design Support Orientation Y Type
2642+
'''
2643+
DESIGN_SUPPORT_ORIENTATION_YAXIS_BOTH, DESIGN_SUPPORT_ORIENTATION_YAXIS_NEGATIVE, DESIGN_SUPPORT_ORIENTATION_YAXIS_POSITIVE = range(3)

0 commit comments

Comments
 (0)