midas-civil 1.0.1__py3-none-any.whl → 1.0.3__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 +18 -6
- midas_civil/_element.py +97 -1
- midas_civil/_mapi.py +24 -3
- midas_civil/_model.py +13 -4
- midas_civil/_result_extract.py +7 -1
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.3.dist-info}/METADATA +2 -1
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.3.dist-info}/RECORD +10 -10
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.3.dist-info}/WHEEL +0 -0
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.3.dist-info}/licenses/LICENSE +0 -0
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.3.dist-info}/top_level.txt +0 -0
midas_civil/__init__.py
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
_version_ = "1.0.3"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
print('')
|
|
6
|
+
print('*'*20,' MIDAS CIVIL-NX PYTHON LIBRARY v',_version_,' 🐍 ','*'*20)
|
|
7
|
+
print('')
|
|
8
|
+
|
|
9
|
+
resp = requests.get("https://pypi.org/pypi/midas_civil/json").json()
|
|
10
|
+
latest_ver = resp["info"]["version"]
|
|
11
|
+
if _version_ != latest_ver:
|
|
12
|
+
print(
|
|
13
|
+
f"⚠️ Warning: You are using v{_version_}, "
|
|
14
|
+
f"but the latest available version is v{latest_ver}.\n"
|
|
15
|
+
f" Run 'pip install midas_civil --upgrade' to update."
|
|
16
|
+
)
|
|
17
|
+
print("-"*85)
|
|
18
|
+
|
|
1
19
|
from ._mapi import *
|
|
2
20
|
from ._model import *
|
|
3
21
|
from ._boundary import *
|
|
@@ -23,9 +41,3 @@ from ._view import *
|
|
|
23
41
|
from ._movingload import*
|
|
24
42
|
from ._settlement import*
|
|
25
43
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
print('')
|
|
29
|
-
print('*'*20,' MIDAS CIVIL-NX PYTHON LIBRARY 🐍 ','*'*20)
|
|
30
|
-
print('')
|
|
31
|
-
|
midas_civil/_element.py
CHANGED
|
@@ -2,9 +2,85 @@ from ._mapi import *
|
|
|
2
2
|
from ._node import *
|
|
3
3
|
from ._group import _add_elem_2_stGroup
|
|
4
4
|
from ._group import _add_node_2_stGroup
|
|
5
|
-
|
|
6
5
|
import numpy as np
|
|
6
|
+
from scipy.interpolate import splev, splprep
|
|
7
|
+
from math import hypot
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _interpolateAlignment(pointsArray,n_seg=10,deg=1,mSize=0,includePoint:bool=True) -> list:
|
|
11
|
+
''' Returns point list and beta angle list'''
|
|
12
|
+
pointsArray = np.array(pointsArray)
|
|
13
|
+
x_p, y_p , z_p = pointsArray[:,0] , pointsArray[:,1] , pointsArray[:,2]
|
|
14
|
+
|
|
15
|
+
if deg < 1 :
|
|
16
|
+
deg = 1
|
|
17
|
+
if deg > len(pointsArray)-1:
|
|
18
|
+
deg = len(pointsArray)-1
|
|
19
|
+
|
|
20
|
+
#-- Actual length ----
|
|
21
|
+
dxq = np.diff(x_p)
|
|
22
|
+
dyq = np.diff(y_p)
|
|
23
|
+
dzq = np.diff(z_p)
|
|
24
|
+
dlq=[0]
|
|
25
|
+
|
|
26
|
+
for i in range(len(dxq)):
|
|
27
|
+
dlq.append(hypot(dxq[i],dyq[i],dzq[i]))
|
|
28
|
+
|
|
29
|
+
tck, u = splprep([x_p, y_p, z_p], s=0, k=deg)
|
|
30
|
+
|
|
31
|
+
u_fine = np.linspace(0, 1, 500)
|
|
32
|
+
x_den, y_den, z_den = splev(u_fine, tck)
|
|
33
|
+
|
|
34
|
+
dx = np.diff(x_den)
|
|
35
|
+
dy = np.diff(y_den)
|
|
36
|
+
dz = np.diff(z_den)
|
|
37
|
+
dl=[]
|
|
38
|
+
for i in range(len(dx)):
|
|
39
|
+
dl.append(hypot(dx[i],dy[i],dz[i]))
|
|
40
|
+
|
|
41
|
+
cum_l = np.insert(np.cumsum(dl),0,0)
|
|
42
|
+
total_l = cum_l[-1]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
if n_seg==0 or mSize!=0:
|
|
46
|
+
n_seg=int(total_l/mSize)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
eq_len = np.linspace(0,total_l,n_seg+1)
|
|
50
|
+
|
|
51
|
+
interp_u = np.interp(eq_len,cum_l,u_fine)
|
|
52
|
+
|
|
53
|
+
if includePoint:
|
|
54
|
+
interp_u = np.sort(np.append(interp_u,u[1:-1])).tolist()
|
|
55
|
+
|
|
56
|
+
eq_u = 1/n_seg # for filtering close points
|
|
57
|
+
|
|
58
|
+
new_u = []
|
|
59
|
+
skip=0
|
|
60
|
+
for i in range(len(interp_u)-1):
|
|
61
|
+
if skip == 1:
|
|
62
|
+
skip = 0
|
|
63
|
+
continue
|
|
64
|
+
if interp_u[i+1]-interp_u[i] < 0.2*eq_u:
|
|
65
|
+
if interp_u[i] in u:
|
|
66
|
+
new_u.append(interp_u[i])
|
|
67
|
+
skip=1
|
|
68
|
+
else:
|
|
69
|
+
new_u.append(interp_u[i+1])
|
|
70
|
+
skip=1
|
|
71
|
+
else:
|
|
72
|
+
new_u.append(interp_u[i])
|
|
73
|
+
new_u.append(interp_u[-1])
|
|
74
|
+
else:
|
|
75
|
+
new_u = interp_u
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
interp_x, interp_y , interp_z = splev(new_u, tck)
|
|
79
|
+
|
|
7
80
|
|
|
81
|
+
align_fine_points = [ [round(x,6), round(y,6), round(z,6)] for x, y, z in zip(interp_x, interp_y , interp_z) ]
|
|
82
|
+
|
|
83
|
+
return align_fine_points
|
|
8
84
|
|
|
9
85
|
|
|
10
86
|
|
|
@@ -273,6 +349,26 @@ class Element:
|
|
|
273
349
|
beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,group,id_new))
|
|
274
350
|
|
|
275
351
|
return beam_obj
|
|
352
|
+
|
|
353
|
+
@staticmethod
|
|
354
|
+
def PLine(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):
|
|
355
|
+
|
|
356
|
+
beam_nodes =[]
|
|
357
|
+
beam_obj = []
|
|
358
|
+
if n_div == 0 :
|
|
359
|
+
i_loc = points_loc
|
|
360
|
+
else:
|
|
361
|
+
i_loc = _interpolateAlignment(points_loc,n_div,deg,0,includePoint)
|
|
362
|
+
for i in i_loc:
|
|
363
|
+
Enode=Node(i[0],i[1],i[2])
|
|
364
|
+
beam_nodes.append(Enode.ID)
|
|
365
|
+
|
|
366
|
+
for i in range(len(i_loc)-1):
|
|
367
|
+
if id == 0 : id_new = 0
|
|
368
|
+
else: id_new = id+i
|
|
369
|
+
beam_obj.append(Element.Beam(beam_nodes[i],beam_nodes[i+1],mat,sect,angle,group,id_new))
|
|
370
|
+
|
|
371
|
+
return beam_obj
|
|
276
372
|
|
|
277
373
|
class Truss(_common):
|
|
278
374
|
def __init__(self, i: int, j: int, mat: int = 1, sect: int = 1, angle: float = 0, group = "" , id: int = 0):
|
midas_civil/_mapi.py
CHANGED
|
@@ -15,7 +15,7 @@ class MAPI_COUNTRY:
|
|
|
15
15
|
|
|
16
16
|
country = "US"
|
|
17
17
|
|
|
18
|
-
def __init__(self,country:str):
|
|
18
|
+
def __init__(self,country:str="US"):
|
|
19
19
|
''' Define Civil NX country to automatically set Base URL and MAPI Key from registry.
|
|
20
20
|
```
|
|
21
21
|
MAPI_COUNTRY('US') # For english version
|
|
@@ -35,7 +35,7 @@ class MAPI_COUNTRY:
|
|
|
35
35
|
class MAPI_BASEURL:
|
|
36
36
|
baseURL = "https://moa-engineers.midasit.com:443/civil"
|
|
37
37
|
|
|
38
|
-
def __init__(self, baseURL:str):
|
|
38
|
+
def __init__(self, baseURL:str = "https://moa-engineers.midasit.com:443/civil"):
|
|
39
39
|
''' Define the Base URL for API connection.
|
|
40
40
|
```
|
|
41
41
|
MAPI_BASEURL('https://moa-engineers.midasit.com:443/civil')
|
|
@@ -81,13 +81,15 @@ class MAPI_KEY:
|
|
|
81
81
|
registry_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_path, 0, winreg.KEY_READ)
|
|
82
82
|
value = winreg.QueryValueEx(registry_key, "Key")
|
|
83
83
|
my_key = value[0]
|
|
84
|
-
print(f' 🔑 MAPI-KEY is taken from Registry entry. >> {my_key[:35]}...')
|
|
85
84
|
MAPI_KEY(my_key)
|
|
85
|
+
print(f' 🔑 MAPI-KEY is taken from Registry entry. >> {my_key[:35]}...')
|
|
86
|
+
print("-"*85)
|
|
86
87
|
except:
|
|
87
88
|
print(f"🔑 MAPI KEY is not defined. Click on Apps > API Settings to copy the MAPI Key.\n Define it using MAPI_KEY('xxxx')")
|
|
88
89
|
sys.exit(0)
|
|
89
90
|
else:
|
|
90
91
|
my_key = MAPI_KEY.data
|
|
92
|
+
|
|
91
93
|
return my_key
|
|
92
94
|
#---------------------------------------------------------------------------------------------------------------
|
|
93
95
|
|
|
@@ -130,3 +132,22 @@ def MidasAPI(method:str, command:str, body:dict={})->dict:
|
|
|
130
132
|
return response.json()
|
|
131
133
|
|
|
132
134
|
|
|
135
|
+
#--------------------------------------------------------------------
|
|
136
|
+
|
|
137
|
+
def _getUNIT():
|
|
138
|
+
return MidasAPI('GET','/db/UNIT',{})['UNIT']['1']
|
|
139
|
+
|
|
140
|
+
def _setUNIT(unitJS):
|
|
141
|
+
js = {
|
|
142
|
+
"Assign" : {
|
|
143
|
+
"1" : unitJS
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
MidasAPI('PUT','/db/UNIT',js)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
resp = MidasAPI('GET','/config/ver',{})['VER']
|
|
151
|
+
print(f"Connected to {resp["NAME"]} 🟢")
|
|
152
|
+
print(f"USER : {resp["USER"]} | COMPANY : {resp["COMPANY"]}")
|
|
153
|
+
print("-"*85)
|
midas_civil/_model.py
CHANGED
|
@@ -19,10 +19,19 @@ class Model:
|
|
|
19
19
|
@staticmethod
|
|
20
20
|
def analyse():
|
|
21
21
|
"""Checkes whether a model is analyzed or not and then performs analysis if required."""
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
json_body = {
|
|
23
|
+
"Argument": {
|
|
24
|
+
"HEIGHT" : 1,
|
|
25
|
+
"WIDTH" : 1,
|
|
26
|
+
"SET_MODE": "post"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
resp = MidasAPI('POST','/view/CAPTURE',json_body)
|
|
30
|
+
|
|
31
|
+
if 'message' in resp or 'error' in resp:
|
|
32
|
+
MidasAPI("POST","/doc/ANAL",{"Assign":{}})
|
|
33
|
+
return True
|
|
34
|
+
print(" ⚠️ Model ananlysed. Switching to post-processing mode.")
|
|
26
35
|
|
|
27
36
|
#9 Function to remove duplicate nodes and elements from Node & Element classes\
|
|
28
37
|
@staticmethod
|
midas_civil/_result_extract.py
CHANGED
|
@@ -3,6 +3,9 @@ import json
|
|
|
3
3
|
import xlsxwriter
|
|
4
4
|
from ._mapi import *
|
|
5
5
|
from ._model import *
|
|
6
|
+
|
|
7
|
+
from ._mapi import _getUNIT
|
|
8
|
+
from ._mapi import _setUNIT
|
|
6
9
|
# js_file = open('JSON_Excel Parsing\\test.json','r')
|
|
7
10
|
|
|
8
11
|
# print(js_file)
|
|
@@ -136,8 +139,10 @@ class Result :
|
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
}
|
|
142
|
+
currUNIT = _getUNIT()
|
|
139
143
|
Model.units(force=force_unit,length=len_unit)
|
|
140
144
|
ss_json = MidasAPI("POST","/post/TABLE",js_dat)
|
|
145
|
+
_setUNIT(currUNIT)
|
|
141
146
|
return _JSToDF_UserDefined(tableName,ss_json,summary)
|
|
142
147
|
|
|
143
148
|
# ---------- LIST ALL USER DEFINED TABLE ------------------------------
|
|
@@ -194,8 +199,9 @@ class Result :
|
|
|
194
199
|
|
|
195
200
|
if loadcase!=[]: js_dat["Argument"]['LOAD_CASE_NAMES'] = loadcase
|
|
196
201
|
|
|
197
|
-
|
|
202
|
+
currUNIT = _getUNIT()
|
|
198
203
|
Model.units(force=force_unit,length=len_unit)
|
|
199
204
|
ss_json = MidasAPI("POST","/post/table",js_dat)
|
|
205
|
+
_setUNIT(currUNIT)
|
|
200
206
|
return _JSToDF_ResTable(ss_json)
|
|
201
207
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: midas_civil
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
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
|
|
@@ -13,6 +13,7 @@ Requires-Dist: numpy
|
|
|
13
13
|
Requires-Dist: polars
|
|
14
14
|
Requires-Dist: xlsxwriter
|
|
15
15
|
Requires-Dist: requests
|
|
16
|
+
Requires-Dist: scipy
|
|
16
17
|
Dynamic: author
|
|
17
18
|
Dynamic: author-email
|
|
18
19
|
Dynamic: description
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
midas_civil/__init__.py,sha256=
|
|
1
|
+
midas_civil/__init__.py,sha256=cNRskckAnVa-yPS6WsAoT7rEPldE1XyuNljYmCSKg-c,997
|
|
2
2
|
midas_civil/_boundary.py,sha256=s5mgZIc1b0-P7AdWuaPAQ5cIbHL5CR1YRKJA7KE4W_U,32958
|
|
3
3
|
midas_civil/_construction.py,sha256=q9C3gGdvky5t7jCDzd6lBRv6pm8cMycI91xfkgDV37Y,40673
|
|
4
4
|
midas_civil/_construction_backup.py,sha256=Pj7V-NYCkkT-aMjKXfs1jKa9klsGh48UXDLwn3BLYTY,18225
|
|
5
|
-
midas_civil/_element.py,sha256=
|
|
5
|
+
midas_civil/_element.py,sha256=O6PBn5yWI_EFpHpCMOVoo8zsA5fup1pwdY058LSc0pY,30411
|
|
6
6
|
midas_civil/_group.py,sha256=Go4If-cwdKMfIDlNi1MYYq4jPYOa3MlVvNkX2pTkyCs,9864
|
|
7
7
|
midas_civil/_load.py,sha256=TltWAjDaeC5MNW8IIPKgpLahDQgJR3J6SzinkCrJS7A,30171
|
|
8
|
-
midas_civil/_mapi.py,sha256=
|
|
8
|
+
midas_civil/_mapi.py,sha256=b6-ZRUMLvOedhdgIfzW3byG9hXjEdqJetAwayJWGtKc,5136
|
|
9
9
|
midas_civil/_material.py,sha256=uJEIHJM9OhwTRWUI2mtd_0BQSxdlYhATYJu9P7tNNBA,69511
|
|
10
|
-
midas_civil/_model.py,sha256=
|
|
10
|
+
midas_civil/_model.py,sha256=I7lzMsOhqWcDcBYtPSqBUs97sBEf5M1mJ0KLftyGGB4,16597
|
|
11
11
|
midas_civil/_movingload.py,sha256=kzTbi4vFjOnUYOyhDDTmSHFU-sDGb_MgMBNXUmFmUZc,80001
|
|
12
12
|
midas_civil/_node.py,sha256=wRttDbebQWT6aZWeNd72AgzVWUETyNzMng5kJQmV3WM,4760
|
|
13
13
|
midas_civil/_result copy.py,sha256=siTMENLIwF_6rvydSjP9aQAWaIlt0pReiqNyDhDevGk,24290
|
|
14
14
|
midas_civil/_result.py,sha256=ZJf2CQG2ZjlTKuWo3zBnG7W8EwI1UkhWhWJVWRzlXUU,7640
|
|
15
|
-
midas_civil/_result_extract.py,sha256=
|
|
15
|
+
midas_civil/_result_extract.py,sha256=cZgWMxvZV9Pc-Ec0KzGrerDRv1Sj3AJKqlZwj_uVi9w,5707
|
|
16
16
|
midas_civil/_section.py,sha256=-mpGOYceus_dURE80lsGExSBDDpqDKqsNjBeOE3kZEM,36433
|
|
17
17
|
midas_civil/_settlement.py,sha256=U7lJYBqGbuCv7qziEEznDyA4M_SCjJeIjc0lDeGfE4Y,5125
|
|
18
18
|
midas_civil/_temperature.py,sha256=EfvivFWfxyM8yFCvWJgXLhaCofGwLKEBGFUuW8yHnfQ,24209
|
|
@@ -20,8 +20,8 @@ midas_civil/_tendon.py,sha256=mXNJeLikFsBpgn8u9fED2qx9oqnKh3XtIpYwp3moEfk,33395
|
|
|
20
20
|
midas_civil/_thickness.py,sha256=4xQsLA3Q_gIGCwLc_glFmiErdWdQUSwhlEhJ_IPJseA,3248
|
|
21
21
|
midas_civil/_utils.py,sha256=GR9cj-mgRPmtwmgqEj4JeEjMlRS6zmvhcxFV5IHbpRk,2708
|
|
22
22
|
midas_civil/_view.py,sha256=o7rkfoQzmgAb3dT0ujPIQLVwVlveo3rMRIbZU1UosZo,849
|
|
23
|
-
midas_civil-1.0.
|
|
24
|
-
midas_civil-1.0.
|
|
25
|
-
midas_civil-1.0.
|
|
26
|
-
midas_civil-1.0.
|
|
27
|
-
midas_civil-1.0.
|
|
23
|
+
midas_civil-1.0.3.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
|
|
24
|
+
midas_civil-1.0.3.dist-info/METADATA,sha256=eTANjSQcccpH8UvxKCrjExV7olqV30r47d0MaZRh-tM,2085
|
|
25
|
+
midas_civil-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
+
midas_civil-1.0.3.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
|
|
27
|
+
midas_civil-1.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|