midas-civil 0.1.0__py3-none-any.whl → 0.1.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 CHANGED
@@ -17,7 +17,10 @@ from ._construction import *
17
17
  from ._thickness import *
18
18
  from ._temperature import *
19
19
 
20
+ from ._tendon import *
21
+ from ._view import *
22
+
20
23
  print('')
21
- print('*'*20,' MIDAS CIVIL-NX PYTHON LIBRARY 🐍 ','*'*20)
24
+ print('*'*20,' MIDAS CIVIL-NX PYTHON LIBRARY 🐍 ','*'*20)
22
25
  print('')
23
26
 
@@ -243,7 +243,7 @@ class CS:
243
243
  """
244
244
  json = {"Assign": {}}
245
245
 
246
- for csa in cls.CSA:
246
+ for csa in cls.stages:
247
247
  stage_data = {
248
248
  "NAME": csa.NAME,
249
249
  "DURATION": csa.DURATION,
@@ -320,7 +320,7 @@ class CS:
320
320
  @classmethod
321
321
  def create(cls):
322
322
  """Creates construction stages in the database"""
323
- MidasAPI("PUT", "/db/stag", CS.json())
323
+ MidasAPI("PUT", "/db/stag", cls.json())
324
324
 
325
325
  @classmethod
326
326
  def get(cls):
@@ -330,8 +330,8 @@ class CS:
330
330
  @classmethod
331
331
  def sync(cls):
332
332
  """Updates the CS class with data from the database"""
333
- cls.CSA = []
334
- a = CS.get()
333
+ cls.stages = []
334
+ a = cls.get()
335
335
  if a != {'message': ''}:
336
336
  if "STAG" in a:
337
337
  stag_data_dict = a["STAG"]
midas_civil/_element.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from ._mapi import *
2
2
  from ._node import *
3
+ from ._group import _add_elem_2_stGroup
3
4
 
4
5
  import numpy as np
5
6
 
@@ -8,6 +9,8 @@ def _ADD(self):
8
9
  Adds an element to the main list. If the ID is 0, it auto-increments.
9
10
  If the ID already exists, it replaces the existing element.
10
11
  """
12
+
13
+ # ------------ ID assignment -----------------------
11
14
  id = int(self.ID)
12
15
  if not Element.ids:
13
16
  count = 1
@@ -27,6 +30,20 @@ def _ADD(self):
27
30
  self.ID = id
28
31
  Element.elements.append(self)
29
32
  Element.ids.append(int(self.ID))
33
+
34
+ # ------------ Group assignment -----------------------
35
+ if self._GROUP == '' :
36
+ pass
37
+ elif isinstance(self._GROUP, list):
38
+ for gpName in self._GROUP:
39
+ _add_elem_2_stGroup(self.ID,gpName)
40
+ elif isinstance(self._GROUP, str):
41
+ _add_elem_2_stGroup(self.ID,self._GROUP)
42
+
43
+
44
+
45
+
46
+
30
47
 
31
48
  def _updateElem(self):
32
49
  """Sends a PUT request to update a single element in Midas."""
@@ -166,7 +183,7 @@ class Element:
166
183
 
167
184
  class Beam(_common):
168
185
 
169
- def __init__(self, i: int, j: int, mat: int = 1, sect: int = 1, angle: float = 0, id: int = 0):
186
+ def __init__(self, i: int, j: int, mat: int = 1, sect: int = 1, angle: float = 0, group = "" , id: int = 0):
170
187
  """
171
188
  Creates a BEAM element for frame analysis.
172
189
 
@@ -176,6 +193,7 @@ class Element:
176
193
  mat: Material property number (default 1)
177
194
  sect: Section property number (default 1)
178
195
  angle: Beta angle for section orientation in degrees (default 0.0)
196
+ group: Structure group of the element (str or list; 'SG1' or ['SG1','SG2'])
179
197
  id: Element ID (default 0 for auto-increment)
180
198
 
181
199
  Examples:
@@ -199,10 +217,11 @@ class Element:
199
217
  self.SECT = sect
200
218
  self.NODE = [i, j]
201
219
  self.ANGLE = angle
220
+ self._GROUP = group
202
221
  _ADD(self)
203
222
 
204
223
  @staticmethod
205
- def SDL(s_loc:list,dir:list,l:float,n:int=1,mat:int=1,sect:int=1,angle:float=0,id:int=0): #CHANGE TO TUPLE
224
+ def SDL(s_loc:list,dir:list,l:float,n:int=1,mat:int=1,sect:int=1,angle:float=0, group = "" , id: int = 0): #CHANGE TO TUPLE
206
225
  beam_nodes =[]
207
226
  beam_obj = []
208
227
  s_locc = np.array(s_loc)
@@ -216,13 +235,13 @@ class Element:
216
235
  for i in range(n):
217
236
  if id == 0 : id_new = 0
218
237
  else: id_new = id+i
219
- beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,id_new))
238
+ beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,group,id_new))
220
239
 
221
240
  return beam_obj
222
241
 
223
242
 
224
243
  @staticmethod
225
- def SE(s_loc:list,e_loc:list,n:int=1,mat:int=1,sect:int=1,angle:float=0,id:int=0):
244
+ def SE(s_loc:list,e_loc:list,n:int=1,mat:int=1,sect:int=1,angle:float=0, group = "" , id: int = 0):
226
245
  beam_nodes =[]
227
246
  beam_obj = []
228
247
  i_loc = np.linspace(s_loc,e_loc,n+1)
@@ -233,12 +252,12 @@ class Element:
233
252
  for i in range(n):
234
253
  if id == 0 : id_new = 0
235
254
  else: id_new = id+i
236
- beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,id_new))
255
+ beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,group,id_new))
237
256
 
238
257
  return beam_obj
239
258
 
240
259
  class Truss(_common):
241
- def __init__(self, i: int, j: int, mat: int = 1, sect: int = 1, angle: float = 0, id: int = 0):
260
+ def __init__(self, i: int, j: int, mat: int = 1, sect: int = 1, angle: float = 0, group = "" , id: int = 0):
242
261
  """
