midas-civil 1.0.8__py3-none-any.whl → 1.0.9__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 +10 -11
- midas_civil/_element.py +47 -13
- midas_civil/_mapi.py +35 -14
- midas_civil/_tendon.py +3 -1
- midas_civil/_utils.py +9 -1
- {midas_civil-1.0.8.dist-info → midas_civil-1.0.9.dist-info}/METADATA +1 -1
- {midas_civil-1.0.8.dist-info → midas_civil-1.0.9.dist-info}/RECORD +10 -10
- {midas_civil-1.0.8.dist-info → midas_civil-1.0.9.dist-info}/WHEEL +0 -0
- {midas_civil-1.0.8.dist-info → midas_civil-1.0.9.dist-info}/licenses/LICENSE +0 -0
- {midas_civil-1.0.8.dist-info → midas_civil-1.0.9.dist-info}/top_level.txt +0 -0
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.
|
|
4
|
+
_version_ = "1.0.9"
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
print('')
|
|
7
|
-
print('
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
midas_civil/_mapi.py
CHANGED
|
@@ -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(
|
|
12
|
-
print("
|
|
13
|
-
print(
|
|
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
|
-
|
|
172
|
-
print(f"
|
|
173
|
-
print("
|
|
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
|
-
|
|
196
|
+
pass
|
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
|
-
'
|
|
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/_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,13 +1,13 @@
|
|
|
1
1
|
midas_civil/_BoundaryChangeAssignment.py,sha256=8lQC0DZ8zAXuPfchBdhqUaLZhZMog51EffQcKeayrlc,9511
|
|
2
|
-
midas_civil/__init__.py,sha256=
|
|
2
|
+
midas_civil/__init__.py,sha256=Q2RdJJwDVk3v1tzB6iZPJ8rD8vwH_u4l4pamqXENLpA,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=
|
|
7
|
+
midas_civil/_element.py,sha256=8_4sDLlHQ0bgCmA8cYIvSXjQIo27FR4t_lV8SDzbF5c,36086
|
|
8
8
|
midas_civil/_group.py,sha256=ul0gPtAhfuc9HPQkVw2dfV0jqCLvnTbxAlx6hEBUmyI,9882
|
|
9
9
|
midas_civil/_load.py,sha256=twsfqofTzbnMHXShfMRSP61ll7CTBA5qos33od7nQ9E,30170
|
|
10
|
-
midas_civil/_mapi.py,sha256=
|
|
10
|
+
midas_civil/_mapi.py,sha256=68cj1GVBAHzcuO7ToULxeQdQuDLXJ4PztgV1eb3qr3s,7570
|
|
11
11
|
midas_civil/_material.py,sha256=uJEIHJM9OhwTRWUI2mtd_0BQSxdlYhATYJu9P7tNNBA,69511
|
|
12
12
|
midas_civil/_model.py,sha256=huUlmIZVsBbThszrEIhvb9owOSmdggylXaJeK4g7lxY,16735
|
|
13
13
|
midas_civil/_movingload.py,sha256=a1i5fNc7oCmWTjVXbyBEYzDr5BO7NTXPVCKgvjzxuX4,80000
|
|
@@ -17,9 +17,9 @@ midas_civil/_result.py,sha256=nzXY2lh_342M45TMq2hBYwSp41_wAHyGFSfvt9h2vXc,7638
|
|
|
17
17
|
midas_civil/_result_extract.py,sha256=QVo1DJmlkTJ20-FwqgguH70bVrwHbx7TfPFENYfCUbE,5706
|
|
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=
|
|
20
|
+
midas_civil/_tendon.py,sha256=oNeT0e5VIWIDhhUfxdf2KQKXdiCkbN7fWjVYjPzs7mg,33464
|
|
21
21
|
midas_civil/_thickness.py,sha256=yyFkMCaxcwRsqYJcRAxWqnt59fdqzX4Mqkjz23waw-A,3247
|
|
22
|
-
midas_civil/_utils.py,sha256=
|
|
22
|
+
midas_civil/_utils.py,sha256=nTF6btow2TK4mufyKupbjwagjlYp5WVRJmfchYAUdMk,2881
|
|
23
23
|
midas_civil/_view.py,sha256=o7rkfoQzmgAb3dT0ujPIQLVwVlveo3rMRIbZU1UosZo,849
|
|
24
24
|
midas_civil/_section/_TapdbSecSS.py,sha256=ANHBwzegppGmUlm7spEBNDHfdJfTbWX7Q-pvn-Th1tA,1649
|
|
25
25
|
midas_civil/_section/__init__.py,sha256=subwWGtIRFfz19i2mtLPuQbViFAR8-xZY7eHLBGUWO4,15250
|
|
@@ -29,8 +29,8 @@ midas_civil/_section/_offsetSS.py,sha256=kHjwp_PCeBKWqYKoQCy0s4d8O5Gb0Vk6e1MWMOG
|
|
|
29
29
|
midas_civil/_section/_pscSS.py,sha256=PnXR5lJNKYtp8MyFddJlW45CYCRSG6SpA-zojDl4DnE,14254
|
|
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.
|
|
33
|
-
midas_civil-1.0.
|
|
34
|
-
midas_civil-1.0.
|
|
35
|
-
midas_civil-1.0.
|
|
36
|
-
midas_civil-1.0.
|
|
32
|
+
midas_civil-1.0.9.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
|
|
33
|
+
midas_civil-1.0.9.dist-info/METADATA,sha256=SbXJc_OPCjfYsDURQRgEFla-F5Xl7MkKVrYLYqOoYuI,2085
|
|
34
|
+
midas_civil-1.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
35
|
+
midas_civil-1.0.9.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
|
|
36
|
+
midas_civil-1.0.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|