midas-civil 1.0.1__py3-none-any.whl → 1.0.2__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 +1 -1
- midas_civil/_element.py +97 -1
- midas_civil/_mapi.py +12 -0
- midas_civil/_model.py +13 -4
- midas_civil/_result_extract.py +7 -1
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.2.dist-info}/METADATA +2 -1
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.2.dist-info}/RECORD +10 -10
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.2.dist-info}/WHEEL +0 -0
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.2.dist-info}/licenses/LICENSE +0 -0
- {midas_civil-1.0.1.dist-info → midas_civil-1.0.2.dist-info}/top_level.txt +0 -0
midas_civil/__init__.py
CHANGED
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
|
@@ -130,3 +130,15 @@ def MidasAPI(method:str, command:str, body:dict={})->dict:
|
|
|
130
130
|
return response.json()
|
|
131
131
|
|
|
132
132
|
|
|
133
|
+
#--------------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
def _getUNIT():
|
|
136
|
+
return MidasAPI('GET','/db/UNIT',{})['UNIT']['1']
|
|
137
|
+
|
|
138
|
+
def _setUNIT(unitJS):
|
|
139
|
+
js = {
|
|
140
|
+
"Assign" : {
|
|
141
|
+
"1" : unitJS
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
MidasAPI('PUT','/db/UNIT',js)
|
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.2
|
|
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=FLQxclh4avM2ich9ZhAxFcFLM1fVCGKlFjVNnwW9B2o,581
|
|
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=SnX16e19jAuFEc7W_95FtY7aadfmdkgVxZie6hkgyEY,4867
|
|
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.2.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
|
|
24
|
+
midas_civil-1.0.2.dist-info/METADATA,sha256=25Lm__RTdXyuo2Gwkgm3Qp4snPVKVP-CMHqpHgd1fLI,2085
|
|
25
|
+
midas_civil-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
+
midas_civil-1.0.2.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
|
|
27
|
+
midas_civil-1.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|