243
262
  Creates a TRUSS element
244
263
 
@@ -248,6 +267,7 @@ class Element:
248
267
  mat: Material property number (default 1)
249
268
  sect: Section property number (default 1)
250
269
  angle: Beta angle for section orientation in degrees (default 0.0)
270
+ group: Structure group of the element (str or list; 'SG1' or ['SG1','SG2'])
251
271
  id: Element ID (default 0 for auto-increment)
252
272
 
253
273
  Examples:
@@ -268,10 +288,11 @@ class Element:
268
288
  self.SECT = sect
269
289
  self.NODE = [i, j]
270
290
  self.ANGLE = angle
291
+ self._GROUP = group
271
292
  _ADD(self)
272
293
 
273
294
  @staticmethod
274
- def SDL(s_loc:list,dir:list,l:float,n:int=1,mat:int=1,sect:int=1,angle:float=0,id:int=0):
295
+ def SDL(s_loc:list,dir:list,l:float,n:int=1,mat:int=1,sect:int=1,angle:float=0, group = "" , id: int = 0):
275
296
  beam_nodes =[]
276
297
  beam_obj =[]
277
298
  s_locc = np.array(s_loc)
@@ -285,13 +306,13 @@ class Element:
285
306
  for i in range(n):
286
307
  if id == 0 : id_new = 0
287
308
  else: id_new = id+i
288
- beam_obj.append(Element.Truss(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,id_new))
309
+ beam_obj.append(Element.Truss(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,group,id_new))
289
310
 
290
311
  return beam_obj
291
312
 
292
313
 
293
314
  @staticmethod
294
- def SE(s_loc:list,e_loc:list,n:int=1,mat:int=1,sect:int=1,angle:float=0,id:int=0):
315
+ def SE(s_loc:list,e_loc:list,n:int=1,mat:int=1,sect:int=1,angle:float=0, group = "" , id: int = 0):
295
316
  beam_nodes =[]
296
317
  beam_obj = []
297
318
  i_loc = np.linspace(s_loc,e_loc,n+1)
@@ -302,12 +323,12 @@ class Element:
302
323
  for i in range(n):
303
324
  if id == 0 : id_new = 0
304
325
  else: id_new = id+i
305
- beam_obj.append(Element.Truss(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,id_new))
326
+ beam_obj.append(Element.Truss(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,group,id_new))
306
327
 
307
328
  return beam_obj
308
329
 
309
330
  class Plate(_common):
310
- def __init__(self, nodes: list, stype: int = 1, mat: int = 1, sect: int = 1, angle: float = 0, id: int = 0):
331
+ def __init__(self, nodes: list, stype: int = 1, mat: int = 1, sect: int = 1, angle: float = 0, group = "" , id: int = 0):
311
332
  """
312
333
  Creates a PLATE element.
313
334
 
@@ -317,6 +338,7 @@ class Element:
317
338
  mat: Material property number (default 1)
318
339
  sect: Section (thickness) property number (default 1)
319
340
  angle: Material angle for orthotropic materials in degrees (default 0.0)
341
+ group: Structure group of the element (str or list; 'SG1' or ['SG1','SG2'])
320
342
  id: Element ID (default 0 for auto-increment)
321
343
 
322
344
  Examples:
@@ -338,10 +360,11 @@ class Element:
338
360
  self.NODE = nodes
339
361
  self.ANGLE = angle
340
362
  self.STYPE = stype
363
+ self._GROUP = group
341
364
  _ADD(self)
342
365
 
343
366
  class Tension(_common):
344
- def __init__(self, i: int, j: int, stype: int, mat: int = 1, sect: int = 1, angle: float = 0, id: int = 0, non_len: float = None, cable_type: int = None, tens: float = None, t_limit: float = None):
367
+ def __init__(self, i: int, j: int, stype: int, mat: int = 1, sect: int = 1, angle: float = 0, group = "" , id: int = 0, non_len: float = None, cable_type: int = None, tens: float = None, t_limit: float = None):
345
368
  """
