midas-civil 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of midas-civil might be problematic. Click here for more details.
- midas_civil/__init__.py +24 -0
- midas_civil/_boundary.py +504 -0
- midas_civil/_construction.py +415 -0
- midas_civil/_element.py +275 -0
- midas_civil/_group.py +312 -0
- midas_civil/_load.py +384 -0
- midas_civil/_mapi.py +66 -0
- midas_civil/_material.py +393 -0
- midas_civil/_model.py +352 -0
- midas_civil/_node.py +146 -0
- midas_civil/_result.py +488 -0
- midas_civil/_result_extract.py +103 -0
- midas_civil/_section.py +739 -0
- midas_civil/_thickness.py +139 -0
- midas_civil/_utils.py +83 -0
- midas_civil-0.0.1.dist-info/METADATA +54 -0
- midas_civil-0.0.1.dist-info/RECORD +20 -0
- midas_civil-0.0.1.dist-info/WHEEL +5 -0
- midas_civil-0.0.1.dist-info/licenses/LICENSE +21 -0
- midas_civil-0.0.1.dist-info/top_level.txt +1 -0
midas_civil/_group.py
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
|
|
2
|
+
from ._mapi import *
|
|
3
|
+
#---------------------------------------------------------------------------------------------------------------
|
|
4
|
+
class Group:
|
|
5
|
+
|
|
6
|
+
@classmethod
|
|
7
|
+
def create(cls):
|
|
8
|
+
if cls.Structure.Groups!=[]: cls.Structure.create()
|
|
9
|
+
if cls.Boundary.Groups!=[]:cls.Boundary.create()
|
|
10
|
+
if cls.Load.Groups!=[]:cls.Load.create()
|
|
11
|
+
if cls.Tendon.Groups!=[]:cls.Tendon.create()
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def sync(cls):
|
|
15
|
+
cls.Structure.sync()
|
|
16
|
+
cls.Boundary.sync()
|
|
17
|
+
cls.Load.sync()
|
|
18
|
+
cls.Tendon.sync()
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def delete(cls):
|
|
22
|
+
cls.Structure.delete()
|
|
23
|
+
cls.Boundary.delete()
|
|
24
|
+
cls.Load.delete()
|
|
25
|
+
cls.Tendon.delete()
|
|
26
|
+
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#--------------------------------- STRUCTURE ---------------------------------------
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Structure:
|
|
35
|
+
|
|
36
|
+
Groups = []
|
|
37
|
+
ids=[]
|
|
38
|
+
url= "/db/GRUP"
|
|
39
|
+
|
|
40
|
+
def __init__(self, name, nlist=[],elist=[]):
|
|
41
|
+
""""""
|
|
42
|
+
self.NAME = name
|
|
43
|
+
if Group.Structure.Groups == []: self.ID=1
|
|
44
|
+
else: self.ID= max(Group.Structure.ids)+1
|
|
45
|
+
self.ELIST = list(set(elist))
|
|
46
|
+
self.NLIST = list(set(nlist))
|
|
47
|
+
Group.Structure.ids.append(self.ID)
|
|
48
|
+
Group.Structure.Groups.append(self)
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def update(cls, name,operation = "r", nlist = [],elist = [] ):
|
|
52
|
+
"""Group name, element list, node list, operation ("add" or "replace").\n
|
|
53
|
+
Sample: update_SG("Girder", [1,2,...20],[],"replace")"""
|
|
54
|
+
up = 0
|
|
55
|
+
for i in cls.Groups:
|
|
56
|
+
if name == i.NAME:
|
|
57
|
+
up = 1
|
|
58
|
+
if operation == "r":
|
|
59
|
+
i.ELIST = list(set(elist))
|
|
60
|
+
i.NLIST = list(set(nlist))
|
|
61
|
+
if operation == "a":
|
|
62
|
+
i.ELIST = list(set(i.ELIST + elist))
|
|
63
|
+
i.NLIST = list(set(i.NLIST + nlist))
|
|
64
|
+
if up == 0: print(f"⚠️ Structure group {name} is not defined!")
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def json(cls):
|
|
68
|
+
"Generates the json file for all defined structure groups."
|
|
69
|
+
json = {"Assign":{}}
|
|
70
|
+
for i in cls.Groups:
|
|
71
|
+
json["Assign"][i.ID] = {
|
|
72
|
+
"NAME": i.NAME,
|
|
73
|
+
"P_TYPE": 0,
|
|
74
|
+
"N_LIST": i.NLIST,
|
|
75
|
+
"E_LIST": i.ELIST
|
|
76
|
+
}
|
|
77
|
+
return json
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def create(cls):
|
|
81
|
+
MidasAPI("PUT",cls.url,cls.json())
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def get(cls):
|
|
85
|
+
return MidasAPI("GET",cls.url)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def sync(cls):
|
|
90
|
+
a = cls.get()
|
|
91
|
+
if a != {'message': ''}:
|
|
92
|
+
if list(a['GRUP'].keys()) != []:
|
|
93
|
+
cls.Groups = []
|
|
94
|
+
cls.ids=[]
|
|
95
|
+
for j in a['GRUP'].keys():
|
|
96
|
+
nlist=[]
|
|
97
|
+
elist=[]
|
|
98
|
+
try: nlist = a['GRUP'][j]["N_LIST"]
|
|
99
|
+
except: pass
|
|
100
|
+
try: elist = a['GRUP'][j]["E_LIST"]
|
|
101
|
+
except: pass
|
|
102
|
+
|
|
103
|
+
Group.Structure(a['GRUP'][j]["NAME"],nlist,elist)
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def delete(cls):
|
|
107
|
+
cls.Groups=[]
|
|
108
|
+
cls.ids=[]
|
|
109
|
+
MidasAPI("DELETE",cls.url)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
#--------------------------------- BOUNDARY ---------------------------------------
|
|
114
|
+
|
|
115
|
+
class Boundary:
|
|
116
|
+
|
|
117
|
+
Groups = []
|
|
118
|
+
ids=[]
|
|
119
|
+
url= "/db/BNGR"
|
|
120
|
+
|
|
121
|
+
def __init__(self, name):
|
|
122
|
+
""""""
|
|
123
|
+
self.NAME = name
|
|
124
|
+
if Group.Boundary.Groups == []: self.ID=1
|
|
125
|
+
else: self.ID= max(Group.Boundary.ids)+1
|
|
126
|
+
Group.Boundary.ids.append(self.ID)
|
|
127
|
+
Group.Boundary.Groups.append(self)
|
|
128
|
+
|
|
129
|
+
# @classmethod
|
|
130
|
+
# def update(cls, name,operation = "r", nlist = [],elist = [] ):
|
|
131
|
+
# """Group name, element list, node list, operation ("add" or "replace").\n
|
|
132
|
+
# Sample: update_SG("Girder", [1,2,...20],[],"replace")"""
|
|
133
|
+
# up = 0
|
|
134
|
+
# for i in cls.Groups:
|
|
135
|
+
# if name == i.NAME:
|
|
136
|
+
# up = 1
|
|
137
|
+
# if operation == "r":
|
|
138
|
+
# i.ELIST = list(set(elist))
|
|
139
|
+
# i.NLIST = list(set(nlist))
|
|
140
|
+
# if operation == "a":
|
|
141
|
+
# i.ELIST = list(set(i.ELIST + elist))
|
|
142
|
+
# i.NLIST = list(set(i.NLIST + nlist))
|
|
143
|
+
# if up == 0: print(f"⚠️ Boundary group {name} is not defined!")
|
|
144
|
+
|
|
145
|
+
@classmethod
|
|
146
|
+
def json(cls):
|
|
147
|
+
"Generates the json file for all defined structure groups."
|
|
148
|
+
json = {"Assign":{}}
|
|
149
|
+
for i in cls.Groups:
|
|
150
|
+
json["Assign"][i.ID] = {
|
|
151
|
+
"NAME": i.NAME,
|
|
152
|
+
"AUTOTYPE": 0,
|
|
153
|
+
}
|
|
154
|
+
return json
|
|
155
|
+
|
|
156
|
+
@classmethod
|
|
157
|
+
def create(cls):
|
|
158
|
+
MidasAPI("PUT",cls.url,cls.json())
|
|
159
|
+
|
|
160
|
+
@classmethod
|
|
161
|
+
def get(cls):
|
|
162
|
+
return MidasAPI("GET",cls.url)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@classmethod
|
|
166
|
+
def sync(cls):
|
|
167
|
+
a = cls.get()
|
|
168
|
+
if a != {'message': ''}:
|
|
169
|
+
if list(a['BNGR'].keys()) != []:
|
|
170
|
+
cls.Groups = []
|
|
171
|
+
cls.ids=[]
|
|
172
|
+
for j in a['BNGR'].keys():
|
|
173
|
+
Group.Boundary(a['BNGR'][j]["NAME"])
|
|
174
|
+
|
|
175
|
+
@classmethod
|
|
176
|
+
def delete(cls):
|
|
177
|
+
cls.Groups=[]
|
|
178
|
+
cls.ids=[]
|
|
179
|
+
MidasAPI("DELETE",cls.url)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# -------------------------------- LOAD -------------------------------
|
|
183
|
+
|
|
184
|
+
class Load:
|
|
185
|
+
|
|
186
|
+
Groups = []
|
|
187
|
+
ids=[]
|
|
188
|
+
url= "/db/LDGR"
|
|
189
|
+
|
|
190
|
+
def __init__(self, name):
|
|
191
|
+
""""""
|
|
192
|
+
self.NAME = name
|
|
193
|
+
if Group.Load.Groups == []: self.ID=1
|
|
194
|
+
else: self.ID= max(Group.Load.ids)+1
|
|
195
|
+
Group.Load.ids.append(self.ID)
|
|
196
|
+
Group.Load.Groups.append(self)
|
|
197
|
+
|
|
198
|
+
# @classmethod
|
|
199
|
+
# def update(cls, name,operation = "r", nlist = [],elist = [] ):
|
|
200
|
+
# """Group name, element list, node list, operation ("add" or "replace").\n
|
|
201
|
+
# Sample: update_SG("Girder", [1,2,...20],[],"replace")"""
|
|
202
|
+
# up = 0
|
|
203
|
+
# for i in cls.Groups:
|
|
204
|
+
# if name == i.NAME:
|
|
205
|
+
# up = 1
|
|
206
|
+
# if operation == "r":
|
|
207
|
+
# i.ELIST = list(set(elist))
|
|
208
|
+
# i.NLIST = list(set(nlist))
|
|
209
|
+
# if operation == "a":
|
|
210
|
+
# i.ELIST = list(set(i.ELIST + elist))
|
|
211
|
+
# i.NLIST = list(set(i.NLIST + nlist))
|
|
212
|
+
# if up == 0: print(f"⚠️ Boundary group {name} is not defined!")
|
|
213
|
+
|
|
214
|
+
@classmethod
|
|
215
|
+
def json(cls):
|
|
216
|
+
"Generates the json file for all defined structure groups."
|
|
217
|
+
json = {"Assign":{}}
|
|
218
|
+
for i in cls.Groups:
|
|
219
|
+
json["Assign"][i.ID] = {
|
|
220
|
+
"NAME": i.NAME
|
|
221
|
+
}
|
|
222
|
+
return json
|
|
223
|
+
|
|
224
|
+
@classmethod
|
|
225
|
+
def create(cls):
|
|
226
|
+
MidasAPI("PUT",cls.url,cls.json())
|
|
227
|
+
|
|
228
|
+
@classmethod
|
|
229
|
+
def get(cls):
|
|
230
|
+
return MidasAPI("GET",cls.url)
|
|
231
|
+
|
|
232
|
+
@classmethod
|
|
233
|
+
def sync(cls):
|
|
234
|
+
a = cls.get()
|
|
235
|
+
if a != {'message': ''}:
|
|
236
|
+
if list(a['LDGR'].keys()) != []:
|
|
237
|
+
cls.Groups = []
|
|
238
|
+
cls.ids=[]
|
|
239
|
+
for j in a['LDGR'].keys():
|
|
240
|
+
Group.Load(a['LDGR'][j]["NAME"])
|
|
241
|
+
|
|
242
|
+
@classmethod
|
|
243
|
+
def delete(cls):
|
|
244
|
+
cls.Groups=[]
|
|
245
|
+
cls.ids=[]
|
|
246
|
+
MidasAPI("DELETE",cls.url)
|
|
247
|
+
|
|
248
|
+
# ------------------------ TENDON ----------
|
|
249
|
+
|
|
250
|
+
class Tendon:
|
|
251
|
+
|
|
252
|
+
Groups = []
|
|
253
|
+
ids=[]
|
|
254
|
+
url= "/db/TDGR"
|
|
255
|
+
|
|
256
|
+
def __init__(self, name):
|
|
257
|
+
""""""
|
|
258
|
+
self.NAME = name
|
|
259
|
+
if Group.Tendon.Groups == []: self.ID=1
|
|
260
|
+
else: self.ID= max(Group.Tendon.ids)+1
|
|
261
|
+
Group.Tendon.ids.append(self.ID)
|
|
262
|
+
Group.Tendon.Groups.append(self)
|
|
263
|
+
|
|
264
|
+
# @classmethod
|
|
265
|
+
# def update(cls, name,operation = "r", nlist = [],elist = [] ):
|
|
266
|
+
# """Group name, element list, node list, operation ("add" or "replace").\n
|
|
267
|
+
# Sample: update_SG("Girder", [1,2,...20],[],"replace")"""
|
|
268
|
+
# up = 0
|
|
269
|
+
# for i in cls.Groups:
|
|
270
|
+
# if name == i.NAME:
|
|
271
|
+
# up = 1
|
|
272
|
+
# if operation == "r":
|
|
273
|
+
# i.ELIST = list(set(elist))
|
|
274
|
+
# i.NLIST = list(set(nlist))
|
|
275
|
+
# if operation == "a":
|
|
276
|
+
# i.ELIST = list(set(i.ELIST + elist))
|
|
277
|
+
# i.NLIST = list(set(i.NLIST + nlist))
|
|
278
|
+
# if up == 0: print(f"⚠️ Boundary group {name} is not defined!")
|
|
279
|
+
|
|
280
|
+
@classmethod
|
|
281
|
+
def json(cls):
|
|
282
|
+
"Generates the json file for all defined structure groups."
|
|
283
|
+
json = {"Assign":{}}
|
|
284
|
+
for i in cls.Groups:
|
|
285
|
+
json["Assign"][i.ID] = {
|
|
286
|
+
"NAME": i.NAME
|
|
287
|
+
}
|
|
288
|
+
return json
|
|
289
|
+
|
|
290
|
+
@classmethod
|
|
291
|
+
def create(cls):
|
|
292
|
+
MidasAPI("PUT",cls.url,cls.json())
|
|
293
|
+
|
|
294
|
+
@classmethod
|
|
295
|
+
def get(cls):
|
|
296
|
+
return MidasAPI("GET",cls.url)
|
|
297
|
+
|
|
298
|
+
@classmethod
|
|
299
|
+
def sync(cls):
|
|
300
|
+
a = cls.get()
|
|
301
|
+
if a != {'message': ''}:
|
|
302
|
+
if list(a['TDGR'].keys()) != []:
|
|
303
|
+
cls.Groups = []
|
|
304
|
+
cls.ids=[]
|
|
305
|
+
for j in a['TDGR'].keys():
|
|
306
|
+
Group.Tendon(a['TDGR'][j]["NAME"])
|
|
307
|
+
|
|
308
|
+
@classmethod
|
|
309
|
+
def delete(cls):
|
|
310
|
+
cls.Groups=[]
|
|
311
|
+
cls.ids=[]
|
|
312
|
+
MidasAPI("DELETE",cls.url)
|