midas-civil 1.4.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.
Files changed (40) hide show
  1. midas_civil/_BoundaryChangeAssignment.py +278 -0
  2. midas_civil/__init__.py +51 -0
  3. midas_civil/_analysiscontrol.py +585 -0
  4. midas_civil/_boundary.py +888 -0
  5. midas_civil/_construction.py +1004 -0
  6. midas_civil/_element.py +1346 -0
  7. midas_civil/_group.py +337 -0
  8. midas_civil/_load.py +967 -0
  9. midas_civil/_loadcomb.py +159 -0
  10. midas_civil/_mapi.py +249 -0
  11. midas_civil/_material.py +1692 -0
  12. midas_civil/_model.py +522 -0
  13. midas_civil/_movingload.py +1479 -0
  14. midas_civil/_node.py +532 -0
  15. midas_civil/_result_table.py +929 -0
  16. midas_civil/_result_test.py +5455 -0
  17. midas_civil/_section/_TapdbSecSS.py +175 -0
  18. midas_civil/_section/__init__.py +413 -0
  19. midas_civil/_section/_compositeSS.py +283 -0
  20. midas_civil/_section/_dbSecSS.py +164 -0
  21. midas_civil/_section/_offsetSS.py +53 -0
  22. midas_civil/_section/_pscSS copy.py +455 -0
  23. midas_civil/_section/_pscSS.py +822 -0
  24. midas_civil/_section/_tapPSC12CellSS.py +565 -0
  25. midas_civil/_section/_unSupp.py +58 -0
  26. midas_civil/_settlement.py +161 -0
  27. midas_civil/_temperature.py +677 -0
  28. midas_civil/_tendon.py +1016 -0
  29. midas_civil/_thickness.py +147 -0
  30. midas_civil/_utils.py +529 -0
  31. midas_civil/_utilsFunc/__init__.py +0 -0
  32. midas_civil/_utilsFunc/_line2plate.py +636 -0
  33. midas_civil/_view.py +891 -0
  34. midas_civil/_view_trial.py +430 -0
  35. midas_civil/_visualise.py +347 -0
  36. midas_civil-1.4.1.dist-info/METADATA +74 -0
  37. midas_civil-1.4.1.dist-info/RECORD +40 -0
  38. midas_civil-1.4.1.dist-info/WHEEL +5 -0
  39. midas_civil-1.4.1.dist-info/licenses/LICENSE +21 -0
  40. midas_civil-1.4.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,430 @@