346
369
  Creates a TENSTR (Tension-only) element.
347
370
 
@@ -352,6 +375,7 @@ class Element:
352
375
  mat: Material property number (default 1)
353
376
  sect: Section property number (default 1)
354
377
  angle: Beta angle for section orientation in degrees (default 0.0)
378
+ group: Structure group of the element (str or list; 'SG1' or ['SG1','SG2'])
355
379
  id: Element ID (default 0 for auto-increment)
356
380
  non_len: Non-linear length parameter for Hook/Cable (default None)
357
381
  cable_type: Cable type for stype=3 (1=Pretension, 2=Horizontal, 3=Lu) (default None)
@@ -380,6 +404,7 @@ class Element:
380
404
  self.NODE = [i, j]
381
405
  self.ANGLE = angle
382
406
  self.STYPE = stype
407
+ self._GROUP = group
383
408
 
384
409
  # Handle subtype-specific parameters
385
410
  if stype == 1: # Tension-only specific
@@ -403,7 +428,7 @@ class Element:
403
428
  _ADD(self)
404
429
 
405
430
  class Compression(_common):
406
- def __init__(self, i: int, j: int, stype: int, mat: int = 1, sect: int = 1, angle: float = 0, id: int = 0, tens: float = None, t_limit: float = None, non_len: float = None):
431
+ def __init__(self, i: int, j: int, stype: int, mat: int = 1, sect: int = 1, angle: float = 0, group = "" , id: int = 0, tens: float = None, t_limit: float = None, non_len: float = None):
407
432
  """
408
433
  Creates a COMPTR (Compression-only) element.
409
434
 
@@ -414,6 +439,7 @@ class Element:
414
439
  mat: Material property number (default 1)
415
440
  sect: Section property number (default 1)
416
441
  angle: Beta angle for section orientation in degrees (default 0.0)
442
+ group: Structure group of the element (str or list; 'SG1' or ['SG1','SG2'])
417
443
  id: Element ID (default 0 for auto-increment)
418
444
  tens: Allowable tension or initial compression force (default None)
419
445
  t_limit: Compression limit value. If provided, the compression limit flag is set to True. (default None)
@@ -438,6 +464,7 @@ class Element:
438
464
  self.NODE = [i, j]
439
465
  self.ANGLE = angle
440
466
  self.STYPE = stype
467
+ self._GROUP = group
441
468
 
442
469
  # Handle subtype-specific parameters
443
470
  if stype == 1: # Compression-only specific
@@ -453,7 +480,7 @@ class Element:
453
480
  _ADD(self)
454
481
 
455
482
  class Solid(_common):
456
- def __init__(self, nodes: list, mat: int = 1, sect: int = 0, id: int = 0):
483
+ def __init__(self, nodes: list, mat: int = 1, sect: int = 0, group = "" , id: int = 0):
457
484
  """
458
485
  Creates a SOLID element for 3D analysis.
459
486
 
@@ -463,6 +490,7 @@ class Element:
463
490
  - 6 nodes: Pentahedral element
464
491
  - 8 nodes: Hexahedral element
465
492
  mat: Material property number (default 1)
493
+ group: Structure group of the element (str or list; 'SG1' or ['SG1','SG2'])
466
494
  id: Element ID (default 0 for auto-increment)
467
495
 
468
496
  Examples:
@@ -484,6 +512,7 @@ class Element:
484
512
  self.MATL = mat
485
513
  self.SECT = sect # Solid elements don't use section properties
486
514
  self.NODE = nodes
515
+ self._GROUP = group
487
516
  _ADD(self)
488
517
 
489
518
 
midas_civil/_group.py CHANGED
@@ -1,5 +1,24 @@
1
1
 
2
2
  from ._mapi import *
3
+
4
+
5
+
6
+ # ----------- HELPER FUNCTION -----------
7
+ # -------- ADD ELEMENT TO STRUCTURE GROUP -------
8
+
9
+ def _add_elem_2_stGroup(elemID,groupName):
10
+ up = 0
11
+ if groupName in Group.Structure._names:
12
+ for i in Group.Structure.Groups:
13
+ if i.NAME == groupName:
14
+ i.ELIST = list(i.ELIST + [elemID])
15
+ else:
16
+ Group.Structure(groupName)
17
+ _add_elem_2_stGroup(elemID,groupName)
18
+
19
+
20
+
21
+
3
22
  #---------------------------------------------------------------------------------------------------------------
4
23
  class Group:
5
24
 
@@ -35,6 +54,7 @@ class Group:
35
54
 
36
55
  Groups = []
37
56
  ids=[]
57
+ _names = []
38
58
  url= "/db/GRUP"
39
59
 
40
60
  def __init__(self, name, nlist=[],elist=[]):
@@ -46,6 +66,7 @@ class Group:
46
66
  self.NLIST = list(set(nlist))
47
67
  Group.Structure.ids.append(self.ID)
48
68
  Group.Structure.Groups.append(self)
69
+ Group.Structure._names.append(self.NAME)
49
70
 
