forked from dlubal-software/RFEM_Python_Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaseSettings.py
More file actions
95 lines (76 loc) · 3.97 KB
/
Copy pathbaseSettings.py
File metadata and controls
95 lines (76 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
from RFEM.initModel import Model
from RFEM.enums import GlobalAxesOrientationType, LocalAxesOrientationType
class BaseSettings():
def __init__(self,
gravitational_acceleration: int = 10,
global_axes_orientation = GlobalAxesOrientationType.E_GLOBAL_AXES_ORIENTATION_ZDOWN,
local_axes_orientation = LocalAxesOrientationType.E_LOCAL_AXES_ORIENTATION_ZDOWN,
tolerances: list = [0.0005, 0.0005, 0.0005, 0.0005],
member_representatives: bool = False,
member_set_representatives: bool = False,
params: dict = None,
model = Model):
"""
Args:
gravitational_acceleration (int): Gravitational Acceleration (m/sn2)
global_axes_orientation (enum): Global Axes Orientation Enumeration
local_axes_orientation (Enum): Local Axes Orientation Enumeration
tolerances (list): Tolerances List
tolerances = [tolerance_for_nodes, tolerance_for_lines, tolerance_for_surfaces_and_planes, tolerance_for_directions]
member_representatives (bool): Member Representatives
member_set_representatives (bool): Member Set Representatives
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (RFEM Class, optional): Model to be edited
"""
# Client model | Get Model Settings
clientObject = model.clientModel.service.get_model_settings_and_options()
# Gravitational Acceleration
clientObject.gravitational_acceleration = gravitational_acceleration
# Global Axes Orientation
clientObject.global_axes_orientation = global_axes_orientation.name
# Local Axes Orientation
clientObject.local_axes_orientation = local_axes_orientation.name
# Tolerances
if len(tolerances) != 4:
raise ValueError("WARNING:Expected size of the array. Kindly check the list correctness.")
clientObject.tolerance_for_nodes = tolerances[0]
clientObject.tolerance_for_lines = tolerances[1]
clientObject.tolerance_for_surfaces_and_planes = tolerances[2]
clientObject.tolerance_for_directions = tolerances[3]
# Member Representatives
clientObject.member_representatives_active = member_representatives
# Member Set Representatives
clientObject.member_set_representatives_active = member_set_representatives
# Adding optional parameters via dictionary
if params:
for key in params:
clientObject[key] = params[key]
# Add Base Data Settings to client model
model.clientModel.service.set_model_settings_and_options(clientObject)
class MainObjectsToActivate():
def __init__(self,
activate_members: bool = False,
activate_surfaces: bool = False,
activate_solids: bool = False,
params: dict = None,
model = Model):
"""
Args:
activate_members (bool): Activate Members
activate_surfaces (bool): Activate Surfaces
activate_solids (bool): Activate Solids
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (RFEM Class, optional): Model to be edited
"""
# Client model | Get Objects To Activate
clientObject = model.clientModel.service.get_main_objects_to_activate()
# Activate Objects
clientObject.activate_members = activate_members
clientObject.activate_surfaces = activate_surfaces
clientObject.activate_solids = activate_solids
# Adding optional parameters via dictionary
if params:
for key in params:
clientObject[key] = params[key]
# Add Models To Activate to client model
model.clientModel.service.set_main_objects_to_activate(clientObject)