midas-civil 1.4.1__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.
- midas_civil/_BoundaryChangeAssignment.py +278 -0
- midas_civil/__init__.py +51 -0
- midas_civil/_analysiscontrol.py +585 -0
- midas_civil/_boundary.py +888 -0
- midas_civil/_construction.py +1004 -0
- midas_civil/_element.py +1346 -0
- midas_civil/_group.py +337 -0
- midas_civil/_load.py +967 -0
- midas_civil/_loadcomb.py +159 -0
- midas_civil/_mapi.py +249 -0
- midas_civil/_material.py +1692 -0
- midas_civil/_model.py +522 -0
- midas_civil/_movingload.py +1479 -0
- midas_civil/_node.py +532 -0
- midas_civil/_result_table.py +929 -0
- midas_civil/_result_test.py +5455 -0
- midas_civil/_section/_TapdbSecSS.py +175 -0
- midas_civil/_section/__init__.py +413 -0
- midas_civil/_section/_compositeSS.py +283 -0
- midas_civil/_section/_dbSecSS.py +164 -0
- midas_civil/_section/_offsetSS.py +53 -0
- midas_civil/_section/_pscSS copy.py +455 -0
- midas_civil/_section/_pscSS.py +822 -0
- midas_civil/_section/_tapPSC12CellSS.py +565 -0
- midas_civil/_section/_unSupp.py +58 -0
- midas_civil/_settlement.py +161 -0
- midas_civil/_temperature.py +677 -0
- midas_civil/_tendon.py +1016 -0
- midas_civil/_thickness.py +147 -0
- midas_civil/_utils.py +529 -0
- midas_civil/_utilsFunc/__init__.py +0 -0
- midas_civil/_utilsFunc/_line2plate.py +636 -0
- midas_civil/_view.py +891 -0
- midas_civil/_view_trial.py +430 -0
- midas_civil/_visualise.py +347 -0
- midas_civil-1.4.1.dist-info/METADATA +74 -0
- midas_civil-1.4.1.dist-info/RECORD +40 -0
- midas_civil-1.4.1.dist-info/WHEEL +5 -0
- midas_civil-1.4.1.dist-info/licenses/LICENSE +21 -0
- midas_civil-1.4.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
# from midas_civil import *
|
|
2
|
+
from midas_civil import MidasAPI,Node,Element,Boundary,Thickness,Section,Model
|
|
3
|
+
from colorama import Fore,Style
|
|
4
|
+
import numpy as np
|
|
5
|
+
from math import hypot , sin , cos
|
|
6
|
+
from tqdm import tqdm
|
|
7
|
+
|
|
8
|
+
class L2P:
|
|
9
|
+
first = 0
|
|
10
|
+
nDivMESH =[]
|
|
11
|
+
CG_data = {}
|
|
12
|
+
thick_js = {}
|
|
13
|
+
sorted_nodes = []
|
|
14
|
+
endNodes = []
|
|
15
|
+
rgdID = 10
|
|
16
|
+
|
|
17
|
+
# 1. ------------- Getting selected elements, sorting the nodes, deleting the middle node -------------------
|
|
18
|
+
# Takes in [[1,2] , [3,4] ,[2,3]] returns [1,2,3,4]
|
|
19
|
+
# -> MAIN FUNCTION IS TO ARRANGE THE NODE AND ELEMENT LIST
|
|
20
|
+
def arrangeNodeList(n_list,elm_list):
|
|
21
|
+
''' Return arranged Nodes list (1D) and Element list (1D)'''
|
|
22
|
+
|
|
23
|
+
n_list_2 = n_list[1:]
|
|
24
|
+
ord_list=[n_list[0]]
|
|
25
|
+
|
|
26
|
+
e_list2 = elm_list[1:]
|
|
27
|
+
e_ord_list=[elm_list[0]]
|
|
28
|
+
|
|
29
|
+
add_pos = 1 # 1 => Last | -1 => first
|
|
30
|
+
flip_count=0
|
|
31
|
+
|
|
32
|
+
def arrangeNode(ordList,n_list,add_pos,flip_count,elm_list,e_ord_list):
|
|
33
|
+
|
|
34
|
+
for i in range(len(n_list)):
|
|
35
|
+
if add_pos == 1:
|
|
36
|
+
if ordList[-1][1] == n_list[i][0]:
|
|
37
|
+
ordList.append(n_list[i])
|
|
38
|
+
e_ord_list.append(elm_list[i])
|
|
39
|
+
del elm_list[i]
|
|
40
|
+
del n_list[i]
|
|
41
|
+
# print(f'Last add | {ordList}')
|
|
42
|
+
return
|
|
43
|
+
elif add_pos == -1:
|
|
44
|
+
if ordList[0][0] == n_list[i][1]:
|
|
45
|
+
ordList.insert(0,n_list[i])
|
|
46
|
+
e_ord_list.insert(0,elm_list[i])
|
|
47
|
+
del n_list[i]
|
|
48
|
+
del elm_list[i]
|
|
49
|
+
# print(f'First add | {ordList}')
|
|
50
|
+
return
|
|
51
|
+
|
|
52
|
+
add_pos = add_pos*-1
|
|
53
|
+
flip_count += 1
|
|
54
|
+
# print(f'Flipped | {ordList} | {n_list} | {add_pos}')
|
|
55
|
+
if flip_count == 1 : arrangeNode(ordList,n_list,add_pos,flip_count,elm_list,e_ord_list)
|
|
56
|
+
|
|
57
|
+
for _ in range(len(n_list_2)):
|
|
58
|
+
arrangeNode(ord_list,n_list_2,add_pos,flip_count,e_list2,e_ord_list)
|
|
59
|
+
|
|
60
|
+
if len(ord_list) < len(n_list):
|
|
61
|
+
print('⚠️ Element not in a single continuous line | Smaller segment is returned')
|
|
62
|
+
|
|
63
|
+
simple_ord_list = [ord_list[0][0],ord_list[0][1]]
|
|
64
|
+
for i in range(len(ord_list)-1):
|
|
65
|
+
simple_ord_list.append(ord_list[i+1][1])
|
|
66
|
+
|
|
67
|
+
return simple_ord_list, e_ord_list
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# Returns sorted nodes and alignment coordinates for the selected elements
|
|
71
|
+
# -> align_nodes_list, align_coordinates_list, beta_angle , arrangeLIST_ELM , matID , sec_ID_list_arranged,k
|
|
72
|
+
# SORTED NODE IDS , COORDINATES , BETA ANGLE AT NODES, SORTED ELEMENT IDS, MATID (SINGLE), SECT IDS , K - CURVE DEG(DEFAULT = 3 , MIN. BASED ON ELEMENT SELECTED)
|
|
73
|
+
# STEPS FOLLOWED - MIDASAPI FUNCTION IS USED
|
|
74
|
+
# GET THE SELECTION -> GET ELEMENT DATA ONLY FOR SELECTED ELEMENTS
|
|
75
|
+
# GET THE NODES OF ELEMS -> SORT THE DATA TO GET A CONTINUOUS LINE
|
|
76
|
+
# GET THE NODE LOCATION OF THE CONTINUOUS LINE NODES
|
|
77
|
+
# DELETE IN-BETWEEN NODES IF N_ELEM > 1 OR DELETE THE SELECTED ELEMENT
|
|
78
|
+
|
|
79
|
+
def delSelectElements(elemList):
|
|
80
|
+
'''
|
|
81
|
+
Deletes the middle nodes
|
|
82
|
+
Returns sorted nodes and alignment coordinates for the selected elements
|
|
83
|
+
Returns material ID of first element
|
|
84
|
+
Returns sectID of each beam element
|
|
85
|
+
'''
|
|
86
|
+
|
|
87
|
+
if elemList == None :
|
|
88
|
+
node_json = MidasAPI('GET','/view/SELECT')
|
|
89
|
+
align_elem_list = node_json['SELECT']['ELEM_LIST']
|
|
90
|
+
else:
|
|
91
|
+
align_elem_list = elemList
|
|
92
|
+
|
|
93
|
+
if align_elem_list == []:
|
|
94
|
+
raise Exception("No elements selected ☹️")
|
|
95
|
+
return 0
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
align_elem_list_url = ",".join(map(str, align_elem_list))
|
|
99
|
+
align_elem_json = MidasAPI('GET',f'/db/ELEM/{align_elem_list_url}')
|
|
100
|
+
|
|
101
|
+
align_nodes_list =[]
|
|
102
|
+
align_elem_list=[]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
for elmID in align_elem_json['ELEM']:
|
|
106
|
+
nodes = align_elem_json['ELEM'][elmID]['NODE']
|
|
107
|
+
align_nodes_list.append([nodes[0],nodes[1]])
|
|
108
|
+
align_elem_list.append(elmID)
|
|
109
|
+
|
|
110
|
+
arrangeLIST, arrangeLIST_ELM = arrangeNodeList(align_nodes_list,align_elem_list)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
matID = align_elem_json['ELEM'][arrangeLIST_ELM[0]]['MATL']
|
|
115
|
+
|
|
116
|
+
sec_ID_list_arranged = []
|
|
117
|
+
for elmID in arrangeLIST_ELM:
|
|
118
|
+
sec_ID_list_arranged.append(align_elem_json['ELEM'][elmID]['SECT'])
|
|
119
|
+
|
|
120
|
+
align_nodes_list = arrangeLIST
|
|
121
|
+
|
|
122
|
+
align_nodes_list_url = ",".join(map(str, align_nodes_list))
|
|
123
|
+
node_json = MidasAPI('GET',f'/db/NODE/{align_nodes_list_url}')
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
align_coordinates_list = []
|
|
127
|
+
|
|
128
|
+
for nd in align_nodes_list:
|
|
129
|
+
align_coordinates_list.append([ node_json['NODE'][str(nd)]['X'] , node_json['NODE'][str(nd)]['Y'] , node_json['NODE'][str(nd)]['Z'] ])
|
|
130
|
+
|
|
131
|
+
k=3
|
|
132
|
+
|
|
133
|
+
if len(align_nodes_list)==2:
|
|
134
|
+
MidasAPI('DELETE',f'/db/ELEM/{arrangeLIST_ELM[0]}')
|
|
135
|
+
k=1
|
|
136
|
+
|
|
137
|
+
else:
|
|
138
|
+
align_nodes_list_url = ",".join(map(str, align_nodes_list[1:-1]))
|
|
139
|
+
MidasAPI('DELETE',f'/db/NODE/{align_nodes_list_url}')
|
|
140
|
+
k=min(3,len(align_nodes_list)-1)
|
|
141
|
+
|
|
142
|
+
L2P.endNodes = [align_nodes_list[0],align_nodes_list[-1]]
|
|
143
|
+
# Create node here for rigid links purpose
|
|
144
|
+
nd = align_nodes_list[0]
|
|
145
|
+
Node(node_json['NODE'][str(nd)]['X'],node_json['NODE'][str(nd)]['Y'],node_json['NODE'][str(nd)]['Z'],nd)
|
|
146
|
+
nd = align_nodes_list[-1]
|
|
147
|
+
Node(node_json['NODE'][str(nd)]['X'],node_json['NODE'][str(nd)]['Y'],node_json['NODE'][str(nd)]['Z'],nd)
|
|
148
|
+
|
|
149
|
+
beta_angle = [align_elem_json['ELEM'][str(arrangeLIST_ELM[0])]['ANGLE']*3.141/180]
|
|
150
|
+
for i in range(len(align_nodes_list)-2):
|
|
151
|
+
ba1 = align_elem_json['ELEM'][str(arrangeLIST_ELM[i])]['ANGLE']*3.141/180
|
|
152
|
+
ba2 = align_elem_json['ELEM'][str(arrangeLIST_ELM[i+1])]['ANGLE']*3.141/180
|
|
153
|
+
beta_angle.append(0.5*ba1+0.5*ba2)
|
|
154
|
+
beta_angle.append(align_elem_json['ELEM'][str(arrangeLIST_ELM[-1])]['ANGLE']*3.141/180)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
return align_nodes_list, align_coordinates_list, beta_angle , arrangeLIST_ELM , matID , sec_ID_list_arranged,k
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# 2. ------------- PLATE SECTION DEFINITION - Creating a uniform section (beta angle) -------------------
|
|
164
|
+
|
|
165
|
+
# Orient SECTION POINT as per PROVIDED PLANE (USES NUMPY | CAN BE REPLACED WITH SCIPY)
|
|
166
|
+
# RETURNS TRANSFORMED POINT
|
|
167
|
+
def _orientPoint(plane_ax,plane_og,coord):
|
|
168
|
+
#Plane orient
|
|
169
|
+
|
|
170
|
+
Y_new = np.array(plane_ax[1])
|
|
171
|
+
Z_new = np.array(plane_ax[0])
|
|
172
|
+
X_new = np.cross(Y_new, Z_new)
|
|
173
|
+
|
|
174
|
+
Y_new = np.cross(Z_new, X_new) # Recomputing
|
|
175
|
+
|
|
176
|
+
X_new = np.round(X_new / np.linalg.norm(X_new),3)
|
|
177
|
+
Y_new = np.round(Y_new / np.linalg.norm(Y_new),3)
|
|
178
|
+
Z_new = np.round(Z_new / np.linalg.norm(Z_new),3)
|
|
179
|
+
|
|
180
|
+
# Rotation matrix: columns are new basis vectors in original system
|
|
181
|
+
R = np.vstack((X_new, Y_new, Z_new))
|
|
182
|
+
|
|
183
|
+
# Original coordinate
|
|
184
|
+
n_3dCord = coord.copy()
|
|
185
|
+
n_3dCord.append(0)
|
|
186
|
+
v = np.array(n_3dCord)
|
|
187
|
+
# Transform the vector to the new coordinate system
|
|
188
|
+
p_rot = np.dot(R.T, v)
|
|
189
|
+
|
|
190
|
+
# Origin transform
|
|
191
|
+
new_cord = [ p_rot[0]+plane_og[0] , p_rot[1]+plane_og[1] , p_rot[2]+plane_og[2] ]
|
|
192
|
+
return new_cord
|
|
193
|
+
|
|
194
|
+
# Create NODES FOR THE SECTION (NODE CLASS)
|
|
195
|
+
# RETURNS LIST OF NODE IDS
|
|
196
|
+
def _createSectNodes(section_cordinates,plane_axis,plane_origin,beta_ang=0):
|
|
197
|
+
node_ids = []
|
|
198
|
+
|
|
199
|
+
for cord in section_cordinates:
|
|
200
|
+
|
|
201
|
+
X = cord[0]*cos(beta_ang) - cord[1]*sin(beta_ang)
|
|
202
|
+
Y = cord[1]*cos(beta_ang) + cord[0]*sin(beta_ang)
|
|
203
|
+
|
|
204
|
+
ord = _orientPoint(plane_axis,plane_origin,[X,Y]) # Cord is 2D ; ord is 3D
|
|
205
|
+
node_ids.append(Node(ord[0],ord[1],ord[2]).ID)
|
|
206
|
+
|
|
207
|
+
return node_ids
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
# CREATE PLATE ELEMENTS BETWEEN TWO LOCATION (OPTIMISATION CAN BE DONE HERE) (ELEMENT.PLATE CLASS)
|
|
211
|
+
# CHECK AND CREATE THICKNESS WITH OFFSET
|
|
212
|
+
# RETURNS LIST OF NODE IDS FOR START AND END X-SECTION
|
|
213
|
+
def _createTapSectPlate(section_cordinates1,section_cordinates2,sect_lineCon,thk_plate,thk_plate_off,start_plane_axis,start_plane_origin,start_beta_angle,end_plane_axis,end_plane_origin,end_beta_angle,matID):
|
|
214
|
+
|
|
215
|
+
s_nodes = _createSectNodes(section_cordinates1,start_plane_axis,start_plane_origin,start_beta_angle)
|
|
216
|
+
e_nodes = _createSectNodes(section_cordinates2,end_plane_axis,end_plane_origin,end_beta_angle)
|
|
217
|
+
|
|
218
|
+
for i in range(len(sect_lineCon)):
|
|
219
|
+
|
|
220
|
+
thick_id=isCreateThick(thk_plate[i],thk_plate_off[i])
|
|
221
|
+
|
|
222
|
+
p_node = sect_lineCon[i][0]-1
|
|
223
|
+
q_node = sect_lineCon[i][1]-1
|
|
224
|
+
|
|
225
|
+
Element.Plate([s_nodes[p_node] , e_nodes[p_node] , e_nodes[q_node] , s_nodes[q_node]],3,int(matID),thick_id)
|
|
226
|
+
|
|
227
|
+
return s_nodes, e_nodes
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
# CALL ABOVE FUNCTION
|
|
231
|
+
# HANDLES RIGID LINK CREATION
|
|
232
|
+
def createTapPlateAlign(align_points,t_param,beta_angle,Section4Plate,rigid_LNK = False,matID=99):
|
|
233
|
+
''' Alignment points = [ [0,0,0] , [10,1,0] , [20,0,0], [30,1,0]],
|
|
234
|
+
t_param = [0,0.1,0.2,0.3,0.5...] list used for tap section
|
|
235
|
+
Local Z vector of section is assumed [0,0,1]
|
|
236
|
+
Direction is assumed '''
|
|
237
|
+
|
|
238
|
+
align_num_points = len(align_points)
|
|
239
|
+
|
|
240
|
+
align_x_vec = [np.subtract(align_points[1],align_points[0])]
|
|
241
|
+
|
|
242
|
+
for i in range(align_num_points-2):
|
|
243
|
+
align_x_vec.append(np.add(np.subtract(align_points[i+2],align_points[i+1]), np.subtract(align_points[i+1],align_points[i])))
|
|
244
|
+
align_x_vec.append(np.subtract(align_points[-1],align_points[-2]))
|
|
245
|
+
|
|
246
|
+
align_plane = [ [p, [0.0001,0,1]] for p in align_x_vec]
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
for i in range(align_num_points-1):
|
|
250
|
+
ti = t_param[i]
|
|
251
|
+
tf = t_param[i+1]
|
|
252
|
+
shp1 , thk1 , thk_off1= getTapShape(ti,Section4Plate)
|
|
253
|
+
shp2, thk2, thk_off2 = getTapShape(tf,Section4Plate)
|
|
254
|
+
|
|
255
|
+
thk_avg = np.multiply(np.add(thk1,thk2),0.5)
|
|
256
|
+
thk_off_avg = np.multiply(np.add(thk_off1,thk_off2),0.5)
|
|
257
|
+
snode,enode = _createTapSectPlate(shp1,shp2,Section4Plate.LINE,thk_avg,thk_off_avg,align_plane[i],align_points[i],beta_angle[i],align_plane[i+1],align_points[i+1],beta_angle[i+1],matID)
|
|
258
|
+
|
|
259
|
+
if rigid_LNK:
|
|
260
|
+
if i == 0 :
|
|
261
|
+
# beamnode = Node(align_points[0][0],align_points[0][1],align_points[0][2]).ID
|
|
262
|
+
# Boundary.RigidLink(beamnode,list(set(snode)),id=5)
|
|
263
|
+
Boundary.RigidLink(L2P.endNodes[0],list(set(snode)),id=L2P.rgdID)
|
|
264
|
+
elif i == align_num_points-2:
|
|
265
|
+
# beamnode = Node(align_points[-1][0],align_points[-1][1],align_points[-1][2]).ID
|
|
266
|
+
# Boundary.RigidLink(beamnode,list(set(enode)),id=5)
|
|
267
|
+
Boundary.RigidLink(L2P.endNodes[-1],list(set(enode)),id=L2P.rgdID)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
# 3 . ------------------ Smooth Alignment creation ------------------
|
|
272
|
+
|
|
273
|
+
def interpolateAlignment(pointsArray,betaAngle,n_seg=10,deg=2,mSize=0):
|
|
274
|
+
''' Returns point list and beta angle list'''
|
|
275
|
+
from scipy.interpolate import splev, splprep
|
|
276
|
+
pointsArray = np.array(pointsArray)
|
|
277
|
+
x_p, y_p , z_p = pointsArray[:,0] , pointsArray[:,1] , pointsArray[:,2]
|
|
278
|
+
ang_p = betaAngle
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
#-- Actual length ----
|
|
282
|
+
dxq = np.diff(x_p)
|
|
283
|
+
dyq = np.diff(y_p)
|
|
284
|
+
dzq = np.diff(z_p)
|
|
285
|
+
dlq=[0]
|
|
286
|
+
for i in range(len(dxq)):
|
|
287
|
+
dlq.append(hypot(dxq[i],dyq[i],dzq[i]))
|
|
288
|
+
|
|
289
|
+
deg = min(deg,len(pointsArray)-1)
|
|
290
|
+
tck, u = splprep([x_p, y_p, z_p, ang_p], s=0, k=deg)
|
|
291
|
+
|
|
292
|
+
u_fine = np.linspace(0, 1, 200)
|
|
293
|
+
x_den, y_den, z_den, ang_den = splev(u_fine, tck)
|
|
294
|
+
|
|
295
|
+
dx = np.diff(x_den)
|
|
296
|
+
dy = np.diff(y_den)
|
|
297
|
+
dz = np.diff(z_den)
|
|
298
|
+
dl=[]
|
|
299
|
+
for i in range(len(dx)):
|
|
300
|
+
dl.append(hypot(dx[i],dy[i],dz[i]))
|
|
301
|
+
|
|
302
|
+
cum_l = np.insert(np.cumsum(dl),0,0)
|
|
303
|
+
total_l = cum_l[-1]
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
if n_seg==0 or mSize!=0:
|
|
307
|
+
n_seg=int(total_l/mSize)
|
|
308
|
+
|
|
309
|
+
eq_len = np.linspace(0,total_l,n_seg+1)
|
|
310
|
+
|
|
311
|
+
interp_u = np.interp(eq_len,cum_l,u_fine)
|
|
312
|
+
interp_x, interp_y , interp_z, iterp_ang = splev(interp_u, tck)
|
|
313
|
+
|
|
314
|
+
align_fine_points = [ [x, y, z] for x, y, z in zip(interp_x, interp_y , interp_z) ]
|
|
315
|
+
|
|
316
|
+
return align_fine_points,iterp_ang, interp_u , u
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
class plateTapSection:
|
|
320
|
+
|
|
321
|
+
def __init__(self,SecPoint_arr, cg_arr, t_param_arr, line_conn_arr,thk_arr,thk_off_arr):
|
|
322
|
+
''' SecPoint_arr = [SP1, SP2, SP3] | cg_arr = [[0,0],[0,0]] | t_param_arr = [0,0.5,1] | thk_arr = [[0.25],[0.3]] '''
|
|
323
|
+
|
|
324
|
+
for q,shape in enumerate(SecPoint_arr):
|
|
325
|
+
for i in range(len(shape)):
|
|
326
|
+
shape[i] = [shape[i][0]-cg_arr[q][0] , shape[i][1]-cg_arr[q][1]]
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
self.POINTS = SecPoint_arr
|
|
330
|
+
self.T = t_param_arr
|
|
331
|
+
self.THICK = thk_arr
|
|
332
|
+
self.THICK_OFF = thk_off_arr
|
|
333
|
+
self.LINE = line_conn_arr
|
|
334
|
+
self.TYPE = 'TAP'
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
def intpolatePOINTS(t,S1,t1,S2,t2):
|
|
338
|
+
t_diff = t2-t1
|
|
339
|
+
|
|
340
|
+
S1_scaled = np.multiply(S1,((t2-t)/t_diff))
|
|
341
|
+
S2_scaled = np.multiply(S2,((t-t1)/t_diff))
|
|
342
|
+
|
|
343
|
+
S_t = np.add(S1_scaled,S2_scaled)
|
|
344
|
+
|
|
345
|
+
return S_t
|
|
346
|
+
|
|
347
|
+
def intpolateScalar(t,S1,t1,S2,t2):
|
|
348
|
+
t_diff = t2-t1
|
|
349
|
+
|
|
350
|
+
S1_scaled = S1*(t2-t)/t_diff
|
|
351
|
+
S2_scaled = S2*(t-t1)/t_diff
|
|
352
|
+
|
|
353
|
+
S_t = S1_scaled+S2_scaled
|
|
354
|
+
|
|
355
|
+
return S_t
|
|
356
|
+
|
|
357
|
+
def getTapShape(t,plateTapSect):
|
|
358
|
+
eq_chk = 0
|
|
359
|
+
i_c = 0
|
|
360
|
+
for i in range(len(plateTapSect.T)):
|
|
361
|
+
if t == plateTapSect.T[i_c] :
|
|
362
|
+
eq_chk=1
|
|
363
|
+
break
|
|
364
|
+
elif t > plateTapSect.T[i_c] and t < plateTapSect.T[i_c+1]:
|
|
365
|
+
break
|
|
366
|
+
i_c+=1
|
|
367
|
+
|
|
368
|
+
thick_curr = plateTapSect.THICK[i_c]
|
|
369
|
+
thick_off_curr = plateTapSect.THICK_OFF[i_c]
|
|
370
|
+
|
|
371
|
+
if eq_chk:
|
|
372
|
+
return plateTapSect.POINTS[i_c] , thick_curr, thick_off_curr
|
|
373
|
+
else:
|
|
374
|
+
ti = plateTapSect.T[i_c]
|
|
375
|
+
tf = plateTapSect.T[i_c+1]
|
|
376
|
+
|
|
377
|
+
Si = plateTapSect.POINTS[i_c]
|
|
378
|
+
Sf = plateTapSect.POINTS[i_c+1]
|
|
379
|
+
|
|
380
|
+
thi=plateTapSect.THICK[i_c]
|
|
381
|
+
thf=plateTapSect.THICK[i_c+1]
|
|
382
|
+
|
|
383
|
+
th_off_i=plateTapSect.THICK_OFF[i_c]
|
|
384
|
+
th_off_f=plateTapSect.THICK_OFF[i_c+1]
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
return intpolatePOINTS(t,Si,ti,Sf,tf) , intpolatePOINTS(t,thi,ti,thf,tf), intpolatePOINTS(t,th_off_i,ti,th_off_f,tf)
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
def isCreateThick(thick,thick_off):
|
|
392
|
+
thick = round(thick,3)
|
|
393
|
+
thick_off = round(thick_off,4)
|
|
394
|
+
|
|
395
|
+
if f'{thick}+{thick_off}' in L2P.thick_js:
|
|
396
|
+
return L2P.thick_js[f'{thick}+{thick_off}']
|
|
397
|
+
else:
|
|
398
|
+
tid= Thickness(thick,offset=thick_off,off_type='val').ID
|
|
399
|
+
L2P.thick_js[f'{thick}+{thick_off}']=tid
|
|
400
|
+
return tid
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
#----------------------------------------------------------------
|
|
404
|
+
def Mesh_SHAPE(shape:Section,meshSize=0.1):
|
|
405
|
+
''' Shape is a object from midas library
|
|
406
|
+
Retrurns Section points (SHAPE), Thickness, CG , Line connection of plates'''
|
|
407
|
+
|
|
408
|
+
sect_shape, sect_thk ,sect_thk_off, sect_cgs , sect_lin_con = shape._centerLine(L2P.first) # I end for first then J end
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
sect_cg_LT , sect_cg_CC , sect_cg_RB = sect_cgs
|
|
412
|
+
# print(sect_cg_LT , sect_cg_CC , sect_cg_RB)
|
|
413
|
+
|
|
414
|
+
offset_CG1 = [L2P.CG_data[str(shape.ID)]['Y1'],-L2P.CG_data[str(shape.ID)]['Z1']]
|
|
415
|
+
offset_CG2 = [-L2P.CG_data[str(shape.ID)]['Y2'],L2P.CG_data[str(shape.ID)]['Z2']]
|
|
416
|
+
sect_cg_CC1 = np.add(sect_cg_LT,offset_CG1)
|
|
417
|
+
sect_cg_CC2 = np.add(sect_cg_RB,offset_CG2)
|
|
418
|
+
|
|
419
|
+
sect_cg_CC = np.multiply(0.5,np.add(sect_cg_CC1,sect_cg_CC2))
|
|
420
|
+
|
|
421
|
+
offset_pt = shape.OFFSET.JS['OFFSET_PT']
|
|
422
|
+
offset_loc = {
|
|
423
|
+
'LT': sect_cg_LT,
|
|
424
|
+
'LC': [sect_cg_LT[0],sect_cg_CC[1]],
|
|
425
|
+
'LB': [sect_cg_LT[0],sect_cg_RB[1]],
|
|
426
|
+
'CT': [sect_cg_CC[0],sect_cg_LT[1]],
|
|
427
|
+
'CC': sect_cg_CC,
|
|
428
|
+
'CB': [sect_cg_CC[0],sect_cg_RB[1]],
|
|
429
|
+
'RT': [sect_cg_RB[0],sect_cg_LT[1]],
|
|
430
|
+
'RC': [sect_cg_RB[0],sect_cg_CC[1]],
|
|
431
|
+
'RB': sect_cg_RB
|
|
432
|
+
}
|
|
433
|
+
sect_cg = offset_loc[offset_pt]
|
|
434
|
+
# ----------------- MESH SIZER --------------------------
|
|
435
|
+
|
|
436
|
+
n_nodes = len(sect_shape)
|
|
437
|
+
|
|
438
|
+
if L2P.nDivMESH == []:
|
|
439
|
+
for i in (range(len(sect_lin_con))):
|
|
440
|
+
if isinstance(sect_thk[i],(int,float)): sect_thk[i] = [sect_thk[i],sect_thk[i]]
|
|
441
|
+
if isinstance(sect_thk_off[i],(int,float)): sect_thk_off[i] = [sect_thk_off[i],sect_thk_off[i]]
|
|
442
|
+
p1 = sect_shape[sect_lin_con[i][0]-1]
|
|
443
|
+
p2 = sect_shape[sect_lin_con[i][1]-1]
|
|
444
|
+
dis = hypot(p1[0]-p2[0],p1[1]-p2[1])
|
|
445
|
+
n_div = max(int(dis/meshSize),1)
|
|
446
|
+
L2P.nDivMESH.append(n_div)
|
|
447
|
+
if n_div > 1 :
|
|
448
|
+
i_loc = np.linspace(p1,p2,n_div+1)
|
|
449
|
+
i_thk = np.linspace(sect_thk[i][0],sect_thk[i][1],n_div+1)
|
|
450
|
+
i_thk_off = np.linspace(sect_thk_off[i][0],sect_thk_off[i][1],n_div+1)
|
|
451
|
+
|
|
452
|
+
for q in range(n_div-1):
|
|
453
|
+
sect_shape.append(i_loc[q+1])
|
|
454
|
+
|
|
455
|
+
sect_lin_con.append([n_nodes+n_div-1,int(sect_lin_con[i][1])])
|
|
456
|
+
sect_thk.append([i_thk[-2],i_thk[-1]])
|
|
457
|
+
sect_thk_off.append([i_thk_off[-2],i_thk_off[-1]])
|
|
458
|
+
sect_lin_con[i][1] = n_nodes+1
|
|
459
|
+
sect_thk[i][1] = i_thk[1]
|
|
460
|
+
sect_thk_off[i][1] = i_thk_off[1]
|
|
461
|
+
|
|
462
|
+
for q in range(n_div-2):
|
|
463
|
+
sect_lin_con.append([n_nodes+q+1,n_nodes+q+2])
|
|
464
|
+
sect_thk.append([i_thk[q+1],i_thk[q+2]])
|
|
465
|
+
sect_thk_off.append([i_thk_off[q+1],i_thk_off[q+2]])
|
|
466
|
+
|
|
467
|
+
n_nodes+=n_div-1
|
|
468
|
+
else:
|
|
469
|
+
for i in (range(len(sect_lin_con))):
|
|
470
|
+
if isinstance(sect_thk[i],(int,float)): sect_thk[i] = [sect_thk[i],sect_thk[i]]
|
|
471
|
+
if isinstance(sect_thk_off[i],(int,float)): sect_thk_off[i] = [sect_thk_off[i],sect_thk_off[i]]
|
|
472
|
+
p1 = sect_shape[sect_lin_con[i][0]-1]
|
|
473
|
+
p2 = sect_shape[sect_lin_con[i][1]-1]
|
|
474
|
+
n_div = L2P.nDivMESH[i]
|
|
475
|
+
if n_div > 1 :
|
|
476
|
+
i_loc = np.linspace(p1,p2,n_div+1)
|
|
477
|
+
i_thk = np.linspace(sect_thk[i][0],sect_thk[i][1],n_div+1)
|
|
478
|
+
i_thk_off = np.linspace(sect_thk_off[i][0],sect_thk_off[i][1],n_div+1)
|
|
479
|
+
|
|
480
|
+
for q in range(n_div-1):
|
|
481
|
+
sect_shape.append(i_loc[q+1])
|
|
482
|
+
|
|
483
|
+
sect_lin_con.append([n_nodes+n_div-1,int(sect_lin_con[i][1])])
|
|
484
|
+
sect_thk.append([i_thk[-2],i_thk[-1]])
|
|
485
|
+
sect_thk_off.append([i_thk_off[-2],i_thk_off[-1]])
|
|
486
|
+
sect_lin_con[i][1] = n_nodes+1
|
|
487
|
+
sect_thk[i][1] = i_thk[1]
|
|
488
|
+
sect_thk_off[i][1] = i_thk_off[1]
|
|
489
|
+
|
|
490
|
+
for q in range(n_div-2):
|
|
491
|
+
sect_lin_con.append([n_nodes+q+1,n_nodes+q+2])
|
|
492
|
+
sect_thk.append([i_thk[q+1],i_thk[q+2]])
|
|
493
|
+
sect_thk_off.append([i_thk_off[q+1],i_thk_off[q+2]])
|
|
494
|
+
|
|
495
|
+
n_nodes+=n_div-1
|
|
496
|
+
|
|
497
|
+
for i in range(len(sect_thk)):
|
|
498
|
+
sect_thk[i] = (sect_thk[i][0]+sect_thk[i][1])*0.5 #Averaging the thickness and OFFSET
|
|
499
|
+
sect_thk_off[i] = (sect_thk_off[i][0]+sect_thk_off[i][1])*0.5
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
L2P.first=1
|
|
503
|
+
return sect_shape, sect_thk ,sect_thk_off, sect_cg , sect_lin_con
|
|
504
|
+
|
|
505
|
+
def getCGdata():
|
|
506
|
+
js = {
|
|
507
|
+
"Argument": {
|
|
508
|
+
"TABLE_NAME": "SUMIT_CG",
|
|
509
|
+
"TABLE_TYPE": "SECTIONALL",
|
|
510
|
+
"COMPONENTS" : ["ID","Cyp","Cym","Czp","Czm"]
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
cg_points = MidasAPI('POST','/post/TABLE',js)
|
|
514
|
+
L2P.CG_data = {}
|
|
515
|
+
for data in cg_points['SUMIT_CG']['DATA']:
|
|
516
|
+
L2P.CG_data[data[1]] = {"Y1" : float(data[3]) , "Z1" : float(data[4]) , "Y2" : float(data[2]) , "Z2" : float(data[5])}
|
|
517
|
+
# print(L2P.CG_data)
|
|
518
|
+
|
|
519
|
+
def SS_create(nSeg , mSize , bRigdLnk , meshSize, elemList):
|
|
520
|
+
# ORIGINAL ALIGNMENT
|
|
521
|
+
pbar = tqdm(total=15,desc="Converting Line to Plate ")
|
|
522
|
+
|
|
523
|
+
pbar.update(1)
|
|
524
|
+
pbar.set_description_str("Updating Units...")
|
|
525
|
+
Model.units()
|
|
526
|
+
|
|
527
|
+
pbar.update(1)
|
|
528
|
+
pbar.set_description_str("Deleting Elements and Nodes...")
|
|
529
|
+
sorted_node_list , align_points, align_beta_angle , elm_list, matID , align_sectID_list_sorted,k = delSelectElements(elemList) # Select elements
|
|
530
|
+
|
|
531
|
+
L2P.sorted_nodes = sorted_node_list
|
|
532
|
+
# NEW SMOOTH ALIGNMENT
|
|
533
|
+
fine_align_points = align_points
|
|
534
|
+
fine_beta_angle = align_beta_angle
|
|
535
|
+
|
|
536
|
+
fine_align_points, fine_beta_angle, fine_t_param, align_t_param = interpolateAlignment(align_points,align_beta_angle,nSeg,2,mSize)
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
pbar.update(1)
|
|
540
|
+
pbar.set_description_str("Getting Section Data...")
|
|
541
|
+
Section.sync()
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
pbar.update(1)
|
|
545
|
+
pbar.set_description_str("Processing Sections...")
|
|
546
|
+
|
|
547
|
+
getCGdata()
|
|
548
|
+
|
|
549
|
+
sect_shape_arr = []
|
|
550
|
+
sect_points_arr =[]
|
|
551
|
+
cg_arr = []
|
|
552
|
+
thk_arr =[]
|
|
553
|
+
thk_off_arr =[]
|
|
554
|
+
lin =[]
|
|
555
|
+
|
|
556
|
+
align_sectID_list_sorted.insert(0, align_sectID_list_sorted[0]) # ADD first section again to match node count
|
|
557
|
+
|
|
558
|
+
for Sid in align_sectID_list_sorted:
|
|
559
|
+
for sect in Section.sect:
|
|
560
|
+
if sect.ID == Sid:
|
|
561
|
+
sect_shape_arr.append(sect)
|
|
562
|
+
|
|
563
|
+
pbar.update(1)
|
|
564
|
+
pbar.set_description_str("Generating Shell definition...")
|
|
565
|
+
for shape in sect_shape_arr:
|
|
566
|
+
sect_shape, sect_thk , sect_thk_off, sect_cg , sect_lin_con = Mesh_SHAPE(shape,meshSize)
|
|
567
|
+
sect_points_arr.append(sect_shape)
|
|
568
|
+
thk_arr.append(sect_thk)
|
|
569
|
+
thk_off_arr.append(sect_thk_off)
|
|
570
|
+
cg_arr.append(sect_cg)
|
|
571
|
+
lin = sect_lin_con
|
|
572
|
+
|
|
573
|
+
# print('- . '*20)
|
|
574
|
+
# print(cg_arr)
|
|
575
|
+
# print('- . '*20)
|
|
576
|
+
# print(sect_points_arr)
|
|
577
|
+
# print('- . '*20)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
pbar.update(1)
|
|
581
|
+
pbar.set_description_str("Getting existing Node data...")
|
|
582
|
+
Node.clear()
|
|
583
|
+
# Node.sync()
|
|
584
|
+
Node.ids=[Model.maxID('NODE')]
|
|
585
|
+
|
|
586
|
+
pbar.update(1)
|
|
587
|
+
pbar.set_description_str("Getting existing Element data...")
|
|
588
|
+
Element.clear()
|
|
589
|
+
# Element.ids = [Model.maxID('ELEM')]
|
|
590
|
+
Element.maxID = Model.maxID('ELEM')
|
|
591
|
+
|
|
592
|
+
pbar.update(1)
|
|
593
|
+
pbar.set_description_str("Getting existing Thickness data...")
|
|
594
|
+
Thickness.clear()
|
|
595
|
+
Thickness.ids = [Model.maxID('THIK')]
|
|
596
|
+
|
|
597
|
+
if bRigdLnk:
|
|
598
|
+
pbar.update(1)
|
|
599
|
+
pbar.set_description_str("Getting existing Rigid Link data...")
|
|
600
|
+
Boundary.RigidLink.clear()
|
|
601
|
+
Boundary.RigidLink.ids = [Model.maxID('RIGD')]
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
pbar.update(1)
|
|
605
|
+
pbar.set_description_str("Creating Shell data...")
|
|
606
|
+
myTapShape = plateTapSection(sect_points_arr,cg_arr,align_t_param,lin,thk_arr,thk_off_arr)
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
createTapPlateAlign(fine_align_points,fine_t_param,fine_beta_angle,myTapShape,bRigdLnk,matID)
|
|
610
|
+
|
|
611
|
+
pbar.update(1)
|
|
612
|
+
pbar.set_description_str("Creating Nodes...")
|
|
613
|
+
Node.create()
|
|
614
|
+
pbar.update(1)
|
|
615
|
+
pbar.set_description_str("Creating Elements...")
|
|
616
|
+
Element.create()
|
|
617
|
+
pbar.update(1)
|
|
618
|
+
pbar.set_description_str("Creating Thickness...")
|
|
619
|
+
Thickness.create()
|
|
620
|
+
pbar.update(1)
|
|
621
|
+
pbar.set_description_str("Creating Rigid Links...")
|
|
622
|
+
Boundary.RigidLink.create()
|
|
623
|
+
|
|
624
|
+
# RESET the function
|
|
625
|
+
L2P.first = 0
|
|
626
|
+
L2P.nDivMESH =[]
|
|
627
|
+
L2P.CG_data = {}
|
|
628
|
+
L2P.thick_js = {}
|
|
629
|
+
L2P.sorted_nodes = []
|
|
630
|
+
L2P.endNodes = []
|
|
631
|
+
L2P.rgdID +=1
|
|
632
|
+
|
|
633
|
+
pbar.update(1)
|
|
634
|
+
pbar.set_description_str(Fore.GREEN+"Line to Plate conversion done"+Style.RESET_ALL)
|
|
635
|
+
|
|
636
|
+
# SS_create(0,1,True,0.5)
|