50
71
  @classmethod
51
72
  def update(cls, name,operation = "r", nlist = [],elist = [] ):
midas_civil/_material.py CHANGED
@@ -58,7 +58,7 @@ class Material:
58
58
  if Material.mats!=[] : Material.create_only()
59
59
  if CreepShrinkage.mats!=[] : CreepShrinkage.create()
60
60
  if CompStrength.mats!=[] : CompStrength.create()
61
- if TDLink.json()!={'Assign':{}} : TDLink.create()
61
+ if TDMatLink.json()!={'Assign':{}} : TDMatLink.create()
62
62
 
63
63
 
64
64
  @staticmethod
@@ -1592,23 +1592,23 @@ class CompStrength:
1592
1592
 
1593
1593
 
1594
1594
 
1595
- class TDLink:
1595
+ class TDMatLink:
1596
1596
  mats = {}
1597
1597
  def __init__(self,matID,CnSName='',CompName=''):
1598
1598
 
1599
- TDLink.mats[str(matID)]={
1599
+ TDMatLink.mats[str(matID)]={
1600
1600
  "TDMT_NAME": CnSName,
1601
1601
  "TDME_NAME": CompName
1602
1602
  }
1603
1603
 
1604
1604
  @classmethod
1605
1605
  def json(cls):
1606
- json = {"Assign": TDLink.mats}
1606
+ json = {"Assign": TDMatLink.mats}
1607
1607
  return json
1608
1608
 
1609
1609
  @staticmethod
1610
1610
  def create():
1611
- MidasAPI("PUT","/db/TMAT",TDLink.json())
1611
+ MidasAPI("PUT","/db/TMAT",TDMatLink.json())
1612
1612
 
1613
1613
  @staticmethod
1614
1614
  def get():
@@ -1618,16 +1618,16 @@ class TDLink:
1618
1618
  @staticmethod
1619
1619
  def delete():
1620
1620
  MidasAPI("DELETE","/db/TMAT")
1621
- TDLink.mats={}
1621
+ TDMatLink.mats={}
1622
1622
 
1623
1623
  @staticmethod
1624
1624
  def sync():
1625
- a = TDLink.get()
1625
+ a = TDMatLink.get()
1626
1626
  if a != {'message': ''}:
1627
1627
  if list(a['TMAT'].keys()) != []:
1628
- TDLink.mats = []
1629
- TDLink.ids=[]
1628
+ TDMatLink.mats = []
1629
+ TDMatLink.ids=[]
1630
1630
  for j in a['TMAT'].keys():
1631
- TDLink(a['TMAT'][j], int(j))
1631
+ TDMatLink(a['TMAT'][j], int(j))
1632
1632
 
1633
1633
  #-------------------------------------------------------------------------------------------------
@@ -9,15 +9,12 @@ from ._mapi import *
9
9
 
10
10
 
11
11
  #---- INPUT: JSON -> OUTPUT : Data FRAME --------- ---------
12
- def JSToDF(js_json):
13
- for i in js_json:
14
- table_name= i
15
-
12
+ def _JSToDF_ResTable(js_json):
16
13
  res_json = {}
17
14
 
18
15
  c=0
19
- for heading in js_json[table_name]["HEAD"]:
20
- for dat in js_json[table_name]["DATA"]:
16
+ for heading in js_json["SS_Table"]["HEAD"]:
17
+ for dat in js_json["SS_Table"]["DATA"]:
21
18
  try:
22
19
  res_json[heading].append(dat[c])
23
20
  except:
@@ -29,20 +26,12 @@ def JSToDF(js_json):
29
26
  res_df = pl.DataFrame(res_json)
30
27
  return(res_df)
31
28
 
32
-
33
-
34
- def JSToDF_UserDefined(tableName,js_json):
35
29
 
36
- if 'message' in js_json:
37
- print(f'⚠️ {tableName} table name does not exist.')
38
- print_UserDefinedTables()
39
- return 0
40
-
30
+ def _Head_Data_2_DF_JSON(head,data):
41
31
  res_json = {}
42
-
43
32
  c=0
44
- for heading in js_json[tableName]["HEAD"]:
45
- for dat in js_json[tableName]["DATA"]:
33
+ for heading in head:
34
+ for dat in data:
46
35
  try:
47
36
  res_json[heading].append(dat[c])
48
37
  except:
@@ -50,21 +39,37 @@ def JSToDF_UserDefined(tableName,js_json):
50
39
  res_json[heading].append(dat[c])
51
40
 
52
41
  c+=1
42
+ return res_json
43
+
44
+
45
+ def _JSToDF_UserDefined(tableName,js_json,summary):
53
46
 
47
+ if 'message' in js_json:
48
+ print(f'⚠️ {tableName} table name does not exist.')
49
+ Result.UserDefinedTables_print()
50
+ return 'Check table name'
51
+
52
+ if summary == 0:
53
+ head = js_json[tableName]["HEAD"]
54
+ data = js_json[tableName]["DATA"]
55
+ elif summary > 0 :
56
+ try :
57
+ sub_tab1 = js_json[tableName]["SUB_TABLES"][summary-1]
58
+ key_name = next(iter(sub_tab1))
59
+ head = sub_tab1[key_name]["HEAD"]
60
+ data = sub_tab1[key_name]["DATA"]
61
+ except :
62
+ print(' ⚠️ No Summary table exist')
63
+ return 'No Summary table exist'
64
+
65
+
66
+ res_json = _Head_Data_2_DF_JSON(head,data)
54
67
  res_df = pl.DataFrame(res_json)
55
68
  return(res_df)
56
69
 
57
70
 
58
71
 
59
72
 
60
- def print_UserDefinedTables():
61
- ss_json = MidasAPI("GET","/db/UTBL",{})
62
- table_name =[]
63
- for id in ss_json['UTBL']:
64
- table_name.append(ss_json["UTBL"][id]['NAME'])
65
-
66
- print('Available user-defined tables in Civil NX are : ')
67
- print(*table_name,sep=' , ')
68
73
 
69
74
 
70
75
 
@@ -113,48 +118,76 @@ def print_UserDefinedTables():
113
118
  # df4.write_excel(Wb,"Sheet 1",table_style="Table Style Light 8",autofit=True,autofilter=False,position="A31",include_header=False)
114
119
 
115
120
 
116
- def ResultData(tabletype:str,elements:list=[],loadcase:list=[]):
117
- js_dat = {
118
- "Argument": {
119
- "TABLE_NAME": "SS_Table",
120
- "TABLE_TYPE": tabletype,
121
- "UNIT": {
122
- "FORCE": "kN",
123
- "DIST": "m"
124
- },
125
- "STYLES": {
126
- "FORMAT": "Fixed",
127
- "PLACE": 12
121
+
122
+
123
+
124
+ class Result :
125
+
126
+ # ---------- User defined TABLE (Dynamic Report Table) ------------------------------
127
+ @staticmethod
128
+ def UserDefinedTable(tableName:str, summary=0):
129
+ js_dat = {
130
+ "Argument": {
131
+ "TABLE_NAME": tableName,
132
+ "STYLES": {
133
+ "FORMAT": "Fixed",
134
+ "PLACE": 12
135
+ }
128
136
  }
129
137
  }
130
- }
131
138
 
132
- node_elem_js = {
133
- "KEYS": elements
139
+ ss_json = MidasAPI("POST","/post/TABLE",js_dat)
140
+ return _JSToDF_UserDefined(tableName,ss_json,summary)
141
+
142
+ # ---------- Result TABLE ------------------------------
143
+ @staticmethod
144
+ def UserDefinedTables_print():
145
+ ''' Print all the User defined table names '''
146
+ ss_json = MidasAPI("GET","/db/UTBL",{})
147
+ table_name =[]
148
+ try:
149
+ for id in ss_json['UTBL']:
150
+ table_name.append(ss_json["UTBL"][id]['NAME'])
151
+
152
+ print('Available user-defined tables in Civil NX are : ')
153
+ print(*table_name,sep=' , ')
154
+ except:
155
+ print(' ⚠️ There are no user-defined tables in Civil NX')
156
+
157
+
158
+
159
+ # ---------- Result TABLE ------------------------------
160
+ @staticmethod
161
+ def ResultTable(tabletype:str,elements:list=[],loadcase:list=[],cs_stage=[],force_unit='kN',len_unit='m'):
162
+ '''
163
+ TableType : REACTIONG | REACTIONL | DISPLACEMENTG | DISPLACEMENTL | TRUSSFORCE | TRUSSSTRESS
164
+ '''
165
+ js_dat = {
166
+ "Argument": {
167
+ "TABLE_NAME": "SS_Table",
168
+ "TABLE_TYPE": tabletype,
169
+ "UNIT": {
170
+ "FORCE": force_unit,
171
+ "DIST": len_unit
172
+ },
173
+ "STYLES": {
174
+ "FORMAT": "Fixed",
175
+ "PLACE": 12
176
+ }
177
+ }
134
178
  }
135
179
 
136
- if elements!=[]: js_dat["Argument"]['NODE_ELEMS'] = node_elem_js
137
- if loadcase!=[]: js_dat["Argument"]['LOAD_CASE_NAMES'] = loadcase
138
-
139
- ss_json = MidasAPI("POST","/post/table",js_dat)
140
- return JSToDF(ss_json)
180
+ if cs_stage !=[]:
181
+ if cs_stage == 'all' :
182
+ js_dat["Argument"]['OPT_CS'] = True
183
+ else:
184
+ js_dat["Argument"]['OPT_CS'] = True
185
+ js_dat["Argument"]['STAGE_STEP'] = cs_stage
141
186
 
142
187
 
188
+ if elements!=[]: js_dat["Argument"]['NODE_ELEMS'] = {"KEYS": elements}
189
+ if loadcase!=[]: js_dat["Argument"]['LOAD_CASE_NAMES'] = loadcase
143
190
 
144
- def Result_UserDefinedTable(tableName:str):
145
- js_dat = {
146
- "Argument": {
147
- "TABLE_NAME": tableName,
148
- "UNIT": {
149
- "FORCE": "kN",
150
- "DIST": "m"
151
- },
152
- "STYLES": {
153
- "FORMAT": "Fixed",
154
- "PLACE": 12
155
- }
156
- }
157
- }
191
+ ss_json = MidasAPI("POST","/post/table",js_dat)
192
+ return _JSToDF_ResTable(ss_json)
158
193
 
159
- ss_json = MidasAPI("POST","/post/TABLE",js_dat)
160
- return JSToDF_UserDefined(tableName,ss_json)
midas_civil/_tendon.py ADDED
@@ -0,0 +1,204 @@
1
+
2
+ from ._mapi import *
3
+ from ._utils import *
4
+
5
+
6
+ #5 Class to create nodes
7
+ class Tendon:
8
+
9
+ # ----------------- TENDON PROFILE --------------------------
10
+ class Profile:
11
+ profiles =[]
12
+ ids=[]
13
+
14
+ def __init__(self,name,tdn_prop,tdn_group=0,elem=[],inp_type='3D',curve_type = 'SPLINE',st_len_begin = 0 , st_len_end = 0,n_typical_tendon=0,
15
+ trans_len_opt='USER', trans_len_begin = 0 , trans_len_end = 0, debon_len_begin=0 , debon_len_end=0,
16
+ ref_axis = 'ELEMENT',
17
+ prof_xyz = [], prof_xy =[],prof_xz=[],
18
+ prof_ins_point_end = 'END-I', prof_ins_point_elem = 0, x_axis_dir_element = 'I-J', x_axis_rot_ang = 0 , projection = True, offset_y = 0 , offset_z = 0,
19
+ prof_ins_point =[0,0,0], x_axis_dir_straight = 'X' , x_axis_dir_vec = [0,0], grad_rot_axis = 'X', grad_rot_ang=0,
20
+ radius_cen = [0,0], offset = 0, dir = 'CW',
21
+ id=0):
22
+
23
+
24
+
25
+ if Tendon.Profile.ids == []:
26
+ td_count = 1
27
+ else:
28
+ td_count = max(Tendon.Profile.ids)+1
29
+
30
+ if id == 0 : self.ID = td_count
31
+ if id != 0 : self.ID = id
32
+
33
+ self.NAME = name
34
+ self.PROP = tdn_prop
35
+ self.GROUP = tdn_group
36
+ self.ELEM = elem
37
+
38
+ if inp_type not in ['2D' , '3D']: inp_type = '3D'
39
+ self.INPUT = inp_type
40
+
41
+ if curve_type not in ['SPLINE' , 'ROUND']: curve_type = 'ROUND'
42
+ self.CURVE = curve_type
43
+
44
+ self.BELENG = st_len_begin
45
+ self.ELENG = st_len_end
46
+
47
+
48
+ self.CNT = n_typical_tendon
49
+ if n_typical_tendon > 0:
50
+ self.bTP = True
51
+ else: self.bTP = False
52
+
53
+ if trans_len_opt not in ['USER' , 'AUTO']: trans_len_opt = 'USER'
54
+ self.LENG_OPT = trans_len_opt
55
+ self.BLEN = trans_len_begin
56
+ self.ELEN = trans_len_end
57
+
58
+ self.DeBondBLEN = debon_len_begin
59
+ self.DeBondELEN = debon_len_end
60
+
61
+ if ref_axis not in ['ELEMENT' , 'STRAIGHT' , 'CURVE']: ref_axis = 'ELEMENT'
62
+ self.SHAPE = ref_axis
63
+
64
+ #------- ELEMENT TYPE -------------
65
+
66
+ if prof_ins_point_end not in ['END-I' , 'END-J']: prof_ins_point_end = 'END-I'
67
+ self.INS_PT = prof_ins_point_end
68
+
69
+ if prof_ins_point_elem == 0: prof_ins_point_elem = elem[0]
70
+ self.INS_ELEM = prof_ins_point_elem
71
+
72
+ if x_axis_dir_element not in ['I-J' , 'J-I']: x_axis_dir_element = 'I-J'
73
+ self.AXIS_IJ = x_axis_dir_element
74
+
75
+ self.XAR_ANGLE = x_axis_rot_ang # common in straight
76
+ self.bPJ = projection # common in straight
77
+
78
+ self.OFF_YZ = [offset_y,offset_z]
79
+
80
+ #------- STRAIGHT TYPE -------------
81
+
82
+ self.IP = prof_ins_point
83
+
84
+ if x_axis_dir_straight not in ['X' , 'Y' , 'VECTOR']: x_axis_dir_straight = 'X'
85
+ self.AXIS = x_axis_dir_straight
86
+
87
+ self.VEC = x_axis_dir_vec
88
+
89
+
90
+ if grad_rot_axis not in ['X' , 'Y']: grad_rot_axis = 'X'
91
+ self.GR_AXIS = grad_rot_axis
92
+
93
+ self.GR_ANGLE = grad_rot_ang
94
+
95
+ #------- CURVE TYPE -------------
96
+
97
+ self.RC = radius_cen
98
+ self.OFFSET = offset
99
+
100
+ if dir not in ['CW' , 'CCW']: dir = 'CW'
101
+ self.DIR = dir
102
+
103
+
104
+
105
+ #--------------- PROFILES CREATION -----------------
106
+ x_loc = []
107
+ y_loc = []
108
+ z_loc = []
109
+ bFix = []
110
+ Rd = []
111
+ Rl = []
112
+
113
+ for point in prof_xyz:
114
+ x_loc.append(point[0])
115
+ y_loc.append(point[1])
116
+ z_loc.append(point[2])
117
+ bFix.append(False) # Default not defining here
118
+ if curve_type == 'SPLINE':
119
+ Rd.append([0,0]) # Default not defining here
120
+ else:
121
+ Rl.append(0)
122
+
123
+ #----- 3D Profile -------------
124
+
125
+ self.X = x_loc
126
+ self.Y = y_loc
127
+ self.Z = z_loc
128
+ self.bFIX = bFix
129
+
130
+ self.R = Rd
131
+ self.RADIUS = Rl
132
+
133
+
134
+ #----- 2D Profile -------------
135
+
136
+
137
+
138
+
139
+
140
+ Tendon.Profile.profiles.append(self)
141
+ Tendon.Profile.ids.append(self.ID)
142
+
143
+
144
+
145
+ @classmethod
146
+ def json(cls):
147
+
148
+ json = {"Assign":{}}
149
+
150
+ for self in cls.profiles:
151
+
152
+ array_temp = []
153
+ for j in range(len(self.X)):
154
+ array_temp.append({
155
+ 'PT' : [self.X[j],self.Y[j],self.Z[j]],
156
+ 'bFIX' : self.bFIX[j],
157
+ 'R' : self.R[j]
158
+ })
159
+
160
+ json["Assign"][self.ID]={
161
+ 'NAME' : self.NAME,
162
+ 'TDN_PROP' : self.PROP,
163
+ 'ELEM' : self.ELEM,
164
+ 'BELENG' : self.BELENG,
165
+ 'ELENG' : self.ELENG,
166
+ 'CURVE' : self.CURVE,
167
+ 'INPUT' : self.INPUT,
168
+ 'TDN_GRUP' : self.GROUP,
169
+ "LENG_OPT": self.LENG_OPT,
170
+ "BLEN": self.BLEN,
171
+ "ELEN": self.ELEN,
172
+ "bTP": self.bTP,
173
+ "CNT": self.CNT,
174
+ "DeBondBLEN": self.DeBondBLEN,
175
+ "DeBondELEN": self.DeBondELEN,
176
+ "SHAPE": self.SHAPE,
177
+ "INS_PT": self.INS_PT,
178
+ "INS_ELEM": self.INS_ELEM,
179
+ "AXIS_IJ": self.AXIS_IJ,
180
+ "XAR_ANGLE": self.XAR_ANGLE,
181
+ "bPJ": self.bPJ,
182
+ "OFF_YZ": self.OFF_YZ,
183
+
184
+ "PROF":array_temp
185
+ }
186
+ return json
187
+
188
+
189
+ @classmethod
190
+ def create(cls):
191
+ MidasAPI("PUT","/db/TDNA",cls.json())
192
+
193
+
194
+ @classmethod
195
+ def get(cls):
196
+ return MidasAPI('GET','/db/TDNA')
197
+
198
+ @classmethod
199
+ def sync(cls):
200
+ tendon_json = cls.get()
201
+ for id in tendon_json['TDNA']:
202
+ Tendon.Profile(tendon_json['TDNA'][id],id)
203
+
204
+ # --------------------- END CLASSS -----------------------------------------------------
midas_civil/_view.py ADDED
@@ -0,0 +1,26 @@
1
+ from ._mapi import *
2
+ from ._model import *
3
+
4
+
5
+
6
+ class View:
7
+
8
+ def Capture(location="D:\\API_temp\\img3.jpg",img_w = 1280 , img_h = 720,view='',stage:str=''):
9
+ json_body = {
10
+ "Argument": {
11
+ "EXPORT_PATH": location,
12
+ "HEIGHT": img_h,
13
+ "WIDTH": img_w,
14
+ "ZOOM_LEVEL" : 100
15
+ }
16
+ }
17
+
18
+ if view=='post':
19
+ json_body['Argument']['SET_MODE'] = 'post'
20
+ elif view=='pre':
21
+ json_body['Argument']['SET_MODE'] = 'pre'
22
+
23
+ if stage != '':
24
+ json_body['Argument']['STAGE_NAME'] = stage
25
+
26
+ MidasAPI('POST','/view/CAPTURE',json_body)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: midas_civil
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Python library for MIDAS Civil NX
5
5
  Author: Sumit Shekhar
6
6
  Author-email: sumit.midasit@gmail.com
@@ -1,23 +1,25 @@
1
- midas_civil/__init__.py,sha256=naIywmkJTaHytt85vRiV7Du36t2qK7liO1gEKUOS1nM,476
1
+ midas_civil/__init__.py,sha256=ZMBbIpDOrV647HRaVhLuk6G4vdMWSL0tVbZ6eejWIms,520
2
2
  midas_civil/_boundary.py,sha256=cF5NIUkk3q11sDnrI1lfebLqelpPyjKF-PgAbI6UU1k,32703
3
- midas_civil/_construction.py,sha256=W_QU0zdk7uB2SBYzqDNYbCWcg5mnVfWvrgu3PY7CHfg,19957
3
+ midas_civil/_construction.py,sha256=EqpJ46w4dqtlmk8dy9ChQq2cF-R2duXcgmpJy4cWLz0,19965
4
4
  midas_civil/_construction_backup.py,sha256=Pj7V-NYCkkT-aMjKXfs1jKa9klsGh48UXDLwn3BLYTY,18225
5
- midas_civil/_element.py,sha256=UbXgad_D_yNgTXWRO1zMP2hQB82BaDdMWvGymrg0L1g,18508
6
- midas_civil/_group.py,sha256=Xk_DDyDetJ1M_90-m4XfpTxM74_6xRAdw76O7q_Qd0Y,10078
5
+ midas_civil/_element.py,sha256=DhUHJVPwuBkl0AbUOZ6RamEUbAoGiJCKmMbiKbFXOzs,19847
6
+ midas_civil/_group.py,sha256=tUjctPpPz3VLX_1lHFFR85oVyjrrJtn3Caf6zWyBQ6g,10570
7
7
  midas_civil/_load.py,sha256=Wg2Cyn7meaCkb28vQSxWi1H1slBQKXdXyoKPGvsHesQ,29557
8
8
  midas_civil/_mapi.py,sha256=NImeBj8L7rwrYuaeXbaU3-UnCL4Fyp6tB1wf0UpdQp8,2354
9
- midas_civil/_material.py,sha256=3dEIafEhdm4s0OXobXZkGYUYYdputNTQ_IyEQ1BTbeY,69478
9
+ midas_civil/_material.py,sha256=uJEIHJM9OhwTRWUI2mtd_0BQSxdlYhATYJu9P7tNNBA,69511
10
10
  midas_civil/_model.py,sha256=uj_nenNqNLYgwLKB6BZXEPGEByME23gVA5u3EXRZuAA,16337
11
11
  midas_civil/_node.py,sha256=yj17RT3Ei7RafWQVHThjwPGUHe3DTQbuv0MwuDjCJro,3513
12
12
  midas_civil/_result copy.py,sha256=siTMENLIwF_6rvydSjP9aQAWaIlt0pReiqNyDhDevGk,24290
13
13
  midas_civil/_result.py,sha256=0c_lBai5ayvoOK4zD6jBDYBcqixCAljq5qJyZ4koboI,7648
14
- midas_civil/_result_extract.py,sha256=EL8ArWXsDSJFZG0NJ6n6iZvwrY4G9cWo0HMwxz7Ir1M,3738
14
+ midas_civil/_result_extract.py,sha256=0Uyhcr2kDUZ4GWIfMgEkcTQacKt5GJcE4jQ_7YgRbBY,5178
15
15
  midas_civil/_section.py,sha256=56RWJdyvDr7Es7Is8Fxq3jPCPP57WW8ECCYZzhm6bf0,26375
16
16
  midas_civil/_temperature.py,sha256=ZFs5COZh7QFe-xpWNK44u8IqlqMfaOklAo_ZOVAzFok,13047
17
+ midas_civil/_tendon.py,sha256=XDG9gNETffkv6WtjoEHGZu66PQe8iNBS_G6j4miN-Sg,6845
17
18
  midas_civil/_thickness.py,sha256=Mungooyfo0_JJUmjPCr25h0PSSW_TtEfcMa-hz3YGZA,3146
18
19
  midas_civil/_utils.py,sha256=eymiqO8KaTKdhVY3saebqNS0BbUUmGmgw3-ELKqew0A,2611
19
- midas_civil-0.1.0.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
20
- midas_civil-0.1.0.dist-info/METADATA,sha256=KQmI0FJzmwZJrmL6zuxje_eoNYW3uIhA8RIvU6pBn0A,1709
21
- midas_civil-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- midas_civil-0.1.0.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
23
- midas_civil-0.1.0.dist-info/RECORD,,
20
+ midas_civil/_view.py,sha256=68gfsyN6QJ2B5CopNVlP3MQ-833MxfrVWz7p_hMdm4c,701
21
+ midas_civil-0.1.1.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
22
+ midas_civil-0.1.1.dist-info/METADATA,sha256=b1o_X2CEMJQn5n2ASJFnuwgKGZTUcqDwaBINc7UDQ9E,1709
23
+ midas_civil-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ midas_civil-0.1.1.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
25
+ midas_civil-0.1.1.dist-info/RECORD,,