-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDefinition.py
177 lines (147 loc) · 3.81 KB
/
Definition.py
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# TODO: for future
from asyncio.windows_events import NULL
from enum import Enum
# Module to store constants
class Algebra:
EPSILON = 0.00001
def strToFloat(*args):
'''
Convert mathematical expression from string to float
-> Return [float] or False
'''
operators = ['+', '-', '*', '/']
floatValues = []
for strValue in args:
try:
if any(op in strValue for op in operators):
floatValue = float(eval(strValue))
else:
floatValue = float(strValue)
floatValues.append(floatValue)
except:
return []
return floatValues
class FileExtension:
projectSettings = '/projectSettings.csv'
displaySettings = '/displaySettings.csv'
floorPlan = '/floorPlan.csv'
floor = '/floor.csv'
panel = '/panel.csv'
bracings = '/bracings.csv'
bracingGroups = '/bracingGroups.csv'
sectionGroups = '/sectionGroups.csv'
areaSectionGroups = '/areaSectionGroups.csv'
bracingAssignments = '/bracingAssignments.csv'
sectionAssignments = '/sectionAssignments.csv'
areaSectionAssignments = '/areaSectionAssignments.csv'
inputTable = '/inputTable.csv'
outputTable = '/outputTable.csv'
stressTable = '/stressResultTable.csv'
errorLog = '/errorLog.csv'
SAPModels = '/SAP Models'
class MFHeader:
''' Main file header '''
projectSettings = '#Project_Settings'
displaySettings = '#Display_Settings'
floorPlans = '#Floor_Plans'
floors = '#Floors'
panels = '#Panels'
bracings = '#Bracings'
bracingGroups = '#Bracing_Groups'
sectionGroups = '#Section_Groups'
areaSectionGroups = '#Area_Section_Groups'
bracingAssignments = '#Bracing_Assignments'
sectionAssignments = '#Section_Assignments'
areaSectionAssignments = '#Area_Section_Assignments'
class EnumToString:
ATYPE = {
0: 'Time_History',
1: 'RSA',
}
CRTYPE = {
0: 'Do not run',
1: 'Single Floor',
2: 'All Floor',
}
class StringToEnum:
ATYPE = {
'Time_History': 0,
'RSA': 1,
}
CRTYPE = {
'Do not run': 0,
'Single Floor': 1,
'All Floor': 2,
}
class Color:
Node = {
'MainMenu': 'green',
'Bracing': 'green'
}
FloorPlan = {
'MainMenu': (
'blue',
'violet',
'red',
'pink',
'purple',
),
}
Panel = {
'MainMenu': 'orange',
}
Member = {
'Bracing': 'grey',
}
Text = {
'MainMenu': 'black',
}
class SAP2000Constants:
Units = {
'kip_in_F': 3,
'N_m_C': 10,
'N_mm_C': 9,
}
MaxDecimalPlaces = 6
CaseTypes = {
'LinearStatic': 1,
'NonlinearStatic': 2,
'Modal': 3,
'ResponseSpectrum': 4,
'LinearHistory': 5,
'NonlinearHistory': 6,
'LinearDynamic': 7,
'NonlinearDynamic': 8,
'MovingLoad': 9,
'Buckling': 10,
'SteadyState': 11,
'PowerSpectralDensity': 12,
'LinearStaticMultistep': 13,
'Hyperstatic': 14,
'ExternalResults': 15,
}
class Constants:
g = 9.81 # in m/s^2
filler = '_' # filler character for files
class UnitConversion:
'''
relative to kg
i.e. from xxx to kg
e.g. 1 lb = 0.453592 kbr
'''
Mass = {
'lb': 0.453592
}
class View2DConstants:
RATIO = 0.6 # constant for view to object ratio
# Size constants --------------------
MEMBER_SIZE = 5.0
NODE_SIZE = 15.0
TEXT_SIZE = 7.0
class InputFileKeyword:
# Tower elements
bracing = 'Bracing'
shearWall = 'ShearWall'
member = 'Member'
# Tower variable
variable = 'Variable'