midas-civil 1.0.8__tar.gz → 1.0.9__tar.gz

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.

Files changed (42) hide show
  1. {midas_civil-1.0.8 → midas_civil-1.0.9}/PKG-INFO +1 -1
  2. midas_civil-1.0.9/midas_civil/__init__.py +48 -0
  3. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_element.py +47 -13
  4. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_mapi.py +35 -14
  5. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_tendon.py +3 -1
  6. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_utils.py +9 -1
  7. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil.egg-info/PKG-INFO +1 -1
  8. {midas_civil-1.0.8 → midas_civil-1.0.9}/setup.py +1 -1
  9. midas_civil-1.0.8/midas_civil/__init__.py +0 -49
  10. {midas_civil-1.0.8 → midas_civil-1.0.9}/LICENSE +0 -0
  11. {midas_civil-1.0.8 → midas_civil-1.0.9}/README.md +0 -0
  12. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_BoundaryChangeAssignment.py +0 -0
  13. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_analysiscontrol.py +0 -0
  14. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_boundary.py +0 -0
  15. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_construction.py +0 -0
  16. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_construction_backup.py +0 -0
  17. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_group.py +0 -0
  18. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_load.py +0 -0
  19. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_material.py +0 -0
  20. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_model.py +0 -0
  21. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_movingload.py +0 -0
  22. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_node.py +0 -0
  23. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_result copy.py +0 -0
  24. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_result.py +0 -0
  25. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_result_extract.py +0 -0
  26. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_section/_TapdbSecSS.py +0 -0
  27. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_section/__init__.py +0 -0
  28. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_section/_compositeSS.py +0 -0
  29. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_section/_dbSecSS.py +0 -0
  30. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_section/_offsetSS.py +0 -0
  31. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_section/_pscSS.py +0 -0
  32. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_section/_tapPSC1CellSS.py +0 -0
  33. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_section/_unSupp.py +0 -0
  34. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_settlement.py +0 -0
  35. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_temperature.py +0 -0
  36. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_thickness.py +0 -0
  37. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil/_view.py +0 -0
  38. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil.egg-info/SOURCES.txt +0 -0
  39. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil.egg-info/dependency_links.txt +0 -0
  40. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil.egg-info/requires.txt +0 -0
  41. {midas_civil-1.0.8 → midas_civil-1.0.9}/midas_civil.egg-info/top_level.txt +0 -0
  42. {midas_civil-1.0.8 → midas_civil-1.0.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: midas_civil
3
- Version: 1.0.8
3
+ Version: 1.0.9
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
@@ -0,0 +1,48 @@
1
+ import requests
2
+ from colorama import Fore,Style
3
+ from ._mapi import *
4
+ _version_ = "1.0.9"
5
+
6
+
7
+ print('\n╭────────────────────────────────────────────────────────────────────────────────────╮')
8
+ print(Style.BRIGHT+f'│ MIDAS CIVIL-NX PYTHON LIBRARY v{_version_} 🐍 │')
9
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
10
+
11
+ if NX.version_check:
12
+ resp = requests.get("https://pypi.org/pypi/midas_civil/json").json()
13
+ latest_ver = resp["info"]["version"]
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)
19
+
20
+
21
+ from ._model import *
22
+ from ._boundary import *
23
+ from ._utils import *
24
+ from ._node import *
25
+ from ._element import *
26
+ from ._load import *
27
+ from ._group import *
28
+ from ._result import *
29
+
30
+ #--- TESTING IMPORTS ---
31
+ from ._material import *
32
+
33
+ # from ._section import *
34
+ from ._section import *
35
+
36
+ from ._result_extract import *
37
+ from ._construction import *
38
+ from ._thickness import *
39
+ from ._temperature import *
40
+
41
+ from ._tendon import *
42
+ from ._view import *
43
+
44
+ from ._movingload import *
45
+ from ._settlement import *
46
+ from ._analysiscontrol import *
47
+ from ._BoundaryChangeAssignment import*
48
+
@@ -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
 
@@ -440,6 +463,10 @@ class Element:
440
463
  i_loc = points_loc
441
464
  else:
442
465
  i_loc = _interpolateAlignment(points_loc,n_div,deg,0,includePoint)
466
+
467
+ from ._utils import _matchArray
468
+ angle = _matchArray(i_loc,angle)
469
+
443
470
  for i in i_loc:
444
471
  Enode=Node(i[0],i[1],i[2])
445
472
  beam_nodes.append(Enode.ID)
@@ -447,29 +474,36 @@ class Element:
447
474
  for i in range(len(i_loc)-1):
448
475
  if id == 0 : id_new = 0
449
476
  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))
477
+ beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle[i],group,id_new,bLocalAxis))
451
478
 
452
479
  return beam_obj
453
480
 
454
481
  @staticmethod
455
482
  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
-
483
+
484
+
457
485
  beam_nodes =[]
458
486
  beam_obj = []
459
487
  if n_div == 0 :
460
488
  i_loc = points_loc
461
489
  else:
462
- i_loc = _interpolateAlignment(points_loc,n_div,deg,0,includePoint,yEcc,zEcc)
490
+ i_loc = _interpolateAlignment(points_loc,n_div,deg,0,includePoint)
491
+
492
+ from ._utils import _matchArray
493
+ angle = _matchArray(i_loc,angle)
463
494
 
