midas-civil 1.0.8__py3-none-any.whl → 1.1.0__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
@@ -1,22 +1,21 @@
1
1
  import requests
2
+ from colorama import Fore,Style
2
3
  from ._mapi import *
3
- _version_ = "1.0.8"
4
+ _version_ = "1.1.0"
4
5
 
5
6
 
6
- print('')
7
- print('*'*20,' MIDAS CIVIL-NX PYTHON LIBRARY v',_version_,' 🐍 ','*'*20)
8
- print('')
7
+ print('\n╭────────────────────────────────────────────────────────────────────────────────────╮')
8
+ print(Style.BRIGHT+f'MIDAS CIVIL-NX PYTHON LIBRARY v{_version_} 🐍')
9
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
9
10
 
10
11
  if NX.version_check:
11
12
  resp = requests.get("https://pypi.org/pypi/midas_civil/json").json()
12
13
  latest_ver = resp["info"]["version"]
13
- if _version_ != latest_ver:
14
- print(
15
- f"⚠️ Warning: You are using v{_version_}, "
16
- f"but the latest available version is v{latest_ver}.\n"
17
- f" Run 'pip install midas_civil --upgrade' to update."
18
- )
19
- print("-"*85)
14
+ if _version_ != latest_ver:
15
+ print(Fore.YELLOW +'╭─ ⚠️ ──────────────────────────────────────────────────────────────────────────────╮')
16
+ print(f"Warning: You are using v{_version_}, but the latest available version is v{latest_ver}. │")
17
+ print(f"│ Run 'pip install midas_civil --upgrade' to update. │")
18
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
20
19
 
21
20
 
22
21
  from ._model import *
midas_civil/_element.py CHANGED
@@ -8,7 +8,7 @@ from math import hypot
8
8
  import math
9
9
 
10
10
 
11
- def _interpolateAlignment(pointsArray,n_seg=10,deg=1,mSize=0,includePoint:bool=True,yEcc=0,zEcc=0) -> list:
11
+ def _interpolateAlignment(pointsArray,n_seg=10,deg=1,mSize=0,includePoint:bool=True) -> list:
12
12
  ''' Returns point list and beta angle list'''
13
13
  pointsArray = np.array(pointsArray)
14
14
  x_p, y_p , z_p = pointsArray[:,0] , pointsArray[:,1] , pointsArray[:,2]
@@ -110,7 +110,7 @@ def _triangleAREA(a:Node,b:Node,c:Node):
110
110
  mag = np.linalg.norm(np.cross(v1, v2))
111
111
  return float(0.5 * mag) , np.cross(v1, v2)/mag
112
112
 
113
- def _calcVector(deltaLocation):
113
+ def _calcVector(deltaLocation,angle=0): # Returns normalised local X,Y,Z for line
114
114
  Z_new = np.array([0.000001,0,1])
115
115
  X_new = np.array(deltaLocation)
116
116
  Y_new = np.cross(Z_new, X_new)
@@ -121,22 +121,45 @@ def _calcVector(deltaLocation):
121
121
  Y_new = Y_new / (np.linalg.norm(Y_new)+0.000001)
122
122
  Z_new = Z_new / (np.linalg.norm(Z_new)+0.000001)
123
123
 
124
- return [X_new,Y_new,Z_new]
124
+ from scipy.spatial.transform import Rotation as R
125
+ p_y = np.array(Y_new)
126
+ p_z = np.array(Z_new)
127
+
128
+ axis = np.array(X_new)
129
+ theta = np.deg2rad(angle) # or radians directly
130
+ rot = R.from_rotvec(axis * theta) # axis-angle as rotation vector
131
+
132
+ rt_y = rot.apply(p_y) # rotated point around axis through origin
133
+ rt_z = rot.apply(p_z)
134
+
135
+ return [X_new,rt_y,rt_z]
136
+
137
+ def _rotatePT(pt,axis,deg):
138
+ from scipy.spatial.transform import Rotation as R
139
+ p = np.array(pt)
140
+ axis = np.array(axis)
141
+ theta = np.deg2rad(deg) # or radians directly
142
+ rot = R.from_rotvec(axis * theta) # axis-angle as rotation vector
143
+ return rot.apply(p) # rotated point around axis through origin
144
+
145
+ def _pointOffset(pts,yEcc=0,zEcc=0,angle=0):
146
+ from ._utils import _matchArray
147
+
148
+ angle2 = _matchArray(pts,angle)
125
149
 
126
- def _pointOffset(pts,yEcc,zEcc):
127
150
  norm = []
128
- norm.append(_calcVector(np.subtract(pts[1],pts[0])))
151
+ norm.append(_calcVector(np.subtract(pts[1],pts[0]),angle2[0])) # first X- along vector
129
152
 
130
- for i in range(len(pts)-2):
153
+ for i in range(len(pts)-2): # Averaged X- along vector for middle points
131
154
  X_new1 = np.array(np.subtract(pts[i+1],pts[i]))
132
155
  X_new2 = np.array(np.subtract(pts[i+2],pts[i+1]))
133
156
 
134
157
  X_new1 = X_new1 / (np.linalg.norm(X_new1)+0.000001)
135
158
  X_new2 = X_new2 / (np.linalg.norm(X_new2)+0.000001)
136
159
 
137
- norm.append(_calcVector(np.add(X_new1,X_new2)))
160
+ norm.append(_calcVector(np.add(X_new1,X_new2),angle2[i+1]))
138
161
 
139
- norm.append(_calcVector(np.subtract(pts[-1],pts[-2])))
162
+ norm.append(_calcVector(np.subtract(pts[-1],pts[-2]),angle2[-1])) # last X- along vector
140
163
 
141
164
  # print(norm)
142
165
 
@@ -329,6 +352,12 @@ class Element:
329
352
  Element.elements = []