1
+ from ._mapi import MidasAPI
2
+ # from ._model import *
3
+ # import base64
4
+ from base64 import b64decode
5
+
6
+ class View:
7
+ '''
8
+ Contains option for Viewport display
9
+
10
+ **Hidden** - View.Hidden
11
+ **Active** - View.Active
12
+ **Angle** - View.Angle
13
+ '''
14
+
15
+ Hidden:bool = False
16
+ '''Toggle Hidden mode ie. 3D section display or line'''
17
+
18
+ class __ActiveMeta__(type):
19
+ @property
20
+ def mode(cls) :
21
+ ''' Mode - > "All" , "Active" , "Identity" '''
22
+ return cls.__mode__
23
+
24
+ @mode.setter
25
+ def mode(cls, value):
26
+ cls.__mode__ = value
27
+ cls.__default__ = False
28
+
29
+ class Active(metaclass = __ActiveMeta__ ):
30
+
31
+ '''Sets Elements to be Active for View.Capture() or View.CaptureResults()
32
+
33
+ **Mode** - "All" , "Active" , "Identity"
34
+ **Node_List** - Node to be active when Mode is "Active"
35
+ **Elem_List** - Element to be active when Mode is "Active"
36
+ **Identity_Type** - "Group" , "Boundary Group" , "Load Group" , "Named Plane"
37
+ **Identity_List** - String list of all the idenity items
38
+ '''
39
+ __mode__ = "All"
40
+ __default__ = True
41
+ node_list = []
42
+ elem_list = []
43
+ ident_type = "Group"
44
+ ident_list = []
45
+
46
+ def __init__(self,mode:str='All',node_list:list=[],elem_list:list=[],ident_type='Group',ident_list:list=[]):
47
+ '''Sets Elements to be Active for View.Capture() or View.CaptureResults()
48
+
49
+ **Mode** - "All" , "Active" , "Identity"
50
+ **Node_List** - Nodes to be active when Mode is "Active"
51
+ **Elem_List** - Elements to be active when Mode is "Active"
52
+ **Identity_Type** - "Group" , "Boundary Group" , "Load Group" , "Named Plane"
53
+ **Identity_List** - String list of all the idenity items
54
+ '''
55
+ View.Active.mode = mode
56
+ View.Active.node_list = node_list
57
+ View.Active.elem_list = elem_list
58
+ View.Active.ident_type = ident_type
59
+ View.Active.ident_list = ident_list
60
+
61
+
62
+
63
+
64
+ @classmethod
65
+ def _json(cls):
66
+ if cls.__default__: json_body = {}
67
+ else:
68
+ json_body = {
69
+ "ACTIVE_MODE": cls.__mode__
70
+ }
71
+
72
+ if cls.mode == "Active" :
73
+ json_body["N_LIST"] = cls.node_list
74
+ json_body["E_LIST"] = cls.elem_list
75
+ elif cls.mode == "Identity" :
76
+ json_body["IDENTITY_TYPE"] = cls.ident_type
77
+ json_body["IDENTITY_LIST"] = cls.ident_list
78
+
79
+ return json_body
80
+
81
+
82
+ class __AngleMeta__(type):
83
+ @property
84
+ def Horizontal(cls):
85
+ return cls.__horizontal__
86
+
87
+ @Horizontal.setter
88
+ def Horizontal(cls, value):
89
+ cls.__horizontal__ = value
90
+ cls.__newH__ = True
91
+
92
+ @property
93
+ def Vertical(cls):
94
+ return cls.__vertical__
95
+
96
+ @Vertical.setter
97
+ def Vertical(cls, value):
98
+ cls.__vertical__ = value
99
+ cls.__newV__ = True
100
+
101
+ class Angle(metaclass = __AngleMeta__) :
102
+ '''
103
+ **Horizontal** - Horizontal angle of the Viewport
104
+ **Vertical** - Vertical angle of the Viewport
105
+ '''
106
+ __horizontal__ = 30
107
+ __vertical__ = 15
108
+ __newH__ = False
109
+ __newV__ = False
110
+
111
+ @classmethod
112
+ def _json(cls):
113
+
114
+ json_body = {}
115
+ if cls.__newH__ : json_body["HORIZONTAL"] = cls.__horizontal__
116
+ if cls.__newV__ : json_body["VERTICAL"] = cls.__vertical__
117
+
118
+ return json_body
119
+
120
+
121
+
122
+ class ResultGraphic:
123
+ '''
124
+ Contains Result Graphics type and options for Result Graphics display
125
+
126
+ **Contour** - ResultGraphic.Contour
127
+ **Legend** - ResultGraphic.Legend
128
+ **Values** - ResultGraphic.Values
129
+ **Deform** - ResultGraphic.Deform
130
+ **Results images** - ResultGraphic.BeamDiagram , ResultGraphic.DisplacementContour , ...
131
+ '''
132
+
133
+ class Contour:
134
+ '''
135
+ **use** - ( True or False ) Shows contour in the Result Image
136
+ **num_Color** (default - 12) - Number of colors in Contours 6, 12, 18, 24
137
+ **color** (default - "rgb") - Color Table - "vrgb" | "rgb" | "rbg" | "gray scaled"
138
+ '''
139
+ use = True
140
+ num_color = 12
141
+ color = "rgb"
142
+
143
+ @classmethod
144
+ def _json(cls):
145
+ json_body = {
146
+ "OPT_CHECK": cls.use,
147
+ "NUM_OF_COLOR": cls.num_color,
148
+ "COLOR_TYPE": cls.color
149
+ }
150
+ return json_body
151
+
152
+ class Legend:
153
+ '''
154
+ **use** - ( True or False ) Shows Legend in the Result Image
155
+ **position** - Position of Legend - "left" | "right"
156
+ **bExponent** - True -> Shows exponential values in legend | False -> Shows fixed values in legend
157
+ **num_decimal** - Number of decimal values shown in legend
158
+ '''
159
+ use = True
160
+ position = "right"
161
+ bExponent = False
162
+ num_decimal = 2
163
+
164
+ @classmethod
165
+ def _json(cls):
166
+ json_body = {
167
+ "OPT_CHECK":cls.use,
168
+ "POSITION": cls.position,
169
+ "VALUE_EXP":cls.bExponent,
170
+ "DECIMAL_PT": cls.num_decimal
171
+ }
172
+ return json_body
173
+
174
+ class Values:
175
+ '''
176
+ **use** - ( True or False ) Shows result Values in the Result Image
177
+ **orient_angle** - Orientation angle of Values (0,15,30,45,60,75,90)
178
+ **bExpo** - True -> Shows exponential values in viewport | False -> Shows fixed values in viewport
179
+ **num_decimal** - Number of decimal values shown in viewport
180
+ '''
181
+ use = False
182
+ bExpo = False
183
+ num_decimal = 2
184
+ orient_angle = 0
185
+
186
+ @classmethod
187
+ def _json(cls):
188
+ json_body = {
189
+ "OPT_CHECK":cls.use,
190
+ "VALUE_EXP": cls.bExpo,
191
+ "DECIMAL_PT":cls.num_decimal,
192
+ "SET_ORIENT": cls.orient_angle,
193
+ }
194
+ return json_body
195
+
196
+ class Deform:
197
+ '''
198
+ **use** - ( True or False ) Shows Deformation in the Result Image
199
+ **scale** - Deformation scale factor
200
+ **bRealDeform** - False -> Shows Nodal Deform | True -> Shows Real Deform
201
+ **bRealDisp** - Shows real displacement (Auto-Scale Off)
202
+ **bRelativeDisp** - The structure's deformation is shown graphically in relation to a minimum nodal displacement set at 0
203
+ '''
204
+ use = False
205
+ scale = 1.0
206
+ bRealDeform = False
207
+ bRealDisp = False
208
+ bRelativeDisp = False
209
+
210
+ @classmethod
211
+ def _json(cls):
212
+ json_body = {
213
+ "OPT_CHECK":cls.use,
214
+ "SCALE_FACTOR": cls.scale,
215
+ "REL_DISP":cls.bRelativeDisp,
216
+ "REAL_DISP": cls.bRealDisp,
217
+ "REAL_DEFORM": cls.bRealDeform
218
+ }
219
+ return json_body
220
+
221
+ @staticmethod
222
+ def BeamDiagram(lcase_type:str, lcase_name:str, lcase_minmax:str="Max",
223
+ part:str="total", component:str="My",
224
+ fidelity:str="Exact", fill:str="Solid", scale:float=1.0) -> dict:
225
+ '''
226
+ Generates JSON for Beam Diagrams Result Graphic.
227
+
228
+ Args:
229
+ lcase_type (str): Load Case Type ("ST", "CS", "RS", "TH", "MV", "SM", "CB").
230
+ lcase_name (str): Load Case/Combination Name (e.g., "DL").
231
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
232
+ part (str): Component Part ("total", ...). Defaults to "total".
233
+ component (str): Component Name ("Fx", "Fy", "Fz", "Mx", "My", "Mz"). Defaults to "My".
234
+ fidelity (str): Fidelity of the diagram ("Exact", "5 Points", ...). Defaults to "Exact".
235
+ fill (str): Fill of Diagram ("No", "Line", "Solid"). Defaults to "Solid".
236
+ scale (float): Scale of Diagram. Defaults to 1.0.
237
+
238
+ '''
239
+ json_body = {
240
+ "CURRENT_MODE":"BeamDiagrams",
241
+ "LOAD_CASE_COMB":{
242
+ "TYPE":lcase_type,
243
+ "NAME":lcase_name,
244
+ "MINMAX" : lcase_minmax,
245
+ "STEP_INDEX": 1,
246
+ "OPT_MAXMIN_DIAGRAM": False
247
+ },
248
+ "COMPONENTS":{
249
+ "PART":part,
250
+ "COMP":component,
251
+ "OPT_SHOW_TRUSS_FORCES": True,
252
+ "OPT_ONLY_TRUSS_FORCES": False
253
+ },
254
+ "DISPLAY_OPTIONS":{
255
+ "FIDELITY": fidelity,
256
+ "FILL": fill,
257
+ "SCALE": scale
258
+ },
259
+ "TYPE_OF_DISPLAY":{
260
+ "CONTOUR": ResultGraphic.Contour._json(),
261
+ "DEFORM":ResultGraphic.Deform._json(),
262
+ "LEGEND":ResultGraphic.Legend._json(),
263
+ "VALUES": ResultGraphic.Values._json(),
264
+ "UNDEFORMED": { "OPT_CHECK": False },
265
+ "MIRRORED": { "OPT_CHECK": False },
266
+ "OPT_CUR_STEP_FORCE": False
267
+ },
268
+ "OUTPUT_SECT_LOCATION": {
269
+ "OPT_MAX_MINMAX_ALL": "absmax"
270
+ }
271
+ }
272
+ return json_body
273
+
274
+ @staticmethod
275
+ def DisplacementContour(lcase_type:str,lcase_name:str,lcase_minmax:str="max",component:str='DXYZ') -> dict:
276
+
277
+ json_body = {
278
+ "CURRENT_MODE":"DisplacementContour",
279
+ "LOAD_CASE_COMB":{
280
+ "TYPE":lcase_type,
281
+ "NAME":lcase_name,
282
+ "MINMAX" : lcase_minmax
283
+ },
284
+ "COMPONENTS":{
285
+ "COMP":component,
286
+ "OPT_LOCAL_CHECK" : False
287
+ },
288
+ "TYPE_OF_DISPLAY":{
289
+ "CONTOUR": ResultGraphic.Contour._json(),
290
+ "DEFORM":ResultGraphic.Deform._json(),
291
+ "LEGEND":ResultGraphic.Legend._json(),
292
+ "VALUES":{
293
+ "OPT_CHECK":False
294
+ }
295
+ }
296
+ }
297
+
298
+ return json_body
299
+
300
+ @staticmethod
301
+ def Reaction(lcase_type:str,lcase_name:str,lcase_minmax:str="max",component:str='FXYZ') -> dict:
302
+
303
+ json_body = {
304
+ "CURRENT_MODE":"ReactionForces/Moments",
305
+ "LOAD_CASE_COMB":{
306
+ "TYPE":lcase_type,
307
+ "NAME":lcase_name,
308
+ "MINMAX" : lcase_minmax
309
+ },
310
+ "COMPONENTS":{
311
+ "COMP":component,
312
+ "OPT_LOCAL_CHECK" : False
313
+ },
314
+ "TYPE_OF_DISPLAY":{
315
+ "CONTOUR": ResultGraphic.Contour._json(),
316
+ "DEFORM":ResultGraphic.Deform._json(),
317
+ "LEGEND":ResultGraphic.Legend._json(),
318
+ "VALUES":{
319
+ "OPT_CHECK":False
320
+ }
321
+ }
322
+ }
323
+
324
+ return json_body
325
+
326
+ @staticmethod
327
+ def DeformedShap(lcase_type:str,lcase_name:str,lcase_minmax:str="max",component:str='FXYZ') -> dict:
328
+
329
+ json_body = {
330
+ "CURRENT_MODE":"DeformedShap",
331
+ "LOAD_CASE_COMB":{
332
+ "TYPE":lcase_type,
333
+ "NAME":lcase_name,
334
+ "MINMAX" : lcase_minmax
335
+ },
336
+ "COMPONENTS":{
337
+ "COMP":component,
338
+ "OPT_LOCAL_CHECK" : False
339
+ },
340
+ "TYPE_OF_DISPLAY":{
341
+ "CONTOUR": ResultGraphic.Contour._json(),
342
+ "DEFORM":ResultGraphic.Deform._json(),
343
+ "LEGEND":ResultGraphic.Legend._json(),
344
+ "VALUES":{
345
+ "OPT_CHECK":False
346
+ }
347
+ }
348
+ }
349
+
350
+ return json_body
351
+
352
+ def _saveImg_(location,resp):
353
+ bs64_img = resp["base64String"]
354
+ decode = open(location, 'wb') # Open image file to save.
355
+ decode.write(b64decode(bs64_img)) # Decode and write data.
356
+ decode.close()
357
+
358
+ class Image:
359
+
360
+
361
+
362
+ @staticmethod
363
+ def Capture(location:str="",img_w:int = 1280 , img_h:int = 720,view:str='pre',CS_StageName:str='') -> None:
364
+ '''
365
+ Capture the image in the viewport and saves at shown location
366
+ Location - image location
367
+ Image height and width
368
+ View - 'pre' or 'post'
369
+ stage - CS name
370
+ '''
371
+ json_body = {
372
+ "Argument": {
373
+ "SET_MODE":"pre",
374
+ "SET_HIDDEN":View.Hidden,
375
+ "HEIGHT": img_h,
376
+ "WIDTH": img_w
377
+ }
378
+ }
379
+
380
+ if View.Angle.__newH__ == True or View.Angle.__newV__ == True:
381
+ json_body['Argument']['ANGLE'] = View.Angle._json()
382
+
383
+ if View.Active.__default__ ==False:
384
+ json_body['Argument']['ACTIVE'] = View.Active._json()
385
+
386
+ if view=='post':
387
+ json_body['Argument']['SET_MODE'] = 'post'
388
+ elif view=='pre':
389
+ json_body['Argument']['SET_MODE'] = 'pre'
390
+
391
+ if CS_StageName != '':
392
+ json_body['Argument']['STAGE_NAME'] = CS_StageName
393
+
394
+ resp = MidasAPI('POST','/view/CAPTURE',json_body)
395
+ if location:
396
+ _saveImg_(location,resp)
397
+ return resp
398
+
399
+ @staticmethod
400
+ def CaptureResults(ResultGraphic:ResultGraphic,location:str,img_w:int = 1280 , img_h:int = 720,CS_StageName:str=''):
401
+ '''
402
+ Capture Result Graphic in CIVIL NX
403
+ Result Graphic - ResultGraphic JSON (ResultGraphic.BeamDiagram())
404
+ Location - image location
405
+ Image height and width
406
+ Construction stage Name (default = "") if desired
407
+ '''
408
+ json_body = {
409
+ "Argument":{
410
+ "SET_MODE":"post",
411
+ "SET_HIDDEN":View.Hidden,
412
+ "HEIGHT":img_h,
413
+ "WIDTH":img_w,
414
+ "RESULT_GRAPHIC": ResultGraphic
415
+ }
416
+ }
417
+ if View.Angle.__newH__ == True or View.Angle.__newV__ == True:
418
+ json_body['Argument']['ANGLE'] = View.Angle._json()
419
+
420
+ if View.Active.__default__ ==False:
421
+ json_body['Argument']['ACTIVE'] = View.Active._json()
422
+
423
+ if CS_StageName != '':
424
+ json_body['Argument']['STAGE_NAME'] = CS_StageName
425
+
426
+ resp = MidasAPI('POST','/view/CAPTURE',json_body)
427
+
428
+ if location:
429
+ _saveImg_(location,resp)
430
+ return resp