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
midas_civil/_view.py ADDED
@@ -0,0 +1,891 @@
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
+ def __new__(self,horizontal, vertical):
112
+ View.Angle.__horizontal__ = horizontal
113
+ View.Angle.__vertical__ = vertical
114
+
115
+ @classmethod
116
+ def _json(cls):
117
+
118
+ json_body = {}
119
+ if cls.__newH__ : json_body["HORIZONTAL"] = cls.__horizontal__
120
+ if cls.__newV__ : json_body["VERTICAL"] = cls.__vertical__
121
+
122
+ return json_body
123
+
124
+
125
+
126
+ class ResultGraphic:
127
+ '''
128
+ Contains Result Graphics type and options for Result Graphics display
129
+
130
+ **Contour** - ResultGraphic.Contour
131
+ **Legend** - ResultGraphic.Legend
132
+ **Values** - ResultGraphic.Values
133
+ **Deform** - ResultGraphic.Deform
134
+ **Results images** - ResultGraphic.BeamDiagram , ResultGraphic.DisplacementContour , ...
135
+ '''
136
+
137
+ class Contour:
138
+ '''
139
+ **use** - ( True or False ) Shows contour in the Result Image
140
+ **num_Color** (default - 12) - Number of colors in Contours 6, 12, 18, 24
141
+ **color** (default - "rgb") - Color Table - "vrgb" | "rgb" | "rbg" | "gray scaled"
142
+ '''
143
+ use = True
144
+ num_color = 12
145
+ color = "rgb"
146
+
147
+ @classmethod
148
+ def _json(cls):
149
+ json_body = {
150
+ "OPT_CHECK": cls.use,
151
+ "NUM_OF_COLOR": cls.num_color,
152
+ "COLOR_TYPE": cls.color
153
+ }
154
+ return json_body
155
+
156
+ class Legend:
157
+ '''
158
+ **use** - ( True or False ) Shows Legend in the Result Image
159
+ **position** - Position of Legend - "left" | "right"
160
+ **bExponent** - True -> Shows exponential values in legend | False -> Shows fixed values in legend
161
+ **num_decimal** - Number of decimal values shown in legend
162
+ '''
163
+ use = True
164
+ position = "right"
165
+ bExponent = False
166
+ num_decimal = 2
167
+
168
+ @classmethod
169
+ def _json(cls):
170
+ json_body = {
171
+ "OPT_CHECK":cls.use,
172
+ "POSITION": cls.position,
173
+ "VALUE_EXP":cls.bExponent,
174
+ "DECIMAL_PT": cls.num_decimal
175
+ }
176
+ return json_body
177
+
178
+ class Values:
179
+ '''
180
+ **use** - ( True or False ) Shows result Values in the Result Image
181
+ **orient_angle** - Orientation angle of Values (0,15,30,45,60,75,90)
182
+ **bExpo** - True -> Shows exponential values in viewport | False -> Shows fixed values in viewport
183
+ **num_decimal** - Number of decimal values shown in viewport
184
+ '''
185
+ use = False
186
+ bExpo = False
187
+ num_decimal = 2
188
+ orient_angle = 0
189
+
190
+ @classmethod
191
+ def _json(cls):
192
+ json_body = {
193
+ "OPT_CHECK":cls.use,
194
+ "VALUE_EXP": cls.bExpo,
195
+ "DECIMAL_PT":cls.num_decimal,
196
+ "SET_ORIENT": cls.orient_angle,
197
+ }
198
+ return json_body
199
+
200
+ class Deform:
201
+ '''
202
+ **use** - ( True or False ) Shows Deformation in the Result Image
203
+ **scale** - Deformation scale factor
204
+ **bRealDeform** - False -> Shows Nodal Deform | True -> Shows Real Deform
205
+ **bRealDisp** - Shows real displacement (Auto-Scale Off)
206
+ **bRelativeDisp** - The structure's deformation is shown graphically in relation to a minimum nodal displacement set at 0
207
+ '''
208
+ use = False
209
+ scale = 1.0
210
+ bRealDeform = False
211
+ bRealDisp = False
212
+ bRelativeDisp = False
213
+
214
+ @classmethod
215
+ def _json(cls):
216
+ json_body = {
217
+ "OPT_CHECK":cls.use,
218
+ "SCALE_FACTOR": cls.scale,
219
+ "REL_DISP":cls.bRelativeDisp,
220
+ "REAL_DISP": cls.bRealDisp,
221
+ "REAL_DEFORM": cls.bRealDeform
222
+ }
223
+ return json_body
224
+
225
+ @staticmethod
226
+ def BeamDiagram(lcase_type:str, lcase_name:str, lcase_minmax:str="Max",
227
+ part:str="total", component:str="My",
228
+ fidelity:str="Exact", fill:str="Solid", scale:float=1.0) -> dict:
229
+ '''
230
+ Generates JSON for Beam Diagrams Result Graphic.
231
+
232
+ Args:
233
+ lcase_type (str): Load Case Type ("ST", "CS", "RS", "TH", "MV", "SM", "CB").
234
+ lcase_name (str): Load Case/Combination Name (e.g., "DL").
235
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
236
+ part (str): Component Part ("total", ...). Defaults to "total".
237
+ component (str): Component Name ("Fx", "Fy", "Fz", "Mx", "My", "Mz"). Defaults to "My".
238
+ fidelity (str): Fidelity of the diagram ("Exact", "5 Points", ...). Defaults to "Exact".
239
+ fill (str): Fill of Diagram ("No", "Line", "Solid"). Defaults to "Solid".
240
+ scale (float): Scale of Diagram. Defaults to 1.0.
241
+
242
+ '''
243
+ json_body = {
244
+ "CURRENT_MODE":"BeamDiagrams",
245
+ "LOAD_CASE_COMB":{
246
+ "TYPE":lcase_type,
247
+ "NAME":lcase_name,
248
+ "MINMAX" : lcase_minmax,
249
+ "STEP_INDEX": 1,
250
+ "OPT_MAXMIN_DIAGRAM": False
251
+ },
252
+ "COMPONENTS":{
253
+ "PART":part,
254
+ "COMP":component,
255
+ "OPT_SHOW_TRUSS_FORCES": True,
256
+ "OPT_ONLY_TRUSS_FORCES": False
257
+ },
258
+ "DISPLAY_OPTIONS":{
259
+ "FIDELITY": fidelity,
260
+ "FILL": fill,
261
+ "SCALE": scale
262
+ },
263
+ "TYPE_OF_DISPLAY":{
264
+ "CONTOUR": ResultGraphic.Contour._json(),
265
+ "DEFORM":ResultGraphic.Deform._json(),
266
+ "LEGEND":ResultGraphic.Legend._json(),
267
+ "VALUES": ResultGraphic.Values._json(),
268
+ "UNDEFORMED": { "OPT_CHECK": False },
269
+ "MIRRORED": { "OPT_CHECK": False },
270
+ "OPT_CUR_STEP_FORCE": False
271
+ },
272
+ "OUTPUT_SECT_LOCATION": {
273
+ "OPT_MAX_MINMAX_ALL": "absmax"
274
+ }
275
+ }
276
+ return json_body
277
+
278
+ @staticmethod
279
+ def DisplacementContour(lcase_type:str, lcase_name:str, lcase_minmax:str="Max", component:str="DXYZ",
280
+ th_option:str="Displacement", opt_local_check:bool=False) -> dict:
281
+ '''
282
+ Generates JSON for Displacement Contour Result Graphic.
283
+
284
+ Args:
285
+ lcase_type (str): Load Case Type ("ST", "CS", "RS", "TH", "MV", "SM", "CB").
286
+ lcase_name (str): Load Case/Combination Name (e.g., "DL").
287
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
288
+ component (str): Component Name ("DX", "DY", "DZ", "DXY", "DYZ", "DXZ", "DXYZ", "RX", "RY", "RZ", "RW"). Defaults to "DXYZ".
289
+ th_option (str): Time History Function Type ("Displacement", "Velocity", "Acceleration"). Defaults to "Displacement".
290
+ opt_local_check (bool): Use Node Local Axis (True) or Global Coord System (False). Defaults to False.
291
+
292
+ '''
293
+ json_body = {
294
+ "CURRENT_MODE":"DisplacementContour",
295
+ "LOAD_CASE_COMB":{
296
+ "TYPE":lcase_type,
297
+ "NAME":lcase_name,
298
+ "MINMAX" : lcase_minmax,
299
+ "STEP_INDEX": 1,
300
+ "TH_OPTION": th_option
301
+ },
302
+ "COMPONENTS":{
303
+ "COMP":component,
304
+ "OPT_LOCAL_CHECK" : opt_local_check
305
+ },
306
+ "TYPE_OF_DISPLAY":{
307
+ "CONTOUR": ResultGraphic.Contour._json(),
308
+ "DEFORM":ResultGraphic.Deform._json(),
309
+ "LEGEND":ResultGraphic.Legend._json(),
310
+ "VALUES": ResultGraphic.Values._json(),
311
+ "UNDEFORMED": { "OPT_CHECK": False },
312
+ "MIRRORED": { "OPT_CHECK": False },
313
+ "CUTTING_DIAGRAM": { "OPT_CHECK": False },
314
+ "OPT_CUR_STEP_DISPLACEMENT": True,
315
+ "OPT_STAGE_STEP_REAL_DISPLACEMENT": True,
316
+ "OPT_INCLUDING_CAMBER_DISPLACEMENT": True
317
+ }
318
+ }
319
+
320
+ return json_body
321
+
322
+ @staticmethod
323
+ def ReactionForcesMoments(lcase_type:str, lcase_name:str, lcase_minmax:str="Max", component:str="FXYZ",
324
+ opt_local_check:bool=False, arrow_scale_factor:float=1.0) -> dict:
325
+ '''
326
+ Generates JSON for Reaction Forces/Moments Result Graphic.
327
+
328
+ Args:
329
+ lcase_type (str): Load Case Type ("ST", "CS", "RS", "TH", "MV", "SM", "CB").
330
+ lcase_name (str): Load Case/Combination Name (e.g., "DL").
331
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
332
+ component (str): Component Name ("FX", "FY", "FZ", "FXYZ", "MX", "MY", "MZ", "MXYZ", "Mb"). Defaults to "FXYZ".
333
+ opt_local_check (bool): Use Node Local Axis (True) or Global Coord System (False). Defaults to False.
334
+ arrow_scale_factor (float): Scale factor for reaction arrows. Defaults to 1.0.
335
+
336
+ '''
337
+ json_body = {
338
+ "CURRENT_MODE":"ReactionForces/Moments",
339
+ "LOAD_CASE_COMB":{
340
+ "TYPE":lcase_type,
341
+ "NAME":lcase_name,
342
+ "MINMAX" : lcase_minmax,
343
+ "STEP_INDEX": 1
344
+ },
345
+ "COMPONENTS":{
346
+ "COMP":component,
347
+ "OPT_LOCAL_CHECK" : opt_local_check
348
+ },
349
+ "TYPE_OF_DISPLAY":{
350
+ "LEGEND":ResultGraphic.Legend._json(),
351
+ "VALUES": ResultGraphic.Values._json(),
352
+ "ARROW_SCALE_FACTOR": arrow_scale_factor
353
+ }
354
+ }
355
+
356
+ return json_body
357
+
358
+ @staticmethod
359
+ def DeformedShape(lcase_type:str, lcase_name:str, lcase_minmax:str="Max", component:str="DZ",
360
+ th_option:str="Displacement", opt_local_check:bool=False) -> dict:
361
+ '''
362
+ Generates JSON for Deformed Shape Result Graphic.
363
+
364
+ Args:
365
+ lcase_type (str): Load Case Type ("ST", "CS", "RS", "TH", "MV", "SM", "CB").
366
+ lcase_name (str): Load Case/Combination Name (e.g., "DL").
367
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
368
+ component (str): Component Name ("DX", "DY", "DZ", "DXY", "DYZ", "DXZ", "DXYZ"). Defaults to "DZ".
369
+ th_option (str): Time History Function Type ("Displacement", "Velocity", "Acceleration"). Defaults to "Displacement".
370
+ opt_local_check (bool): Use Node Local Axis (True) or Global Coord System (False). Defaults to False.
371
+
372
+ '''
373
+ json_body = {
374
+ "CURRENT_MODE":"DeformedShape",
375
+ "LOAD_CASE_COMB":{
376
+ "TYPE":lcase_type,
377
+ "NAME":lcase_name,
378
+ "MINMAX" : lcase_minmax,
379
+ "STEP_INDEX": 1,
380
+ "TH_OPTION": th_option
381
+ },
382
+ "COMPONENTS":{
383
+ "COMP":component,
384
+ "OPT_LOCAL_CHECK" : opt_local_check
385
+ },
386
+ "TYPE_OF_DISPLAY":{
387
+ "DEFORM":ResultGraphic.Deform._json(),
388
+ "VALUES": ResultGraphic.Values._json(),
389
+ "LEGEND":ResultGraphic.Legend._json(),
390
+ "MIRRORED": { "OPT_CHECK": False },
391
+ "UNDEFORMED": { "OPT_CHECK": True },
392
+ "OPT_CUR_STEP_DISPLACEMENT": True,
393
+ "OPT_STAGE_STEP_REAL_DISPLACEMENT": True,
394
+ "OPT_INCLUDING_CAMBER_DISPLACEMENT": True
395
+ }
396
+ }
397
+
398
+ return json_body
399
+
400
+ @staticmethod
401
+ def BeamForcesMoments(lcase_type:str, lcase_name:str, lcase_minmax:str="Max",
402
+ part:str="total", component:str="Fx") -> dict:
403
+ '''
404
+ Generates JSON for Beam Forces/Moments Result Graphic.
405
+
406
+ Args:
407
+ lcase_type (str): Load Case Type ("ST", "CS", "RS", "TH", "MV", "SM", "CB").
408
+ lcase_name (str): Load Case/Combination Name (e.g., "dl").
409
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
410
+ part (str): Component Part ("total", ...). Defaults to "total".
411
+ component (str): Component Name ("Fx", "Fy", "Fz", "Mx", "My", "Mz"). Defaults to "Fx".
412
+
413
+ '''
414
+ json_body = {
415
+ "CURRENT_MODE": "BeamForces/Moments",
416
+ "LOAD_CASE_COMB": {
417
+ "TYPE": lcase_type,
418
+ "MINMAX": lcase_minmax,
419
+ "NAME": lcase_name,
420
+ "STEP_INDEX": 1
421
+ },
422
+ "COMPONENTS": {
423
+ "PART": part,
424
+ "COMP": component,
425
+ "OPT_SHOW_TRUSS_FORCES": True
426
+ },
427
+ "TYPE_OF_DISPLAY": {
428
+ "CONTOUR": ResultGraphic.Contour._json(),
429
+ "DEFORM": ResultGraphic.Deform._json(),
430
+ "VALUES": ResultGraphic.Values._json(),
431
+ "LEGEND": ResultGraphic.Legend._json(),
432
+ "MIRRORED": { "OPT_CHECK": False },
433
+ "UNDEFORMED": { "OPT_CHECK": True },
434
+ "OPT_CUR_STEP_FORCE": False,
435
+ "YIELD_POINT": { "OPT_CHECK": False }
436
+ },
437
+ "OUTPUT_SECT_LOCATION": {
438
+ "OPT_I": True,
439
+ "OPT_CENTER_MID": True,
440
+ "OPE_J": True,
441
+ "OPT_BY_MEMBER": True
442
+ }
443
+ }
444
+ return json_body
445
+
446
+ @staticmethod
447
+ def MovingTracer_Reactions(lcase_name:str, key_node_elem:int, lcase_minmax:str="Max",
448
+ component:str="Fz", opt_local_check:bool=False) -> dict:
449
+ '''
450
+ Generates JSON for Moving Tracer Reactions Result Graphic.
451
+
452
+ Args:
453
+ lcase_name (str): Load Case Name (e.g., "DB").
454
+ key_node_elem (int): Key Node or Element ID.
455
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
456
+ component (str): Component Name ("FX", "FY", "FZ", "MX", "MY", "MZ", "Mb"). Defaults to "Fz".
457
+ opt_local_check (bool): Use Node Local Axis (True). Defaults to False.
458
+
459
+ '''
460
+ json_body = {
461
+ "CURRENT_MODE": "MVLTRC_Reactions",
462
+ "LOAD_CASE_COMB": {
463
+ "TYPE": "MV",
464
+ "MINMAX": lcase_minmax,
465
+ "NAME": lcase_name,
466
+ "KEY_NODE_ELEM": key_node_elem
467
+ },
468
+ "COMPONENTS": {
469
+ "COMP": component,
470
+ "OPT_LOCAL_CHECK": opt_local_check
471
+ },
472
+ "TYPE_OF_DISPLAY": {
473
+ "CONTOUR": ResultGraphic.Contour._json(),
474
+ "LEGEND": ResultGraphic.Legend._json(),
475
+ "APPLIED_LOADS": {
476
+ "OPT_CHECK": True,
477
+ "SCALE_FACTOR": 1.0,
478
+ "OPT_LOAD_VALUES": False,
479
+ "VALUE_TYPE": "Exponential",
480
+ "VALUE_DECIMAL_PT": 1
481
+ },
482
+ "OPT_INCLUDE_IMPACT_FACTOR": True
483
+ }
484
+ }
485
+ return json_body
486
+
487
+ @staticmethod
488
+ def MovingTracer_Displacements(lcase_name:str, key_node_elem:int, lcase_minmax:str="Max",component:str="Dz") -> dict:
489
+ '''
490
+ Generates JSON for Moving Tracer Displacements Result Graphic.
491
+
492
+ Args:
493
+ lcase_name (str): Load Case Name (e.g., "DB").
494
+ key_node_elem (int): Key Node or Element ID.
495
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
496
+ component (str): Component Name ("DX", "DY", "DZ", "RX", "RY", "RZ", "RW"). Defaults to "Dz".
497
+ '''
498
+ json_body = {
499
+ "CURRENT_MODE": "MVLTRC_Displacements",
500
+ "LOAD_CASE_COMB": {
501
+ "TYPE": "MV",
502
+ "MINMAX": lcase_minmax,
503
+ "NAME": lcase_name,
504
+ "KEY_NODE_ELEM": key_node_elem
505
+ },
506
+ "COMPONENTS": {
507
+ "COMP": component
508
+ },
509
+ "TYPE_OF_DISPLAY": {
510
+ "CONTOUR": ResultGraphic.Contour._json(),
511
+ "LEGEND": ResultGraphic.Legend._json(),
512
+ "APPLIED_LOADS": {
513
+ "OPT_CHECK": True,
514
+ "SCALE_FACTOR": 1.0,
515
+ "OPT_LOAD_VALUES": False,
516
+ "VALUE_TYPE": "Exponential",
517
+ "VALUE_DECIMAL_PT": 1
518
+ },
519
+ "OPT_INCLUDE_IMPACT_FACTOR": True
520
+ }
521
+ }
522
+ return json_body
523
+
524
+ @staticmethod
525
+ def MovingTracer_BeamForcesMoments(lcase_name:str, key_node_elem:int, lcase_minmax:str="Max",
526
+ part:str="1/4", component:str="My") -> dict:
527
+ '''
528
+ Generates JSON for Moving Tracer Beam Forces/Moments Result Graphic.
529
+
530
+ Args:
531
+ lcase_name (str): Load Case Name (e.g., "DB").
532
+ key_node_elem (int): Key Node or Element ID.
533
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
534
+ part (str): Part location ("I", "1/4", "1/2", "3/4", "J"). Defaults to "1/4".
535
+ component (str): Component Name ("FX", "FY", "FZ", "MX", "MY", "MZ", "Mb", "Mt", "Mw"). Defaults to "My".
536
+
537
+ '''
538
+ json_body = {
539
+ "CURRENT_MODE": "MVLTRC_BeamForces/Moments",
540
+ "LOAD_CASE_COMB": {
541
+ "TYPE": "MV",
542
+ "MINMAX": lcase_minmax,
543
+ "NAME": lcase_name,
544
+ "KEY_NODE_ELEM": key_node_elem
545
+ },
546
+ "COMPONENTS": {
547
+ "PART": part,
548
+ "COMP": component
549
+ },
550
+ "TYPE_OF_DISPLAY": {
551
+ "CONTOUR": ResultGraphic.Contour._json(),
552
+ "LEGEND": ResultGraphic.Legend._json(),
553
+ "APPLIED_LOADS": {
554
+ "OPT_CHECK": True,
555
+ "SCALE_FACTOR": 1.0,
556
+ "OPT_LOAD_VALUES": False,
557
+ "VALUE_TYPE": "Exponential",
558
+ "VALUE_DECIMAL_PT": 1
559
+ },
560
+ "OPT_INCLUDE_IMPACT_FACTOR": True
561
+ }
562
+ }
563
+ return json_body
564
+
565
+ @staticmethod
566
+ def VibrationModeShapes(mode_name:str, component:str="Md-XZ") -> dict:
567
+ '''
568
+ Generates JSON for Vibration Mode Shapes Result Graphic.
569
+
570
+ Args:
571
+ mode_name (str): Mode Name (e.g., "Mode6").
572
+ component (str): Component Name ("Md-X", "Md-Y", "Md-Z", "Md-XY", "Md-YZ", "Md-XZ", "Md-XYZ"). Defaults to "Md-XZ".
573
+ '''
574
+ json_body = {
575
+ "CURRENT_MODE": "VibrationModeShapes",
576
+ "LOAD_CASE_COMB": {
577
+ "NAME": mode_name
578
+ },
579
+ "COMPONENTS": {
580
+ "COMP": component
581
+ },
582
+ "TYPE_OF_DISPLAY": {
583
+ "VALUES": ResultGraphic.Values._json(),
584
+ "MODE_SHAPE": { "OPT_CHECK": True },
585
+ "UNDEFORMED": { "OPT_CHECK": True },
586
+ "LEGEND": ResultGraphic.Legend._json(),
587
+ "CONTOUR": ResultGraphic.Contour._json()
588
+ }
589
+ }
590
+ return json_body
591
+
592
+ @staticmethod
593
+ def BucklingModeShapes(mode_name:str, component:str="Md-XYZ") -> dict:
594
+ '''
595
+ Generates JSON for Buckling Mode Shapes Result Graphic.
596
+
597
+ Args:
598
+ mode_name (str): Mode Name (e.g., "Mode 2").
599
+ component (str): Component Name ("Md-X", "Md-Y", "Md-Z", "Md-XY", "Md-YZ", "Md-XZ", "Md-XYZ"). Defaults to "Md-XYZ".
600
+ '''
601
+ json_body = {
602
+ "CURRENT_MODE": "Buckling Mode Shapes",
603
+ "LOAD_CASE_COMB": {
604
+ "NAME": mode_name
605
+ },
606
+ "COMPONENTS": {
607
+ "COMP": component
608
+ },
609
+ "TYPE_OF_DISPLAY": {
610
+ "MODE_SHAPE": { "OPT_CHECK": True },
611
+ "VALUES": ResultGraphic.Values._json(),
612
+ "LEGEND": ResultGraphic.Legend._json(),
613
+ "CONTOUR": ResultGraphic.Contour._json()
614
+ }
615
+ }
616
+ return json_body
617
+
618
+ @staticmethod
619
+ def PlateForcesMoments(lcase_type:str, lcase_name:str, lcase_minmax:str="Max",
620
+ component:str="MMax", local_ucs_type:str="Local", avg_nodal_type:str="Element",
621
+ wood_armer_pos:str="Top", wood_armer_dir:str="Dir.1",
622
+ vector_opt_pos:bool=True, vector_opt_neg:bool=False) -> dict:
623
+ '''
624
+ Generates JSON for Plate Forces/Moments Result Graphic.
625
+
626
+ Args:
627
+ lcase_type (str): Load Case Type ("ST", "CS", ...).
628
+ lcase_name (str): Load Case/Combination Name.
629
+ lcase_minmax (str): Load Type ("Max", "Min", "All"). Defaults to "Max".
630
+ component (str): Component ("Fxx", "Mxx", "MMax", "WoodArmerMoment", "Mvector"). Defaults to "MMax".
631
+ local_ucs_type (str): Coordinate System ("Local", "UCS"). Defaults to "Local".
632
+ avg_nodal_type (str): Avg. Calculation ("Element", "Avg.Nodal"). Defaults to "Element".
633
+ wood_armer_pos (str): For "WoodArmerMoment" ("Top", "Bottom"). Defaults to "Top".
634
+ wood_armer_dir (str): For "WoodArmerMoment" ("Dir.1", "Dir.2"). Defaults to "Dir.1".
635
+ vector_opt_pos (bool): For "Mvector"/"Fvector" (Display Positive). Defaults to True.
636
+ vector_opt_neg (bool): For "Mvector"/"Fvector" (Display Negative). Defaults to False.
637
+
638
+ '''
639
+
640
+ components_json = {"COMP": component}
641
+ if component == "WoodArmerMoment":
642
+ components_json["WOOD_ARMER_MOMENT_OPTION"] = {
643
+ "POSITION": wood_armer_pos,
644
+ "DIRECTION": wood_armer_dir
645
+ }
646
+ elif component in ["Mvector", "Fvector"]:
647
+ components_json["VECTOR_OPTION"] = {
648
+ "OPT_POSITIVE": vector_opt_pos,
649
+ "OPT_NEGATIVE": vector_opt_neg,
650
+ "SCALE_FACTOR_LENGTH": 1.0,
651
+ "SCALE_FACTOR_THICKNESS": 1
652
+ }
653
+
654
+ json_body = {
655
+ "CURRENT_MODE": "PlateForces/Moments",
656
+ "LOAD_CASE_COMB": {
657
+ "TYPE": lcase_type,
658
+ "MINMAX": lcase_minmax,
659
+ "NAME": lcase_name,
660
+ "STEP_INDEX": 1
661
+ },
662
+ "OPTIONS": {
663
+ "LOCAL_UCS": {
664
+ "TYPE": local_ucs_type
665
+ # Can be expanded to include UCS_NAME, OPT_PRINT_UCS_AXIS
666
+ },
667
+ "AVERAGE_NODAL": {
668
+ "TYPE": avg_nodal_type
669
+ # Can be expanded to include OPT_ACTIVE_ONLY
670
+ }
671
+ },
672
+ "COMPONENTS": components_json,
673
+ "TYPE_OF_DISPLAY": {
674
+ "CONTOUR": ResultGraphic.Contour._json(),
675
+ "DEFORM": ResultGraphic.Deform._json(),
676
+ "UNDEFORMED": { "OPT_CHECK": True },
677
+ "VALUES": ResultGraphic.Values._json(),
678
+ "LEGEND": ResultGraphic.Legend._json()
679
+ }
680
+ }
681
+ return json_body
682
+
683
+ @staticmethod
684
+ def TrussStresses(lcase_type:str, lcase_name:str, component:str="All",
685
+ output_loc:str="All") -> dict:
686
+ '''
687
+ Generates JSON for Truss Stresses Result Graphic.
688
+
689
+ Args:
690
+ lcase_type (str): Load Case Type ("ST", "CS", ...).
691
+ lcase_name (str): Load Case/Combination Name.
692
+ component (str): Component ("All", "Tens.", "Comp."). Defaults to "All".
693
+ output_loc (str): Output Section Location ("I", "J", "Max", "All"). Defaults to "All".
694
+ '''
695
+ json_body = {
696
+ "CURRENT_MODE": "TrussStresses",
697
+ "LOAD_CASE_COMB": {
698
+ "TYPE": lcase_type,
699
+ "NAME": lcase_name,
700
+ "STEP_INDEX": 1
701
+ },
702
+ "COMPONENTS": {
703
+ "COMP": component
704
+ },
705
+ "TYPE_OF_DISPLAY": {
706
+ "CONTOUR": ResultGraphic.Contour._json(),
707
+ "VALUES": ResultGraphic.Values._json(),
708
+ "DEFORM": ResultGraphic.Deform._json(),
709
+ "LEGEND": ResultGraphic.Legend._json()
710
+ },
711
+ "OUTPUT_SECT_LOCATION": {
712
+ "OPT_I_J_MAX_ALL": output_loc
713
+ }
714
+ }
715
+ return json_body
716
+
717
+ @staticmethod
718
+ def BeamStresses(lcase_type:str, lcase_name:str, part:str="Total",
719
+ component:str="Combined", comp_sub:str="Maximum", output_loc:str="Max",
720
+ comp_7th_dof:str="Combined(Ssy)") -> dict:
721
+ '''
722
+ Generates JSON for Beam Stresses Result Graphic.
723
+
724
+ Args:
725
+ lcase_type (str): Load Case Type ("ST", "CS", ...).
726
+ lcase_name (str): Load Case/Combination Name.
727
+ part (str): Part Name. Defaults to "Total".
728
+ component (str): Component ("Sax", "Ssy", "Ssz", "Sby", "Sbz", "Combined", "7thDOF"). Defaults to "Combined".
729
+ comp_sub (str): Sub-component ("Maximum", "1(-y,+z)", ...). Defaults to "Maximum".
730
+ output_loc (str): Output Section Location ("Max", "All"). Defaults to "Max".
731
+ comp_7th_dof (str): 7th DOF Component ("Sax(Warping)", "Combined(Ssy)", ...). Defaults to "Combined(Ssy)".
732
+
733
+ '''
734
+
735
+ components_json = {
736
+ "PART": part,
737
+ "COMP": component,
738
+ "COMP_SUB": comp_sub
739
+ }
740
+ if component == "7thDOF":
741
+ components_json["COMP_7TH_DOF"] = comp_7th_dof
742
+
743
+ json_body = {
744
+ "CURRENT_MODE": "BeamStresses",
745
+ "LOAD_CASE_COMB": {
746
+ "TYPE": lcase_type,
747
+ "NAME": lcase_name,
748
+ "STEP_INDEX": 1
749
+ },
750
+ "COMPONENTS": components_json,
751
+ "TYPE_OF_DISPLAY": {
752
+ "CONTOUR": ResultGraphic.Contour._json(),
753
+ "VALUES": ResultGraphic.Values._json(),
754
+ "DEFORM": ResultGraphic.Deform._json(),
755
+ "LEGEND": ResultGraphic.Legend._json()
756
+ },
757
+ "OUTPUT_SECT_LOCATION": {
758
+ "OPT_MAX_ALL": output_loc
759
+ }
760
+ }
761
+ return json_body
762
+
763
+ @staticmethod
764
+ def BeamStressesDiagram(lcase_type:str, lcase_name:str, part:str="Total",
765
+ component:str="Combined", comp_sub:str="Maximum", output_loc:str="all",
766
+ comp_7th_dof:str="Combined(Ssy)", fill:str="Solid", scale:float=1.0) -> dict:
767
+ '''
768
+ Generates JSON for Beam Stresses Diagram Result Graphic.
769
+
770
+ Args:
771
+ lcase_type (str): Load Case Type ("ST", "CS", ...).
772
+ lcase_name (str): Load Case/Combination Name.
773
+ part (str): Part Name. Defaults to "Total".
774
+ component (str): Component ("Sax", "Ssy", "Ssz", "Sby", "Sbz", "Combined", "7thDOF"). Defaults to "Combined".
775
+ comp_sub (str): Sub-component ("Maximum", "1(-y,+z)", ...). Defaults to "Maximum".
776
+ output_loc (str): Output Section Location ("Max", "MinMax", "all"). Defaults to "all".
777
+ comp_7th_dof (str): 7th DOF Component ("Sax(Warping)", "Combined(Ssy)", ...). Defaults to "Combined(Ssy)".
778
+ fill (str): Fill of Diagram ("No", "Line", "Solid"). Defaults to "Solid".
779
+ scale (float): Scale of Diagram. Defaults to 1.0.
780
+
781
+ '''
782
+
783
+ components_json = {
784
+ "PART": part,
785
+ "COMP": component,
786
+ "COMP_SUB": comp_sub
787
+ }
788
+ if component == "7thDOF":
789
+ components_json["COMP_7TH_DOF"] = comp_7th_dof
790
+
791
+ json_body = {
792
+ "CURRENT_MODE": "BeamStressesDiagram",
793
+ "LOAD_CASE_COMB": {
794
+ "TYPE": lcase_type,
795
+ "NAME": lcase_name,
796
+ "STEP_INDEX": 1
797
+ },
798
+ "COMPONENTS": components_json,
799
+ "DISPLAY_OPTIONS": {
800
+ "SCALE": scale,
801
+ "FILL": fill
802
+ },
803
+ "TYPE_OF_DISPLAY": {
804
+ "CONTOUR": ResultGraphic.Contour._json(),
805
+ "VALUES": ResultGraphic.Values._json(),
806
+ "DEFORM": ResultGraphic.Deform._json(),
807
+ "LEGEND": ResultGraphic.Legend._json()
808
+ },
809
+ "OUTPUT_SECT_LOCATION": {
810
+ "OPT_MAX_MINMAX_ALL": output_loc
811
+ }
812
+ }
813
+ return json_body
814
+
815
+
816
+ class Image:
817
+ @staticmethod
818
+ def Capture(location,img_w = 1280 , img_h = 720,view='pre',CS_StageName:str=''):
819
+ '''
820
+ Capture the image in the viewport
821
+ Location - image location
822
+ Image height and width
823
+ View - 'pre' or 'post'
824
+ stage - CS name
825
+ '''
826
+ json_body = {
827
+ "Argument": {
828
+ "SET_MODE":"pre",
829
+ "SET_HIDDEN":View.Hidden,
830
+ "HEIGHT": img_h,
831
+ "WIDTH": img_w
832
+ }
833
+ }
834
+
835
+ if View.Angle.__newH__ == True or View.Angle.__newV__ == True:
836
+ json_body['Argument']['ANGLE'] = View.Angle._json()
837
+
838
+ if View.Active.__default__ ==False:
839
+ json_body['Argument']['ACTIVE'] = View.Active._json()
840
+
841
+ if view=='post':
842
+ json_body['Argument']['SET_MODE'] = 'post'
843
+ elif view=='pre':
844
+ json_body['Argument']['SET_MODE'] = 'pre'
845
+
846
+ if CS_StageName != '':
847
+ json_body['Argument']['STAGE_NAME'] = CS_StageName
848
+
849
+ resp = MidasAPI('POST','/view/CAPTURE',json_body)
850
+
851
+ bs64_img = resp["base64String"]
852
+ decode = open(location, 'wb') # Open image file to save.
853
+ decode.write(b64decode(bs64_img)) # Decode and write data.
854
+ decode.close()
855
+ return resp
856
+
857
+ @staticmethod
858
+ def CaptureResults(ResultGraphic:dict,location:str,img_w:int = 1280 , img_h:int = 720,CS_StageName:str=''):
859
+ '''
860
+ Capture Result Graphic in CIVIL NX
861
+ Result Graphic - ResultGraphic JSON (ResultGraphic.BeamDiagram())
862
+ Location - image location
863
+ Image height and width
864
+ Construction stage Name (default = "") if desired
865
+ '''
866
+ json_body = {
867
+ "Argument":{
868
+ "SET_MODE":"post",
869
+ "SET_HIDDEN":View.Hidden,
870
+ "EXPORT_PATH":location,
871
+ "HEIGHT":img_h,
872
+ "WIDTH":img_w,
873
+ "RESULT_GRAPHIC": ResultGraphic
874
+ }
875
+ }
876
+ if View.Angle.__newH__ == True or View.Angle.__newV__ == True:
877
+ json_body['Argument']['ANGLE'] = View.Angle._json()
878
+
879
+ if View.Active.__default__ ==False:
880
+ json_body['Argument']['ACTIVE'] = View.Active._json()
881
+
882
+ if CS_StageName != '':
883
+ json_body['Argument']['STAGE_NAME'] = CS_StageName
884
+
885
+ resp = MidasAPI('POST','/view/CAPTURE',json_body)
886
+
887
+ bs64_img = resp["base64String"]
888
+ decode = open(location, 'wb') # Open image file to save.
889
+ decode.write(b64decode(bs64_img)) # Decode and write data.
890
+ decode.close()
891
+ return resp