330
353
  Element.ids = []
331
354
  Element.__elemDIC__={}
355
+
356
+ @staticmethod
357
+ def clear():
358
+ Element.elements = []
359
+ Element.ids = []
360
+ Element.__elemDIC__={}
332
361
 
333
362
  # --- Element Type Subclasses ---
334
363
 
@@ -440,6 +469,10 @@ class Element:
440
469
  i_loc = points_loc
441
470
  else:
442
471
  i_loc = _interpolateAlignment(points_loc,n_div,deg,0,includePoint)
472
+
473
+ from ._utils import _matchArray
474
+ angle = _matchArray(i_loc,angle)
475
+
443
476
  for i in i_loc:
444
477
  Enode=Node(i[0],i[1],i[2])
445
478
  beam_nodes.append(Enode.ID)
@@ -447,29 +480,36 @@ class Element:
447
480
  for i in range(len(i_loc)-1):
448
481
  if id == 0 : id_new = 0
449
482
  else: id_new = id+i
450
- beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,group,id_new,bLocalAxis))
483
+ beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle[i],group,id_new,bLocalAxis))
451
484
 
452
485
  return beam_obj
453
486
 
454
487
  @staticmethod
455
488
  def PLine2(points_loc:list,n_div:int=0,deg:int=1,includePoint:bool=True,mat:int=1,sect:int=1,angle:float=0, group = "" , id: int = 0,bLocalAxis=False,yEcc=0,zEcc=0):
456
-
489
+
490
+
457
491
  beam_nodes =[]
458
492
  beam_obj = []
459
493
  if n_div == 0 :
460
494
  i_loc = points_loc
461
495
  else:
462
- i_loc = _interpolateAlignment(points_loc,n_div,deg,0,includePoint,yEcc,zEcc)
496
+ i_loc = _interpolateAlignment(points_loc,n_div,deg,0,includePoint)
497
+
498
+ from ._utils import _matchArray
499
+ angle = _matchArray(i_loc,angle)
463
500
 
464
- i_loc2 = _pointOffset(i_loc,yEcc,zEcc)
501
+ i_loc2 = _pointOffset(i_loc,yEcc,zEcc,angle)
465
502
  for i in i_loc2:
466
503
  Enode=Node(i[0],i[1],i[2])
467
504
  beam_nodes.append(Enode.ID)
505
+
468
506
 
507
+
508
+
469
509
  for i in range(len(i_loc2)-1):
470
510
  if id == 0 : id_new = 0
471
511
  else: id_new = id+i
472
- beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,group,id_new,bLocalAxis))
512
+ beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle[i],group,id_new,bLocalAxis))
473
513
 
474
514
  return beam_obj
475
515
 
midas_civil/_mapi.py CHANGED
@@ -1,17 +1,18 @@
1
1
  import requests
2
2
  import sys
3
+ from colorama import Fore, Style
3
4
  try:import winreg
4
5
  except: pass
6
+ import time
5
7
 
6
8
 
7
9
 
8
10
 
9
11
  def Midas_help():
10
12
  """MIDAS Documnetation : https://midas-rnd.github.io/midasapi-python """
11
- print("---"*22)
12
- print("| HELP MANUAL : https://midas-rnd.github.io/midasapi-python/ |")
13
- print("---"*22,"\n")
14
-
13
+ print('\n╭────────────────────────────────────────────────────────────────────────────────────╮')
14
+ print("HELP MANUAL : https://midas-rnd.github.io/midasapi-python/")
15
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n')
15
16
 
16
17
 
17
18
 
@@ -94,7 +95,6 @@ class MAPI_KEY:
94
95
  my_key = value[0]
95
96
  MAPI_KEY(my_key)
96
97
  print(f' 🔑 MAPI-KEY is taken from Registry entry. >> {my_key[:35]}...')
97
- print("-"*85)
98
98
  except:
99
99
  print(f"🔑 MAPI KEY is not defined. Click on Apps > API Settings to copy the MAPI Key.\n Define it using MAPI_KEY('xxxx')")
100
100
  sys.exit(0)
@@ -125,6 +125,9 @@ def MidasAPI(method:str, command:str, body:dict={})->dict:
125
125
  "MAPI-Key": mapi_key
126
126
  }
127
127
 
128
+ start_time = time.perf_counter()
129
+
130
+
128
131
  if method == "POST":
129
132
  response = requests.post(url=url, headers=headers, json=body)
130
133
  elif method == "PUT":
@@ -134,16 +137,24 @@ def MidasAPI(method:str, command:str, body:dict={})->dict:
134
137
  elif method == "DELETE":
135
138
  response = requests.delete(url=url, headers=headers)
136
139
 
137
- if response.status_code == 404:
138
- print(f"⚠️ Civil NX model is not connected. Click on 'Apps> Connect' in Civil NX. \nMake sure the MAPI Key in python code is matching with the MAPI key in Civil NX.\n\n")
139
- sys.exit(0)
140
+ end_time = time.perf_counter()
141
+ elapsed_time = end_time - start_time
140
142
 
141
143
  if NX.debug_print:
142
- print(method, command, response.status_code , "✅")
144
+ print(f"{method} | URL : {command} | STATUS : {response.status_code} | TIME : {elapsed_time:.4f} sec")
145
+
146
+
143
147
 
144
148
  if MAPI_KEY.count == 1:
149
+ MAPI_KEY.count = 0
150
+ if response.status_code == 404:
151
+ print(Fore.RED +'\n╭─ 💀 ─────────────────────────────────────────────────────────────────────────────╮')
152
+ print(f"│ Civil NX model is not connected. Click on 'Apps > Connect' in Civil NX. │")
153
+ print(f"│ Make sure the MAPI Key in python code is matching with the MAPI key in Civil NX. │")
154
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
155
+ sys.exit(0)
156
+
145
157
  if NX.user_print:
