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.

@@ -0,0 +1,393 @@
1
+ from ._mapi import *
2
+
3
+
4
+
5
+
6
+ class Material:
7
+ mats = []
8
+ ids = []
9
+ def __init__(self,data,id=0):
10
+ if Material.ids == []:
11
+ count = 1
12
+ else:
13
+ count = max(Material.ids)+1
14
+ if id == 0 or id in Material.ids: self.ID = count
15
+ if id!= 0 and id not in Material.ids: self.ID = id
16
+
17
+ self.DATA = data
18
+
19
+ Material.mats.append(self)
20
+ Material.ids.append(self.ID)
21
+
22
+ @classmethod
23
+ def json(cls):
24
+ json = {"Assign":{}}
25
+ for k in cls.mats:
26
+ json["Assign"][k.ID]=k.DATA
27
+ return json
28
+
29
+ @staticmethod
30
+ def create_only():
31
+ MidasAPI("PUT","/db/MATL",Material.json())
32
+
33
+ @staticmethod
34
+ def get():
35
+ return MidasAPI("GET","/db/MATL")
36
+
37
+
38
+ @staticmethod
39
+ def delete():
40
+ MidasAPI("DELETE","/db/MATL")
41
+ Material.mats=[]
42
+ Material.ids=[]
43
+
44
+ @staticmethod
45
+ def sync():
46
+ a = Material.get()
47
+ if a != {'message': ''}:
48
+ if list(a['MATL'].keys()) != []:
49
+ Material.mats = []
50
+ Material.ids=[]
51
+ for j in a['MATL'].keys():
52
+ Material(a['MATL'][j], int(j))
53
+
54
+ # ---------------------------------- ALL FUNCTIONS ---------------------------------------------------
55
+
56
+ @staticmethod
57
+ def create():
58
+ if Material.mats!=[] : Material.create()
59
+ if CreepShrinkage.mats!=[] : CreepShrinkage.create()
60
+ if CompStrength.mats!=[] : CompStrength.create()
61
+ if TDLink.json()!={'Assign':{}} : TDLink.create()
62
+
63
+
64
+ @staticmethod
65
+ def deleteAll():
66
+ Material.delete()
67
+ CreepShrinkage.delete()
68
+ CompStrength.delete()
69
+
70
+
71
+
72
+ # --------------------------------- CONCRETE MATERIAL --------------------------------------------------------------
73
+
74
+ class CONC:
75
+
76
+
77
+ # ---------------------------------- DB MATERIAL ---------------------------------------------------
78
+
79
+ def __init__(self,name='',standard='',db='',id:int=0,):
80
+ js = {
81
+ "TYPE": "CONC",
82
+ "NAME": name,
83
+ "DAMP_RAT": 0.05,
84
+ "PARAM": [
85
+ {
86
+ "P_TYPE": 1,
87
+ "STANDARD": standard,
88
+ "CODE": "",
89
+ "DB": db,
90
+ }
91
+ ]
92
+ }
93
+ temp = Material(js,id)
94
+ self.ID = temp.ID
95
+ self.DATA = js
96
+
97
+
98
+ # ---------------------------------- USER MATERIAL ---------------------------------------------------
99
+
100
+ class User:
101
+ def __init__(self,name='',E=0,pois=0,den=0,mass=0,therm=0,id:int=0,):
102
+ js = {
103
+ "TYPE": "CONC",
104
+ "NAME": name,
105
+ "DAMP_RAT": 0.05,
106
+ "PARAM": [
107
+ {
108
+ "P_TYPE": 2,
109
+ "ELAST": E,
110
+ "POISN": pois,
111
+ "THERMAL": therm,
112
+ "DEN": den,
113
+ "MASS": mass
114
+ }
115
+ ]
116
+ }
117
+ temp = Material(js,id)
118
+ self.ID = temp.ID
119
+ self.DATA = js
120
+
121
+
122
+
123
+ # --------------------------------- STEEL MATERIAL --------------------------------------------------------------
124
+
125
+ class STEEL:
126
+
127
+ # ---------------------------------- DB MATERIAL ---------------------------------------------------
128
+
129
+ def __init__(self,name='',standard='',db='',id:int=0,):
130
+ js = {
131
+ "TYPE": "STEEL",
132
+ "NAME": name,
133
+ "DAMP_RAT": 0.05,
134
+ "PARAM": [
135
+ {
136
+ "P_TYPE": 1,
137
+ "STANDARD": standard,
138
+ "CODE": "",
139
+ "DB": db,
140
+ }
141
+ ]
142
+ }
143
+ temp = Material(js,id)
144
+ self.ID = temp.ID
145
+ self.DATA = js
146
+
147
+
148
+ # ---------------------------------- USER MATERIAL ---------------------------------------------------
149
+
150
+ class User:
151
+ def __init__(self,name='',E=0,pois=0,den=0,mass=0,therm=0,id:int=0,):
152
+ js = {
153
+ "TYPE": "STEEL",
154
+ "NAME": name,
155
+ "DAMP_RAT": 0.05,
156
+ "PARAM": [
157
+ {
158
+ "P_TYPE": 2,
159
+ "ELAST": E,
160
+ "POISN": pois,
161
+ "THERMAL": therm,
162
+ "DEN": den,
163
+ "MASS": mass
164
+ }
165
+ ]
166
+ }
167
+ temp = Material(js,id)
168
+ self.ID = temp.ID
169
+ self.DATA = js
170
+
171
+
172
+
173
+
174
+ # --------------------------------- USER MATERIAL --------------------------------------------------------------
175
+
176
+ class USER:
177
+
178
+ def __init__(self,name='',E=0,pois=0,den=0,mass=0,therm=0,id:int=0,):
179
+ js = {
180
+ "TYPE": "USER",
181
+ "NAME": name,
182
+ "DAMP_RAT": 0.05,
183
+ "PARAM": [
184
+ {
185
+ "P_TYPE": 2,
186
+ "ELAST": E,
187
+ "POISN": pois,
188
+ "THERMAL": therm,
189
+ "DEN": den,
190
+ "MASS": mass
191
+ }
192
+ ]
193
+ }
194
+ temp = Material(js,id)
195
+ self.ID = temp.ID
196
+ self.DATA = js
197
+
198
+
199
+
200
+
201
+ #------------------------------------------ TIME DEPENDENT - CREEP and SHRINKAGE ----------------------------------------------------
202
+
203
+
204
+
205
+ class CreepShrinkage:
206
+ mats = []
207
+ ids = []
208
+ def __init__(self,data,id=0):
209
+ if CreepShrinkage.ids == []:
210
+ count = 1
211
+ else:
212
+ count = max(CreepShrinkage.ids)+1
213
+ if id == 0 or id in CreepShrinkage.ids: self.ID = count
214
+ if id!= 0 and id not in CreepShrinkage.ids: self.ID = id
215
+
216
+ self.DATA = data
217
+
218
+ CreepShrinkage.mats.append(self)
219
+ CreepShrinkage.ids.append(self.ID)
220
+
221
+ @classmethod
222
+ def json(cls):
223
+ json = {"Assign":{}}
224
+ for k in cls.mats:
225
+ json["Assign"][k.ID]=k.DATA
226
+ return json
227
+
228
+ @staticmethod
229
+ def create():
230
+ MidasAPI("PUT","/db/TDMT",CreepShrinkage.json())
231
+
232
+ @staticmethod
233
+ def get():
234
+ return MidasAPI("GET","/db/TDMT")
235
+
236
+
237
+ @staticmethod
238
+ def delete():
239
+ MidasAPI("DELETE","/db/TDMT")
240
+ CreepShrinkage.mats=[]
241
+ CreepShrinkage.ids=[]
242
+
243
+ @staticmethod
244
+ def sync():
245
+ a = CreepShrinkage.get()
246
+ if a != {'message': ''}:
247
+ if list(a['TDMT'].keys()) != []:
248
+ CreepShrinkage.mats = []
249
+ CreepShrinkage.ids=[]
250
+ for j in a['TDMT'].keys():
251
+ CreepShrinkage(a['TDMT'][j], int(j))
252
+
253
+
254
+
255
+ # --------------------------------- IRC CnS --------------------------------------------------------------
256
+
257
+ class IRC:
258
+
259
+ def __init__(self,name='',code="INDIA_IRC_112_2011",fck=0,notionalSize=1,relHumidity=70,ageShrinkage=3,typeCement='NR',id:int=0,):
260
+ js = {
261
+ "NAME": name,
262
+ "CODE": code,
263
+ "STR": fck,
264
+ "HU": relHumidity,
265
+ "AGE": ageShrinkage,
266
+ "MSIZE": notionalSize,
267
+ "CTYPE": typeCement
268
+ }
269
+ temp = CreepShrinkage(js,id)
270
+ self.ID = temp.ID
271
+ self.DATA = js
272
+
273
+
274
+
275
+
276
+
277
+ #------------------------------------------ TIME DEPENDENT - COMPRESSIVE STRENGTH ----------------------------------------------------
278
+
279
+
280
+
281
+ class CompStrength:
282
+ mats = []
283
+ ids = []
284
+ def __init__(self,data,id=0):
285
+ if CompStrength.ids == []:
286
+ count = 1
287
+ else:
288
+ count = max(CompStrength.ids)+1
289
+ if id == 0 or id in CompStrength.ids: self.ID = count
290
+ if id!= 0 and id not in CompStrength.ids: self.ID = id
291
+
292
+ self.DATA = data
293
+
294
+ CompStrength.mats.append(self)
295
+ CompStrength.ids.append(self.ID)
296
+
297
+ @classmethod
298
+ def json(cls):
299
+ json = {"Assign":{}}
300
+ for k in cls.mats:
301
+ json["Assign"][k.ID]=k.DATA
302
+ return json
303
+
304
+ @staticmethod
305
+ def create():
306
+ MidasAPI("PUT","/db/TDME",CompStrength.json())
307
+
308
+ @staticmethod
309
+ def get():
310
+ return MidasAPI("GET","/db/TDME")
311
+
312
+
313
+ @staticmethod
314
+ def delete():
315
+ MidasAPI("DELETE","/db/TDME")
316
+ CompStrength.mats=[]
317
+ CompStrength.ids=[]
318
+
319
+ @staticmethod
320
+ def sync():
321
+ a = CompStrength.get()
322
+ if a != {'message': ''}:
323
+ if list(a['TDME'].keys()) != []:
324
+ CompStrength.mats = []
325
+ CompStrength.ids=[]
326
+ for j in a['TDME'].keys():
327
+ CompStrength(a['TDME'][j], int(j))
328
+
329
+
330
+
331
+ # --------------------------------- IRC Compressive Strength --------------------------------------------------------------
332
+
333
+ class IRC:
334
+
335
+ def __init__(self,name,code="INDIA(IRC:112-2020)",fckDelta=0,typeCement=1,typeAggregate=0,id:int=0,):
336
+ js = {
337
+ "NAME": name,
338
+ "TYPE": "CODE",
339
+ "CODENAME": code,
340
+ "STRENGTH": fckDelta,
341
+ "iCTYPE": typeCement,
342
+ "nAGGRE": typeAggregate
343
+ }
344
+ temp = CompStrength(js,id)
345
+ self.ID = temp.ID
346
+ self.DATA = js
347
+
348
+
349
+
350
+
351
+
352
+ #------------------------------------------ TIME DEPENDENT - MATERIAL LINK ----------------------------------------------------
353
+
354
+
355
+
356
+ class TDLink:
357
+ mats = {}
358
+ def __init__(self,matID,CnSName='',CompName=''):
359
+
360
+ TDLink.mats[str(matID)]={
361
+ "TDMT_NAME": CnSName,
362
+ "TDME_NAME": CompName
363
+ }
364
+
365
+ @classmethod
366
+ def json(cls):
367
+ json = {"Assign": TDLink.mats}
368
+ return json
369
+
370
+ @staticmethod
371
+ def create():
372
+ MidasAPI("PUT","/db/TMAT",TDLink.json())
373
+
374
+ @staticmethod
375
+ def get():
376
+ return MidasAPI("GET","/db/TMAT")
377
+
378
+
379
+ @staticmethod
380
+ def delete():
381
+ MidasAPI("DELETE","/db/TMAT")
382
+ TDLink.mats={}
383
+
384
+ @staticmethod
385
+ def sync():
386
+ a = TDLink.get()
387
+ if a != {'message': ''}:
388
+ if list(a['TMAT'].keys()) != []:
389
+ TDLink.mats = []
390
+ TDLink.ids=[]
391
+ for j in a['TMAT'].keys():
392
+ TDLink(a['TMAT'][j], int(j))
393
+