464
- i_loc2 = _pointOffset(i_loc,yEcc,zEcc)
495
+ i_loc2 = _pointOffset(i_loc,yEcc,zEcc,angle)
465
496
  for i in i_loc2:
466
497
  Enode=Node(i[0],i[1],i[2])
467
498
  beam_nodes.append(Enode.ID)
499
+
500
+
468
501
 
502
+
469
503
  for i in range(len(i_loc2)-1):
470
504
  if id == 0 : id_new = 0
471
505
  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))
506
+ beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle[i],group,id_new,bLocalAxis))
473
507
 
474
508
  return beam_obj
475
509
 
@@ -1,5 +1,6 @@
1
1
  import requests
2
2
  import sys
3
+ from colorama import Fore, Style
3
4
  try:import winreg
4
5
  except: pass
5
6
 
@@ -8,10 +9,9 @@ except: pass
8
9
 
9
10
  def Midas_help():
10
11
  """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
-
12
+ print('\n╭────────────────────────────────────────────────────────────────────────────────────╮')
13
+ print("HELP MANUAL : https://midas-rnd.github.io/midasapi-python/")
14
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n')
15
15
 
16
16
 
17
17
 
@@ -94,7 +94,6 @@ class MAPI_KEY:
94
94
  my_key = value[0]
95
95
  MAPI_KEY(my_key)
96
96
  print(f' 🔑 MAPI-KEY is taken from Registry entry. >> {my_key[:35]}...')
97
- print("-"*85)
98
97
  except:
99
98
  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
99
  sys.exit(0)
@@ -134,16 +133,21 @@ def MidasAPI(method:str, command:str, body:dict={})->dict:
134
133
  elif method == "DELETE":
135
134
  response = requests.delete(url=url, headers=headers)
136
135
 
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
-
141
136
  if NX.debug_print:
142
137
  print(method, command, response.status_code , "✅")
143
138
 
139
+
140
+
144
141
  if MAPI_KEY.count == 1:
142
+ MAPI_KEY.count = 0
143
+ if response.status_code == 404:
144
+ print(Fore.RED +'\n╭─ 💀 ─────────────────────────────────────────────────────────────────────────────╮')
145
+ print(f"│ Civil NX model is not connected. Click on 'Apps > Connect' in Civil NX. │")
146
+ print(f"│ Make sure the MAPI Key in python code is matching with the MAPI key in Civil NX. │")
147
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
148
+ sys.exit(0)
149
+
145
150
  if NX.user_print:
146
- MAPI_KEY.count = 0
147
151
  _checkUSER()
148
152
 
149
153
 
@@ -168,8 +172,25 @@ def _setUNIT(unitJS):
168
172
  def _checkUSER():
169
173
  try:
170
174
  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)
175
+
176
+ # print(f"{' '*15}Connected to {resp['NAME']}")
177
+ # print(f"{' '*15}USER : {resp['USER']} COMPANY : {resp['COMPANY']}")
178
+
179
+ ln1 = f"Connected to {resp['NAME']}"
180
+ ln2 = f"USER : {resp['USER']} COMPANY : {resp['COMPANY']}"
181
+
182
+ lg_ln1 = 63-len(ln1)
183
+ lg_ln2 = 67-len(ln2)
184
+
185
+ line1 = f"│{' '*15} {ln1} {' '*lg_ln1} 🟢 │"
186
+ line2 = f"│{' '*15} {ln2} {' '*lg_ln2}│"
187
+ print(Fore.GREEN+'\n╭─ 🔔 ──────────────────────────────────────────────────────────────────────────────╮')
188
+ print(line1)
189
+ print(line2)
190
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
191
+
192
+
193
+ # print('─'*86)
194
+
174
195
  except:
175
- print("")
196
+ pass
@@ -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 = {
@@ -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.0.9
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
@@ -5,7 +5,7 @@ with open('README.md','r') as f:
5
5
 
6
6
 
7
7
  setup(name='midas_civil',
8
- version='1.0.8',
8
+ version='1.0.9',
9
9
  description='Python library for MIDAS Civil NX',
10
10
  author='Sumit Shekhar',
11
11
  author_email='sumit.midasit@gmail.com',
@@ -1,49 +0,0 @@
1
- import requests
2
- from ._mapi import *
3
- _version_ = "1.0.8"
4
-
5
-
6
- print('')
7
- print('*'*20,' MIDAS CIVIL-NX PYTHON LIBRARY v',_version_,' 🐍 ','*'*20)
8
- print('')
9
-
10
- if NX.version_check:
11
- resp = requests.get("https://pypi.org/pypi/midas_civil/json").json()
12
- 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)
20
-
21
-
22
- from ._model import *
23
- from ._boundary import *
24
- from ._utils import *
25
- from ._node import *
26
- from ._element import *
27
- from ._load import *
28
- from ._group import *
29
- from ._result import *
30
-
31
- #--- TESTING IMPORTS ---
32
- from ._material import *
33
-
34
- # from ._section import *
35
- from ._section import *
36
-
37
- from ._result_extract import *
38
- from ._construction import *
39
- from ._thickness import *
40
- from ._temperature import *
41
-
42
- from ._tendon import *
43
- from ._view import *
44
-
45
- from ._movingload import *
46
- from ._settlement import *
47
- from ._analysiscontrol import *
48
- from ._BoundaryChangeAssignment import*
49
-
File without changes
File without changes
File without changes