146
- MAPI_KEY.count = 0
147
158
  _checkUSER()
148
159
 
149
160
 
@@ -168,8 +179,25 @@ def _setUNIT(unitJS):
168
179
  def _checkUSER():
169
180
  try:
170
181
  resp = MidasAPI('GET','/config/ver',{})['VER']
171
- print(f"Connected to {resp['NAME']} 🟢")
172
- print(f"USER : {resp['USER']} | COMPANY : {resp['COMPANY']}")
173
- print("-"*85)
182
+
183
+ # print(f"{' '*15}Connected to {resp['NAME']}")
184
+ # print(f"{' '*15}USER : {resp['USER']} COMPANY : {resp['COMPANY']}")
185
+
186
+ ln1 = f"Connected to {resp['NAME']}"
187
+ ln2 = f"USER : {resp['USER']} COMPANY : {resp['COMPANY']}"
188
+
189
+ lg_ln1 = 63-len(ln1)
190
+ lg_ln2 = 67-len(ln2)
191
+
192
+ line1 = f"│{' '*15} {ln1} {' '*lg_ln1} 🟢 │"
193
+ line2 = f"│{' '*15} {ln2} {' '*lg_ln2}│"
194
+ print(Fore.GREEN+'\n╭─ 🔔 ──────────────────────────────────────────────────────────────────────────────╮')
195
+ print(line1)
196
+ print(line2)
197
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
198
+
199
+
200
+ # print('─'*86)
201
+
174
202
  except:
175
- print("")
203
+ pass
midas_civil/_material.py CHANGED
@@ -1620,6 +1620,10 @@ class TDMatLink:
1620
1620
  MidasAPI("DELETE","/db/TMAT")
1621
1621
  TDMatLink.mats={}
1622
1622
 
1623
+ @staticmethod
1624
+ def clear():
1625
+ TDMatLink.mats={}
1626
+
1623
1627
  @staticmethod
1624
1628
  def sync():
1625
1629
  a = TDMatLink.get()
midas_civil/_node.py CHANGED
@@ -152,6 +152,13 @@ class Node:
152
152
  Node.Grid={}
153
153
  Node.__nodeDic__ = {}
154
154
 
155
+ @staticmethod
156
+ def clear():
157
+ Node.nodes=[]
158
+ Node.ids=[]
159
+ Node.Grid={}
160
+ Node.__nodeDic__ = {}
161
+
155
162
 
156
163
 
157
164
 
@@ -135,7 +135,7 @@ class Result :
135
135
  "TABLE_NAME": tableName,
136
136
  "STYLES": {
137
137
  "FORMAT": "Fixed",
138
- "PLACE": 12
138
+ "PLACE": 5
139
139
  }
140
140
  }
141
141
  }
@@ -162,7 +162,7 @@ class Result :
162
162
 
163
163
 
164
164
 
165
- # ---------- Result TABLE ------------------------------
165
+ # ---------- Result TABLE (For ALL TABLES)------------------------------
166
166
  @staticmethod
167
167
  def ResultTable(tabletype:str,keys=[],loadcase:list=[],cs_stage=[],force_unit='KN',len_unit='M'):
168
168
  '''
@@ -177,7 +177,7 @@ class Result :
177
177
  "TABLE_TYPE": tabletype,
178
178
  "STYLES": {
179
179
  "FORMAT": "Fixed",
180
- "PLACE": 12
180
+ "PLACE": 5
181
181
  }
182
182
  }
183
183
  }
@@ -204,3 +204,57 @@ class Result :
204
204
  ss_json = MidasAPI("POST","/post/table",js_dat)
205
205
  _setUNIT(currUNIT)
206
206
  return _JSToDF_ResTable(ss_json)
207
+
208
+
209
+ class TABLE :
210
+ @staticmethod
211
+ def BeamForce_VBM(keys=[],loadcase:list=[],items=['all'],parts=["PartI", "PartJ"],components=['all'],force_unit='KN',len_unit='M'):
212
+ '''
213
+ Keys : List{int} -> Element/ Node IDs | str -> Structure Group Name
214
+ Loadcase : Loadcase name followed by type. eg. DeadLoad(ST)
215
+ Items to display : [ "Axial" , "Shear-y" , "Shear-z" , "Torsion" , "Moment-y" , "Moment-z"]
216
+ Parts : ["PartI", "Part1/4", "Part2/4", "Part3/4", "PartJ"]
217
+ Components (colms of tabulart result): [ "Elem", "Load", "Part", "Component", "Axial", "Shear-y", "Shear-z", "Torsion", "Moment-y", "Moment-z" ]
218
+
219
+ '''
220
+
221
+ js_dat = {
222
+ "Argument": {
223
+ "TABLE_NAME": "SS_Table",
224
+ "TABLE_TYPE": "BEAMFORCEVBM",
225
+ "STYLES": {
226
+ "FORMAT": "Fixed",
227
+ "PLACE": 5
228
+ },
229
+ "PARTS" : parts
230
+ }
231
+ }
232
+
233
+
234
+ if isinstance(keys,list):
235
+ if keys!=[]:
236
+ js_dat["Argument"]['NODE_ELEMS'] = {"KEYS": keys}
237
+ elif isinstance(keys,str):
238
+ js_dat["Argument"]['NODE_ELEMS'] = {"STRUCTURE_GROUP_NAME": keys}
239
+
240
+
241
+ if loadcase!=[]: js_dat["Argument"]['LOAD_CASE_NAMES'] = loadcase
242
+
243
+ if components!=['all']:
244
+ if "Elem" not in components: components.append("Elem")
245
+ if "Load" not in components: components.append("Load")
246
+ if "Part" not in components: components.append("Part")
247
+ if "Component" not in components: components.append("Component")
248
+ js_dat["Argument"]['COMPONENTS'] = components
249
+
250
+ if items!=['all']:
251
+ js_dat["Argument"]['ITEM_TO_DISPLAY'] = items
252
+
253
+
254
+
255
+ currUNIT = _getUNIT()
256
+ Model.units(force=force_unit,length=len_unit)
257
+ ss_json = MidasAPI("POST","/post/table",js_dat)
258
+ _setUNIT(currUNIT)
259
+ return _JSToDF_ResTable(ss_json)
260
+
@@ -1,5 +1,6 @@
1
1
  from ._offsetSS import Offset
2
2
  from ._offsetSS import _common
3
+ import math
3
4
 
4
5
  class _SS_TAPERED_DBUSER(_common):
5
6
 
@@ -44,4 +45,131 @@ class _SS_TAPERED_DBUSER(_common):
44
45
 
45
46
  @staticmethod
46
47
  def _objectify(id,name,type,shape,offset,uShear,u7DOF,js):
47
- return _SS_TAPERED_DBUSER(name,shape,js['SECT_BEFORE']['SECT_I']['vSIZE'],js['SECT_BEFORE']['SECT_J']['vSIZE'],offset,uShear,u7DOF,id)
48
+ return _SS_TAPERED_DBUSER(name,shape,js['SECT_BEFORE']['SECT_I']['vSIZE'],js['SECT_BEFORE']['SECT_J']['vSIZE'],offset,uShear,u7DOF,id)
49
+
50
+ def _centerLine(shape,end):
51
+ if end:
52
+ shape.PARAMS = shape.PARAMS_J
53
+ # print(' J end taken')
54
+ else:
55
+ # print(' I end taken')
56
+ shape.PARAMS = shape.PARAMS_I
57
+
58
+ if shape.SHAPE == 'SB' :
59
+ H,B = shape.PARAMS[:2]
60
+
61
+ sect_lin_con = [[1,2],[3,1]]
62
+
63
+ sect_cg_LT = [-B/2,H/2]
64
+ sect_cg_CC = [0,0]
65
+ sect_cg_RB = [B/2,-H/2]
66
+
67
+ if H > B :
68
+ sect_shape = [[0,0],[0,H/2],[0,-H/2],[0,H/4],[0,-H/4]]
69
+ sect_thk = [B,B,B,B]
70
+ sect_thk_off = [0,0,0,0]
71
+ else :
72
+ sect_shape = [[0,0],[B/2,0],[-B/2,0],[B/4,0],[-B/4,0]]
73
+ sect_thk = [H,H,H,H]
74
+ sect_thk_off = [0,0,0,0]
75
+
76
+ elif shape.SHAPE == 'L' :
77
+ H,B,tw,tf = shape.PARAMS[:4]
78
+
79
+ sect_cg_LT = [0,0]
80
+ sect_cg_CC = [(H*tw*tw+B*B*tf)/(2*(B*tw+H*tf)),-(H*H*tw+B*tf*tf)/(2*(B*tw+H*tf))]
81
+ sect_cg_RB = [B,-H]
82
+
83
+ # sect_shape = [[0.5*tw,-H],[0.5*tw,-0.5*tf],[B,-0.5*tf]]
84
+ sect_shape = [[0,-H],[0,0],[B,0]]
85
+ sect_lin_con = [[3,2],[2,1]]
86
+ sect_thk = [tw,tf]
87
+ # sect_thk_off = [0,0]
88
+ sect_thk_off = [tw/2,tf/2]
89
+
90
+ elif shape.SHAPE == 'C' :
91
+ H,B1,tw,tf1,B2,tf2 = shape.PARAMS[:6]
92
+ if B2 == 0 : B2 = B1
93
+ if tf2 == 0 : tf2 = tf1
94
+
95
+ sect_cg_LT = [0,0]
96
+ sect_cg_CC = [(B1+B2)*0.2,-H*0.5]
97
+ sect_cg_RB = [max(B1,B2),-H]
98
+
99
+ # sect_shape = [[0.5*tw,-0.5*tf1],[B1,-0.5*tf1],[0.5*tw,-H+0.5*tf2],[B2,-H+0.5*tf2]]
100
+ sect_shape = [[0,0],[B1,0],[0,-H],[B2,-H]]
101
+ sect_lin_con = [[2,1],[1,3],[3,4]]
102
+ sect_thk = [tf1,tw,tf2]
103
+ # sect_thk_off = [0,0,0]
104
+ sect_thk_off = [tf1/2,tw/2,tf2/2]
105
+
106
+ elif shape.SHAPE == 'H' :
107
+ H,B1,tw,tf1,B2,tf2,r1,r2 = shape.PARAMS[:8]
108
+ if B2 == 0 : B2 = B1
109
+ if tf2 == 0 : tf2 = tf1
110
+
111
+ sect_cg_LT = [-0.5*max(B1,B2),0.5*H]
112
+ sect_cg_CC = [0,0]
113
+ sect_cg_RB = [0.5*max(B1,B2),-0.5*H]
114
+
115
+ sect_shape = [[-0.5*B1,0.5*(H-tf1)],[0,0.5*(H-tf1)],[0.5*B1,0.5*(H-tf1)],[-0.5*B2,-0.5*(H-tf2)],[0,-0.5*(H-tf2)],[0.5*B2,-0.5*(H-tf2)]]
116
+ sect_lin_con = [[2,1],[3,2],[2,5],[4,5],[5,6]]
117
+ sect_thk = [tf1,tf1,tw,tf2,tf2]
118
+ sect_thk_off = [0,0,0,0,0]
119
+
120
+ elif shape.SHAPE == 'T' :
121
+ H,B,tw,tf = shape.PARAMS[:4]
122
+
123
+ sect_cg_LT = [-B*0.5,0]
124
+ sect_cg_CC = [0,-H*0.3]
125
+ sect_cg_RB = [B*0.5,-H]
126
+
127
+ sect_shape = [[-0.5*B,-0.5*tf],[0,-0.5*tf],[0.5*B,-0.5*tf],[0,-H]]
128
+ sect_lin_con = [[2,1],[3,2],[2,4]]
129
+ sect_thk = [tf,tf,tw]
130
+ sect_thk_off = [0,0,0]
131
+
132
+ elif shape.SHAPE == 'B' :
133
+ H,B,tw,tf1,C,tf2 = shape.PARAMS[:6]
134
+ if tf2 == 0 : tf2 = tf1
135
+
136
+ sect_cg_LT = [-0.5*B,0.5*H]
137
+ sect_cg_CC = [0,0]
138
+ sect_cg_RB = [0.5*B,-0.5*H]
139
+
140
+ # sect_shape = [[0.5*(B-tw),0.5*(H-tf1)],[-0.5*(B-tw),0.5*(H-tf1)],[-0.5*(B-tw),-0.5*(H-tf2)],[0.5*(B-tw),-0.5*(H-tf2)]]
141
+ sect_shape = [[0.5*B,0.5*H],[-0.5*B,0.5*H],[-0.5*B,-0.5*H],[0.5*B,-0.5*H]]
142
+
143
+ sect_lin_con = [[1,2],[2,3],[3,4],[4,1]]
144
+ sect_thk = [tf1,tw,tf2,tw]
145
+ # sect_thk_off = [0,0,0,0]
146
+ sect_thk_off = [0.5*tf1,0.5*tw,0.5*tf2,0.5*tw]
147
+
148
+ elif shape.SHAPE == 'P' :
149
+ D,tw = shape.PARAMS[:2]
150
+
151
+ # R = 0.5*(D-tw)
152
+ R = 0.5*D
153
+
154
+ sect_cg_LT = [-R,R]
155
+ sect_cg_CC = [0,0]
156
+ sect_cg_RB = [R,-R]
157
+
158
+ sect_shape = []
159
+ sect_lin_con = []
160
+ sect_thk = []
161
+ sect_thk_off = []
162
+
163
+ n = 16
164
+ for i in range(n):
165
+ sect_shape.append([R*math.sin(i*2*math.pi/n),R*math.cos(i*2*math.pi/n)])
166
+ sect_lin_con.append([i+1,i+2])
167
+ sect_thk.append(tw)
168
+ sect_thk_off.append(-0.5*tw)
169
+ sect_lin_con[-1] = [i+1,1]
170
+
171
+
172
+
173
+ sect_cg = (sect_cg_LT,sect_cg_CC,sect_cg_RB)
174
+
175
+ return sect_shape, sect_thk ,sect_thk_off, sect_cg , sect_lin_con
@@ -1,5 +1,6 @@
1
1
  from ._offsetSS import Offset
2
2
  from ._offsetSS import _common
3
+ import math
3
4
 
4
5
  class _SS_DBUSER(_common):
5
6
 
@@ -42,16 +43,122 @@ class _SS_DBUSER(_common):
42
43
  def _objectify(id,name,type,shape,offset,uShear,u7DOF,js):
43
44
  return _SS_DBUSER(name,shape,js['SECT_BEFORE']['SECT_I']['vSIZE'],offset,uShear,u7DOF,id)
44
45
 
45
- def _centerLine(shape):
46
- H = shape.PARAMS[0]
47
- B = shape.PARAMS[1]
48
- tw = shape.PARAMS[2]
49
- tf = shape.PARAMS[3]
46
+ def _centerLine(shape,end):
47
+ if shape.SHAPE == 'SB' :
48
+ H,B = shape.PARAMS[:2]
50
49
 
51
- sect_lin_con = [[1,2],[3,1]]
50
+ sect_lin_con = [[1,2],[3,1]]
52
51
 
53
- sect_cg = [0,0]
52
+ sect_cg_LT = [-B/2,H/2]
53
+ sect_cg_CC = [0,0]
54
+ sect_cg_RB = [B/2,-H/2]
54
55
 
55
- sect_shape = [[0,0],[B,0],[0,-H]]
56
- sect_thk = [tf,tw]
57
- sect_thk_off = [-tf/2,-tw/2]
56
+ if H > B :
57
+ sect_shape = [[0,0],[0,H/2],[0,-H/2],[0,H/4],[0,-H/4]]
58
+ sect_thk = [B,B,B,B]
59
+ sect_thk_off = [0,0,0,0]
60
+ else :
61
+ sect_shape = [[0,0],[B/2,0],[-B/2,0],[B/4,0],[-B/4,0]]
62
+ sect_thk = [H,H,H,H]
63
+ sect_thk_off = [0,0,0,0]
64
+
65
+ elif shape.SHAPE == 'L' :
66
+ H,B,tw,tf = shape.PARAMS[:4]
67
+
68
+ sect_cg_LT = [0,0]
69
+ sect_cg_CC = [(H*tw*tw+B*B*tf)/(2*(B*tw+H*tf)),-(H*H*tw+B*tf*tf)/(2*(B*tw+H*tf))]
70
+ sect_cg_RB = [B,-H]
71
+
72
+ # sect_shape = [[0.5*tw,-H],[0.5*tw,-0.5*tf],[B,-0.5*tf]]
73
+ sect_shape = [[0,-H],[0,0],[B,0]]
74
+ sect_lin_con = [[3,2],[2,1]]
75
+ sect_thk = [tw,tf]
76
+ # sect_thk_off = [0,0]
77
+ sect_thk_off = [tw/2,tf/2]
78
+
79
+ elif shape.SHAPE == 'C' :
80
+ H,B1,tw,tf1,B2,tf2 = shape.PARAMS[:6]
81
+ if B2 == 0 : B2 = B1
82
+ if tf2 == 0 : tf2 = tf1
83
+
84
+ sect_cg_LT = [0,0]
85
+ sect_cg_CC = [(B1+B2)*0.2,-H*0.5]
86
+ sect_cg_RB = [max(B1,B2),-H]
87
+
88
+ # sect_shape = [[0.5*tw,-0.5*tf1],[B1,-0.5*tf1],[0.5*tw,-H+0.5*tf2],[B2,-H+0.5*tf2]]
89
+ sect_shape = [[0,0],[B1,0],[0,-H],[B2,-H]]
90
+ sect_lin_con = [[2,1],[1,3],[3,4]]
91
+ sect_thk = [tf1,tw,tf2]
92
+ # sect_thk_off = [0,0,0]
93
+ sect_thk_off = [tf1/2,tw/2,tf2/2]
94
+
95
+ elif shape.SHAPE == 'H' :
96
+ H,B1,tw,tf1,B2,tf2,r1,r2 = shape.PARAMS[:8]
97
+ if B2 == 0 : B2 = B1
98
+ if tf2 == 0 : tf2 = tf1
99
+
100
+ sect_cg_LT = [-0.5*max(B1,B2),0.5*H]
101
+ sect_cg_CC = [0,0]
102
+ sect_cg_RB = [0.5*max(B1,B2),-0.5*H]
103
+
104
+ sect_shape = [[-0.5*B1,0.5*(H-tf1)],[0,0.5*(H-tf1)],[0.5*B1,0.5*(H-tf1)],[-0.5*B2,-0.5*(H-tf2)],[0,-0.5*(H-tf2)],[0.5*B2,-0.5*(H-tf2)]]
105
+ sect_lin_con = [[2,1],[3,2],[2,5],[4,5],[5,6]]
106
+ sect_thk = [tf1,tf1,tw,tf2,tf2]
107
+ sect_thk_off = [0,0,0,0,0]
108
+
109
+ elif shape.SHAPE == 'T' :
110
+ H,B,tw,tf = shape.PARAMS[:4]
111
+
112
+ sect_cg_LT = [-B*0.5,0]
113
+ sect_cg_CC = [0,-H*0.3]
114
+ sect_cg_RB = [B*0.5,-H]
115
+
116
+ sect_shape = [[-0.5*B,-0.5*tf],[0,-0.5*tf],[0.5*B,-0.5*tf],[0,-H]]
117
+ sect_lin_con = [[2,1],[3,2],[2,4]]
118
+ sect_thk = [tf,tf,tw]
119
+ sect_thk_off = [0,0,0]
120
+
121
+ elif shape.SHAPE == 'B' :
122
+ H,B,tw,tf1,C,tf2 = shape.PARAMS[:6]
123
+ if tf2 == 0 : tf2 = tf1
124
+
125
+ sect_cg_LT = [-0.5*B,0.5*H]
126
+ sect_cg_CC = [0,0]
127
+ sect_cg_RB = [0.5*B,-0.5*H]
128
+
129
+ # sect_shape = [[0.5*(B-tw),0.5*(H-tf1)],[-0.5*(B-tw),0.5*(H-tf1)],[-0.5*(B-tw),-0.5*(H-tf2)],[0.5*(B-tw),-0.5*(H-tf2)]]
130
+ sect_shape = [[0.5*B,0.5*H],[-0.5*B,0.5*H],[-0.5*B,-0.5*H],[0.5*B,-0.5*H]]
131
+
132
+ sect_lin_con = [[1,2],[2,3],[3,4],[4,1]]
133
+ sect_thk = [tf1,tw,tf2,tw]
134
+ # sect_thk_off = [0,0,0,0]
135
+ sect_thk_off = [0.5*tf1,0.5*tw,0.5*tf2,0.5*tw]
136
+
137
+ elif shape.SHAPE == 'P' :
138
+ D,tw = shape.PARAMS[:2]
139
+
140
+ # R = 0.5*(D-tw)
141
+ R = 0.5*D
142
+
143
+ sect_cg_LT = [-R,R]
144
+ sect_cg_CC = [0,0]
145
+ sect_cg_RB = [R,-R]
146
+
147
+ sect_shape = []
148
+ sect_lin_con = []
149
+ sect_thk = []
150
+ sect_thk_off = []
151
+
152
+ n = 16
153
+ for i in range(n):
154
+ sect_shape.append([R*math.sin(i*2*math.pi/n),R*math.cos(i*2*math.pi/n)])
155
+ sect_lin_con.append([i+1,i+2])
156
+ sect_thk.append(tw)
157
+ sect_thk_off.append(-0.5*tw)
158
+ sect_lin_con[-1] = [i+1,1]
159
+
160
+
161
+
162
+ sect_cg = (sect_cg_LT,sect_cg_CC,sect_cg_RB)
163
+
164
+ return sect_shape, sect_thk ,sect_thk_off, sect_cg , sect_lin_con
@@ -1,5 +1,6 @@
1
1
  from ._offsetSS import Offset
2
2
  from ._offsetSS import _common
3
+ import math
3
4
 
4
5
 
5
6
 
@@ -114,6 +115,35 @@ class _SS_PSC_12CELL(_common):
114
115
  vD[0],vD[1],vD[2],vD[3],vD[4],vD[5],vD[6],vD[7],
115
116
  offset,uShear,u7DOF,id)
116
117
 
118
+ def _centerLine(shape,end):
119
+ if shape.SHAPE == '1CEL':
120
+ BO1 = shape.BO1
121
+ BO2 = shape.BO2
122
+ BO3 = shape.BO3
123
+ HO1 = shape.HO1
124
+ HO2 = shape.HO2
125
+ HO3 = shape.HO3
126
+ HI1 = shape.HI1
127
+ HI5 = shape.HI5
128
+ BI3 = shape.BI3
129
+
130
+ sect_lin_con = [[1,2],[2,3],[3,4],[2,5],[3,6],[5,6]]
131
+
132
+ sect_cg_LT = [0,0]
133
+ sect_cg_RB = [2*(BO1+BO2+BO3),-(HO1+HO2+HO3)]
134
+ sect_cg_CC = [(BO1+BO2+BO3),-(HO1+HO2+HO3)/2]
135
+
136
+ sect_shape = [[0,0],[BO1,0],[BO1+2*(BO2+BO3),0],[2*(BO1+BO2+BO3),0],[BO1+BO2,-HO1-HO3-HO2],[BO1+BO2+2*BO3,-HO1-HO3-HO2]]
137
+ sect_thk = [HO1,HI1,HO1,BO3-BI3,BO3-BI3,HI5]
138
+ sect_thk_off = [-HO1/2,-HI1/2,-HO1/2,(BO3-BI3)/2,-(BO3-BI3)/2,HI5/2]
139
+
140
+
141
+
142
+ sect_cg = (sect_cg_LT,sect_cg_CC,sect_cg_RB)
143
+
144
+ return sect_shape, sect_thk ,sect_thk_off, sect_cg , sect_lin_con
145
+
146
+
117
147
 
118
148
 
119
149
 
midas_civil/_tendon.py CHANGED
@@ -761,7 +761,7 @@ class Tendon:
761
761
  array_temp.append({
762
762
  'PT' : [self.P_XYZ[j].X,self.P_XYZ[j].Y,self.P_XYZ[j].Z],
763
763
  'bFIX' : self.bFIX[j],
764
- 'R' : self.RADIUS[j]
764
+ 'RADIUS' : self.RADIUS[j]
765
765
  })
766
766
  else:
767
767
  for j in range(len(self.P_XYZ)):
@@ -772,6 +772,8 @@ class Tendon:
772
772
  })
773
773
 
774
774
 
775
+
776
+
775
777
  # --- 3D Main ----
776
778
 
777
779
  json_prof = {
midas_civil/_thickness.py CHANGED
@@ -127,6 +127,11 @@ class Thickness(_common):
127
127
  Thickness.thick=[]
128
128
  Thickness.ids=[]
129
129
 
130
+ @staticmethod
131
+ def clear():
132
+ Thickness.thick=[]
133
+ Thickness.ids=[]
134
+
130
135
 
131
136
  @staticmethod
132
137
  def sync():
midas_civil/_utils.py CHANGED
@@ -86,4 +86,12 @@ def zz_add_to_dict(dictionary, key, value):
86
86
  def _convItem2List(item):
87
87
  if isinstance(item,list):
88
88
  return item
89
- return [item]
89
+ return [item]
90
+
91
+ def _matchArray(A,B):
92
+ A = _convItem2List(A)
93
+ B = _convItem2List(B)
94
+ n = len(A)
95
+ if len(B) >= n:
96
+ return B[:n]
97
+ return B + [B[-1]] * (n - len(B))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: midas_civil
3
- Version: 1.0.8
3
+ Version: 1.1.0
4
4
  Summary: Python library for MIDAS Civil NX
5
5
  Home-page: https://github.com/MIDASIT-Co-Ltd/midas-civil-python
6
6
  Author: Sumit Shekhar
@@ -14,6 +14,7 @@ Requires-Dist: polars
14
14
  Requires-Dist: xlsxwriter
15
15
  Requires-Dist: requests
16
16
  Requires-Dist: scipy
17
+ Requires-Dist: colorama
17
18
  Dynamic: author
18
19
  Dynamic: author-email
19
20
  Dynamic: description
@@ -1,36 +1,36 @@
1
1
  midas_civil/_BoundaryChangeAssignment.py,sha256=8lQC0DZ8zAXuPfchBdhqUaLZhZMog51EffQcKeayrlc,9511
2
- midas_civil/__init__.py,sha256=T0NwsEmr2c1166UlxbogGhDfBzvRGbTIU9XX9c6h-_E,1156
2
+ midas_civil/__init__.py,sha256=BTE7nEPN7fTfwk686EuvD7mBxvyxf0MrEITZt7zDqu0,2328
3
3
  midas_civil/_analysiscontrol.py,sha256=r2zp7fdC_m-WfO7KSXU4SzVjOgLWg4Wm0djl7X1ioZo,24456
4
4
  midas_civil/_boundary.py,sha256=s5mgZIc1b0-P7AdWuaPAQ5cIbHL5CR1YRKJA7KE4W_U,32958
5
5
  midas_civil/_construction.py,sha256=q9C3gGdvky5t7jCDzd6lBRv6pm8cMycI91xfkgDV37Y,40673
6
6
  midas_civil/_construction_backup.py,sha256=Pj7V-NYCkkT-aMjKXfs1jKa9klsGh48UXDLwn3BLYTY,18225
7
- midas_civil/_element.py,sha256=1GcI-9PcRdfvHvtXs2tdMNRvvxyQ7A78Lk8rAp5gGOw,34795
7
+ midas_civil/_element.py,sha256=o6gJcOAKsoUA77uNDFNGUrmMV6DSz1SKP5g2MbtMui4,36212
8
8
  midas_civil/_group.py,sha256=ul0gPtAhfuc9HPQkVw2dfV0jqCLvnTbxAlx6hEBUmyI,9882
9
9
  midas_civil/_load.py,sha256=twsfqofTzbnMHXShfMRSP61ll7CTBA5qos33od7nQ9E,30170
10
- midas_civil/_mapi.py,sha256=UMGuzuNE7uTjR6YwPsbfI5xHSoFESVY2U0NM5mfgcW8,5486
11
- midas_civil/_material.py,sha256=uJEIHJM9OhwTRWUI2mtd_0BQSxdlYhATYJu9P7tNNBA,69511
10
+ midas_civil/_mapi.py,sha256=b-leROZA9Ii-sSawBrBPgGS6ow5JXzEYGh5DvkXAOI8,7749
11
+ midas_civil/_material.py,sha256=x96yHu96X3wE9KF7dW2vzbFg9_58CMQ6Gk8maBfLzNM,69573
12
12
  midas_civil/_model.py,sha256=huUlmIZVsBbThszrEIhvb9owOSmdggylXaJeK4g7lxY,16735
13
13
  midas_civil/_movingload.py,sha256=a1i5fNc7oCmWTjVXbyBEYzDr5BO7NTXPVCKgvjzxuX4,80000
14
- midas_civil/_node.py,sha256=3iVj5Hs7DJPbfgM_hIazP-Y1szu3j3ofuh_ftUxoLcY,8827
14
+ midas_civil/_node.py,sha256=qcBar89tEvHfziEvEvreJT8DjJ152CryIETHNKdqr2o,8956
15
15
  midas_civil/_result copy.py,sha256=siTMENLIwF_6rvydSjP9aQAWaIlt0pReiqNyDhDevGk,24290
16
16
  midas_civil/_result.py,sha256=nzXY2lh_342M45TMq2hBYwSp41_wAHyGFSfvt9h2vXc,7638
17
- midas_civil/_result_extract.py,sha256=QVo1DJmlkTJ20-FwqgguH70bVrwHbx7TfPFENYfCUbE,5706
17
+ midas_civil/_result_extract.py,sha256=IJLnlzIKOP8yxaLCXqOuRKiYUYMQfzj37fTCBs0iuTM,7884
18
18
  midas_civil/_settlement.py,sha256=0ZkKutTjQ7Wg47ohfrc6SgoZY1xyP9_ylGQlCVBH-2U,5124
19
19
  midas_civil/_temperature.py,sha256=Sr5fRgUHzMx6tfr1E0Nw7ZLYKUmzoH1h6Sl-APqFkHo,24208
20
- midas_civil/_tendon.py,sha256=pUtR-74c1GcJyJt6Te38TAlBBOZJtlkERb9Ijf5CkH0,33417
21
- midas_civil/_thickness.py,sha256=yyFkMCaxcwRsqYJcRAxWqnt59fdqzX4Mqkjz23waw-A,3247
22
- midas_civil/_utils.py,sha256=c_NgCmqtoWP7jv4RoK7oGyF9edDo_UlJYR-p54h572U,2711
20
+ midas_civil/_tendon.py,sha256=oNeT0e5VIWIDhhUfxdf2KQKXdiCkbN7fWjVYjPzs7mg,33464
21
+ midas_civil/_thickness.py,sha256=rKbU0QKkL9AeFnE-MNVY9ZwwQ-u2Ea-Rq9TeNafsvWQ,3335
22
+ midas_civil/_utils.py,sha256=nTF6btow2TK4mufyKupbjwagjlYp5WVRJmfchYAUdMk,2881
23
23
  midas_civil/_view.py,sha256=o7rkfoQzmgAb3dT0ujPIQLVwVlveo3rMRIbZU1UosZo,849
24
- midas_civil/_section/_TapdbSecSS.py,sha256=ANHBwzegppGmUlm7spEBNDHfdJfTbWX7Q-pvn-Th1tA,1649
24
+ midas_civil/_section/_TapdbSecSS.py,sha256=biwt38Twlmb6DuueZG_KbuMCIv1Sq3TAl4ay-30LnRU,5933
25
25
  midas_civil/_section/__init__.py,sha256=subwWGtIRFfz19i2mtLPuQbViFAR8-xZY7eHLBGUWO4,15250
26
26
  midas_civil/_section/_compositeSS.py,sha256=mrHOkjHkbuVOLAd1dGEiLruyqmye_mv9H99UJIdWdiQ,9942
27
- midas_civil/_section/_dbSecSS.py,sha256=Dupfs4un0mwJbreqrUPw7iEstbdFiMiQYXVQtam-5k0,1763
27
+ midas_civil/_section/_dbSecSS.py,sha256=GmVm8gxsLxnDsmJsl73koHYn1GRHVo_KDOoijz_j4_o,5541
28
28
  midas_civil/_section/_offsetSS.py,sha256=kHjwp_PCeBKWqYKoQCy0s4d8O5Gb0Vk6e1MWMOGxql4,1377
29
- midas_civil/_section/_pscSS.py,sha256=PnXR5lJNKYtp8MyFddJlW45CYCRSG6SpA-zojDl4DnE,14254
29
+ midas_civil/_section/_pscSS.py,sha256=aTgFxN0WzT6fBdtPgUicBByFq6KyLMmzoyBD-eVUop8,15214
30
30
  midas_civil/_section/_tapPSC1CellSS.py,sha256=bjpuOgIot2yQd2zirE6vVmVlgfco1f83RlI7DwIicdU,6700
31
31
  midas_civil/_section/_unSupp.py,sha256=46A_a5CzDpQM7bqglkFzIvq6VG7Lj9J6qflY3nwZlqI,1674
32
- midas_civil-1.0.8.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
33
- midas_civil-1.0.8.dist-info/METADATA,sha256=BW2J0aNKOVhFN8yglhcnfnMj8smztMrx4xbSwEzN6Po,2085
34
- midas_civil-1.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- midas_civil-1.0.8.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
36
- midas_civil-1.0.8.dist-info/RECORD,,
32
+ midas_civil-1.1.0.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
33
+ midas_civil-1.1.0.dist-info/METADATA,sha256=YX6pmfkhA9Og-0Kszbc6S6qnP9H8kIJBWY7kg5XzZck,2109
34
+ midas_civil-1.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ midas_civil-1.1.0.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
36
+ midas_civil-1.1.0.dist-info/RECORD,,