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.
Files changed (40) hide show
  1. midas_civil/_BoundaryChangeAssignment.py +278 -0
  2. midas_civil/__init__.py +51 -0
  3. midas_civil/_analysiscontrol.py +585 -0
  4. midas_civil/_boundary.py +888 -0
  5. midas_civil/_construction.py +1004 -0
  6. midas_civil/_element.py +1346 -0
  7. midas_civil/_group.py +337 -0
  8. midas_civil/_load.py +967 -0
  9. midas_civil/_loadcomb.py +159 -0
  10. midas_civil/_mapi.py +249 -0
  11. midas_civil/_material.py +1692 -0
  12. midas_civil/_model.py +522 -0
  13. midas_civil/_movingload.py +1479 -0
  14. midas_civil/_node.py +532 -0
  15. midas_civil/_result_table.py +929 -0
  16. midas_civil/_result_test.py +5455 -0
  17. midas_civil/_section/_TapdbSecSS.py +175 -0
  18. midas_civil/_section/__init__.py +413 -0
  19. midas_civil/_section/_compositeSS.py +283 -0
  20. midas_civil/_section/_dbSecSS.py +164 -0
  21. midas_civil/_section/_offsetSS.py +53 -0
  22. midas_civil/_section/_pscSS copy.py +455 -0
  23. midas_civil/_section/_pscSS.py +822 -0
  24. midas_civil/_section/_tapPSC12CellSS.py +565 -0
  25. midas_civil/_section/_unSupp.py +58 -0
  26. midas_civil/_settlement.py +161 -0
  27. midas_civil/_temperature.py +677 -0
  28. midas_civil/_tendon.py +1016 -0
  29. midas_civil/_thickness.py +147 -0
  30. midas_civil/_utils.py +529 -0
  31. midas_civil/_utilsFunc/__init__.py +0 -0
  32. midas_civil/_utilsFunc/_line2plate.py +636 -0
  33. midas_civil/_view.py +891 -0
  34. midas_civil/_view_trial.py +430 -0
  35. midas_civil/_visualise.py +347 -0
  36. midas_civil-1.4.1.dist-info/METADATA +74 -0
  37. midas_civil-1.4.1.dist-info/RECORD +40 -0
  38. midas_civil-1.4.1.dist-info/WHEEL +5 -0
  39. midas_civil-1.4.1.dist-info/licenses/LICENSE +21 -0
  40. midas_civil-1.4.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,175 @@
1
+ from ._offsetSS import Offset
2
+ from ._offsetSS import _common
3
+ from math import sin,cos,pi
4
+
5
+ class _SS_TAPERED_DBUSER(_common):
6
+
7
+ """ Create Standard USER DEFINED sections"""
8
+
9
+ def __init__(self,Name='',Shape='',params_I:list=[],params_J:list=[],Offset=Offset(),useShear=True,use7Dof=False,id:int=0):
10
+ """ Shape = 'SB' 'SR' for rectangle \n For cylinder"""
11
+ self.ID = id
12
+ self.NAME = Name
13
+ self.TYPE = 'TAPERED'
14
+ self.SHAPE = Shape
15
+ self.PARAMS_I = params_I
16
+ self.PARAMS_J = params_J
17
+ self.OFFSET = Offset
18
+ self.USESHEAR = useShear
19
+ self.USE7DOF = use7Dof
20
+ self.DATATYPE = 2
21
+
22
+ def __str__(self):
23
+ return f' > ID = {self.ID} | USER DEFINED STANDARD SECTION \nJSON = {self.toJSON()}\n'
24
+
25
+
26
+ def toJSON(sect):
27
+ js = {
28
+ "SECTTYPE": sect.TYPE,
29
+ "SECT_NAME": sect.NAME,
30
+ "SECT_BEFORE": {
31
+ "SHAPE": sect.SHAPE,
32
+ "TYPE": sect.DATATYPE,
33
+ "SECT_I": {
34
+ "vSIZE": sect.PARAMS_I
35
+ },
36
+ "SECT_J": {
37
+ "vSIZE": sect.PARAMS_J
38
+ }
39
+ }
40
+ }
41
+ js['SECT_BEFORE'].update(sect.OFFSET.JS)
42
+ js['SECT_BEFORE']['USE_SHEAR_DEFORM'] = sect.USESHEAR
43
+ js['SECT_BEFORE']['USE_WARPING_EFFECT'] = sect.USE7DOF
44
+ return js
45
+
46
+ @staticmethod
47
+ def _objectify(id,name,type,shape,offset,uShear,u7DOF,js):
48
+ return _SS_TAPERED_DBUSER(name,shape,js['SECT_BEFORE']['SECT_I']['vSIZE'],js['SECT_BEFORE']['SECT_J']['vSIZE'],offset,uShear,u7DOF,id)
49
+
50
+ def _centerLine(shape,end,*args):
51
+ if end:
52
+ shape.PARAMS = shape.PARAMS_J
53
+ # print(' J end taken')
54
+ else:
55
+ # print(' I end taken')
56
+ shape.PARAMS = shape.PARAMS_I
57
+
58
+ if shape.SHAPE == 'SB' :
59
+ H,B = shape.PARAMS[:2]
60
+
61
+ sect_lin_con = [[1,2],[3,1]]
62
+
63
+ sect_cg_LT = [-B/2,H/2]
64
+ sect_cg_CC = [0,0]
65
+ sect_cg_RB = [B/2,-H/2]
66
+
67
+ if H > B :
68
+ sect_shape = [[0,0],[0,H/2],[0,-H/2],[0,H/4],[0,-H/4]]
69
+ sect_thk = [B,B,B,B]
70
+ sect_thk_off = [0,0,0,0]
71
+ else :
72
+ sect_shape = [[0,0],[B/2,0],[-B/2,0],[B/4,0],[-B/4,0]]
73
+ sect_thk = [H,H,H,H]
74
+ sect_thk_off = [0,0,0,0]
75
+
76
+ elif shape.SHAPE == 'L' :
77
+ H,B,tw,tf = shape.PARAMS[:4]
78
+
79
+ sect_cg_LT = [0,0]
80
+ sect_cg_CC = [(H*tw*tw+B*B*tf)/(2*(B*tw+H*tf)),-(H*H*tw+B*tf*tf)/(2*(B*tw+H*tf))]
81
+ sect_cg_RB = [B,-H]
82
+
83
+ # sect_shape = [[0.5*tw,-H],[0.5*tw,-0.5*tf],[B,-0.5*tf]]
84
+ sect_shape = [[0,-H],[0,0],[B,0]]
85
+ sect_lin_con = [[3,2],[2,1]]
86
+ sect_thk = [tw,tf]
87
+ # sect_thk_off = [0,0]
88
+ sect_thk_off = [tw/2,tf/2]
89
+
90
+ elif shape.SHAPE == 'C' :
91
+ H,B1,tw,tf1,B2,tf2 = shape.PARAMS[:6]
92
+ if B2 == 0 : B2 = B1
93
+ if tf2 == 0 : tf2 = tf1
94
+
95
+ sect_cg_LT = [0,0]
96
+ sect_cg_CC = [(B1+B2)*0.2,-H*0.5]
97
+ sect_cg_RB = [max(B1,B2),-H]
98
+
99
+ # sect_shape = [[0.5*tw,-0.5*tf1],[B1,-0.5*tf1],[0.5*tw,-H+0.5*tf2],[B2,-H+0.5*tf2]]
100
+ sect_shape = [[0,0],[B1,0],[0,-H],[B2,-H]]
101
+ sect_lin_con = [[2,1],[1,3],[3,4]]
102
+ sect_thk = [tf1,tw,tf2]
103
+ # sect_thk_off = [0,0,0]
104
+ sect_thk_off = [tf1/2,tw/2,tf2/2]
105
+
106
+ elif shape.SHAPE == 'H' :
107
+ H,B1,tw,tf1,B2,tf2,r1,r2 = shape.PARAMS[:8]
108
+ if B2 == 0 : B2 = B1
109
+ if tf2 == 0 : tf2 = tf1
110
+
111
+ sect_cg_LT = [-0.5*max(B1,B2),0.5*H]
112
+ sect_cg_CC = [0,0]
113
+ sect_cg_RB = [0.5*max(B1,B2),-0.5*H]
114
+
115
+ sect_shape = [[-0.5*B1,0.5*(H-tf1)],[0,0.5*(H-tf1)],[0.5*B1,0.5*(H-tf1)],[-0.5*B2,-0.5*(H-tf2)],[0,-0.5*(H-tf2)],[0.5*B2,-0.5*(H-tf2)]]
116
+ sect_lin_con = [[2,1],[3,2],[2,5],[4,5],[5,6]]
117
+ sect_thk = [tf1,tf1,tw,tf2,tf2]
118
+ sect_thk_off = [0,0,0,0,0]
119
+
120
+ elif shape.SHAPE == 'T' :
121
+ H,B,tw,tf = shape.PARAMS[:4]
122
+
123
+ sect_cg_LT = [-B*0.5,0]
124
+ sect_cg_CC = [0,-H*0.3]
125
+ sect_cg_RB = [B*0.5,-H]
126
+
127
+ sect_shape = [[-0.5*B,-0.5*tf],[0,-0.5*tf],[0.5*B,-0.5*tf],[0,-H]]
128
+ sect_lin_con = [[2,1],[3,2],[2,4]]
129
+ sect_thk = [tf,tf,tw]
130
+ sect_thk_off = [0,0,0]
131
+
132
+ elif shape.SHAPE == 'B' :
133
+ H,B,tw,tf1,C,tf2 = shape.PARAMS[:6]
134
+ if tf2 == 0 : tf2 = tf1
135
+
136
+ sect_cg_LT = [-0.5*B,0.5*H]
137
+ sect_cg_CC = [0,0]
138
+ sect_cg_RB = [0.5*B,-0.5*H]
139
+
140
+ # sect_shape = [[0.5*(B-tw),0.5*(H-tf1)],[-0.5*(B-tw),0.5*(H-tf1)],[-0.5*(B-tw),-0.5*(H-tf2)],[0.5*(B-tw),-0.5*(H-tf2)]]
141
+ sect_shape = [[0.5*B,0.5*H],[-0.5*B,0.5*H],[-0.5*B,-0.5*H],[0.5*B,-0.5*H]]
142
+
143
+ sect_lin_con = [[1,2],[2,3],[3,4],[4,1]]
144
+ sect_thk = [tf1,tw,tf2,tw]
145
+ # sect_thk_off = [0,0,0,0]
146
+ sect_thk_off = [0.5*tf1,0.5*tw,0.5*tf2,0.5*tw]
147
+
148
+ elif shape.SHAPE == 'P' :
149
+ D,tw = shape.PARAMS[:2]
150
+
151
+ # R = 0.5*(D-tw)
152
+ R = 0.5*D
153
+
154
+ sect_cg_LT = [-R,R]
155
+ sect_cg_CC = [0,0]
156
+ sect_cg_RB = [R,-R]
157
+
158
+ sect_shape = []
159
+ sect_lin_con = []
160
+ sect_thk = []
161
+ sect_thk_off = []
162
+
163
+ n = 16
164
+ for i in range(n):
165
+ sect_shape.append([R*sin(i*2*pi/n),R*cos(i*2*pi/n)])
166
+ sect_lin_con.append([i+1,i+2])
167
+ sect_thk.append(tw)
168
+ sect_thk_off.append(-0.5*tw)
169
+ sect_lin_con[-1] = [i+1,1]
170
+
171
+
172
+
173
+ sect_cg = (sect_cg_LT,sect_cg_CC,sect_cg_RB)
174
+
175
+ return sect_shape, sect_thk ,sect_thk_off, sect_cg , sect_lin_con
@@ -0,0 +1,413 @@
1
+ from ._pscSS import _SS_PSC_12CELL,_SS_PSC_I,_SS_PSC_Value
2
+ from ._dbSecSS import _SS_DBUSER
3
+ from ._offsetSS import Offset
4
+ from ._unSupp import _SS_UNSUPP,_SS_STD_DB
5
+ from ._compositeSS import _SS_COMP_PSC_I,_SS_COMP_STEEL_I_TYPE1
6
+ from ._TapdbSecSS import _SS_TAPERED_DBUSER
7
+
8
+ from ._tapPSC12CellSS import _SS_TAP_PSC_12CELL
9
+
10
+ from midas_civil import MidasAPI
11
+ from typing import Literal
12
+
13
+ _dbsection = Literal["L","C","H","T","B","P","2L","2C","SB","SR","OCT"]
14
+
15
+ class _helperSECTION:
16
+ ID, NAME, SHAPE, TYPE, OFFSET, USESHEAR, USE7DOF = 0,0,0,0,0,0,0
17
+ def update():
18
+ pass
19
+ def toJSON():
20
+ pass
21
+
22
+
23
+ def _SectionADD(self):
24
+ # Commom HERE ---------------------------------------------
25
+ if self.ID==None: id = 0
26
+ else: id = int(self.ID)
27
+
28
+
29
+ if Section.ids == []:
30
+ count = 1
31
+ else:
32
+ count = max(Section.ids)+1
33
+
34
+ if id==0 :
35
+ self.ID = count
36
+ Section.sect.append(self)
37
+ Section.ids.append(int(self.ID))
38
+ elif id in Section.ids:
39
+ self.ID=int(id)
40
+ print(f'⚠️ Section with ID {id} already exist! It will be replaced.')
41
+ index=Section.ids.index(id)
42
+ Section.sect[index]=self
43
+ else:
44
+ self.ID=id
45
+ Section.sect.append(self)
46
+ Section.ids.append(int(self.ID))
47
+ # Common END -------------------------------------------------------
48
+
49
+
50
+
51
+ def off_JS2Obj(js):
52
+
53
+ try: OffsetPoint = js['OFFSET_PT']
54
+ except: OffsetPoint='CC'
55
+ try: CenterLocation = js['OFFSET_CENTER']
56
+ except: CenterLocation=0
57
+ try: HOffset = js['USERDEF_OFFSET_YI']
58
+ except: HOffset=0
59
+ try: HOffOpt = js['HORZ_OFFSET_OPT']
60
+ except: HOffOpt=0
61
+ try: VOffOpt = js['VERT_OFFSET_OPT']
62
+ except: VOffOpt=0
63
+ try: VOffset = js['USERDEF_OFFSET_ZI']
64
+ except: VOffset=0
65
+ try: UsrOffOpt = js['USER_OFFSET_REF']
66
+ except: UsrOffOpt=0
67
+
68
+ return Offset(OffsetPoint,CenterLocation,HOffset,HOffOpt,VOffset,VOffOpt,UsrOffOpt)
69
+
70
+
71
+
72
+ # ------------------- FUNCTION TO CREATE OBJECT used in ELEMENT SYNC --------------------------
73
+ def _JS2OBJ(id,js):
74
+ name = js['SECT_NAME']
75
+ type = js['SECTTYPE']
76
+ shape = js['SECT_BEFORE']['SHAPE']
77
+ offset = off_JS2Obj(js['SECT_BEFORE'])
78
+ uShear = js['SECT_BEFORE']['USE_SHEAR_DEFORM']
79
+ u7DOF = js['SECT_BEFORE']['USE_WARPING_EFFECT']
80
+ if type == 'DBUSER':
81
+ if js['SECT_BEFORE']['DATATYPE'] ==2: obj = _SS_DBUSER._objectify(id,name,type,shape,offset,uShear,u7DOF,js)
82
+ else: obj = _SS_STD_DB(id,name,type,shape,offset,uShear,u7DOF,js)
83
+
84
+ elif type == 'PSC' :
85
+ if shape in ['1CEL','2CEL']: obj = _SS_PSC_12CELL._objectify(id,name,type,shape,offset,uShear,u7DOF,js)
86
+ elif shape in ['PSCI']: obj = _SS_PSC_I._objectify(id,name,type,shape,offset,uShear,u7DOF,js)
87
+ elif shape in ['VALU']: obj = _SS_PSC_Value._objectify(id,name,type,shape,offset,uShear,u7DOF,js)
88
+ else: obj = _SS_UNSUPP(id,name,type,shape,offset,uShear,u7DOF,js)
89
+
90
+ elif type == 'COMPOSITE':
91
+ if shape in ['CI']: obj = _SS_COMP_PSC_I._objectify(id,name,type,shape,offset,uShear,u7DOF,js)
92
+ elif shape in ['I']: obj = _SS_COMP_STEEL_I_TYPE1._objectify(id,name,type,shape,offset,uShear,u7DOF,js)
93
+ else: obj = _SS_UNSUPP(id,name,type,shape,offset,uShear,u7DOF,js)
94
+
95
+ elif type == 'TAPERED' :
96
+ try:
97
+ typeDB = js['SECT_BEFORE']['TYPE']
98
+ except: typeDB = 0
99
+ if typeDB == 2:
100
+ obj = _SS_TAPERED_DBUSER._objectify(id,name,type,shape,offset,uShear,u7DOF,js)
101
+ elif shape in ['1CEL','2CEL']: obj = _SS_TAP_PSC_12CELL._objectify(id,name,type,shape,offset,uShear,u7DOF,js)
102
+ else: obj = _SS_UNSUPP(id,name,type,shape,offset,uShear,u7DOF,js)
103
+
104
+ else :
105
+ obj = _SS_UNSUPP(id,name,type,shape,offset,uShear,u7DOF,js)
106
+
107
+
108
+ _SectionADD(obj)
109
+
110
+
111
+
112
+
113
+
114
+ class Section:
115
+ """ NEW Create Sections \n Use Section.USER , Section.PSC to create sections"""
116
+ sect:list[_helperSECTION] = []
117
+ ids:list[int] = []
118
+
119
+
120
+ @classmethod
121
+ def json(cls):
122
+ json = {"Assign":{}}
123
+ for sect in cls.sect:
124
+ js = sect.toJSON()
125
+ json["Assign"][str(sect.ID)] = js
126
+ return json
127
+
128
+ @staticmethod
129
+ def create():
130
+ MidasAPI("PUT","/db/SECT",Section.json())
131
+
132
+
133
+ @staticmethod
134
+ def get():
135
+ return MidasAPI("GET","/db/SECT")
136
+
137
+
138
+ @staticmethod
139
+ def delete():
140
+ MidasAPI("DELETE","/db/SECT")
141
+ Section.clear()
142
+
143
+ @staticmethod
144
+ def clear():
145
+ Section.sect=[]
146
+ Section.ids=[]
147
+
148
+
149
+ @staticmethod
150
+ def sync():
151
+ a = Section.get()
152
+ if a != {'message': ''}:
153
+ Section.sect = []
154
+ Section.ids=[]
155
+ for sect_id in a['SECT'].keys():
156
+ _JS2OBJ(sect_id,a['SECT'][sect_id])
157
+
158
+
159
+ #--------------------------------- S E C T I O N S ---------------------------------------------
160
+
161
+ #--------------------- D B U S E R --------------------
162
+ @staticmethod
163
+ def DBUSER(Name='',Shape:_dbsection='',parameters:list=[],Offset=Offset(),useShear=True,use7Dof=False,id:int=None):
164
+ args = locals()
165
+ sect_Obj = _SS_DBUSER(**args)
166
+ _SectionADD(sect_Obj)
167
+ return sect_Obj
168
+
169
+ class PSC :
170
+
171
+ @staticmethod
172
+ def CEL12(Name='',Shape='1CEL',Joint=[0,0,0,0,0,0,0,0],
173
+ HO1=0,HO2=0,HO21=0,HO22=0,HO3=0,HO31=0,
174
+ BO1=0,BO11=0,BO12=0,BO2=0,BO21=0,BO3=0,
175
+ HI1=0,HI2=0,HI21=0,HI22=0,HI3=0,HI31=0,HI4=0,HI41=0,HI42=0,HI5=0,
176
+ BI1=0,BI11=0,BI12=0,BI21=0,BI3=0,BI31=0,BI32=0,BI4=0,
177
+ Offset:Offset=Offset.CC(),useShear=True,use7Dof=False,id:int=None):
178
+ args = locals()
179
+ sect_Obj = _SS_PSC_12CELL(**args)
180
+ _SectionADD(sect_Obj)
181
+ return sect_Obj
182
+
183
+ @staticmethod
184
+ def I(Name='',Symm = True,Joint=[0,0,0,0,0,0,0,0,0],
185
+ H1=0,
186
+ HL1=0,HL2=0,HL21=0,HL22=0,HL3=0,HL4=0,HL41=0,HL42=0,HL5=0,
187
+ BL1=0,BL2=0,BL21=0,BL22=0,BL4=0,BL41=0,BL42=0,
188
+ HR1=0,HR2=0,HR21=0,HR22=0,HR3=0,HR4=0,HR41=0,HR42=0,HR5=0,
189
+ BR1=0,BR2=0,BR21=0,BR22=0,BR4=0,BR41=0,BR42=0,
190
+ Offset:Offset=Offset.CC(),useShear=True,use7Dof=False,id:int=None):
191
+
192
+ args = locals()
193
+ sect_Obj = _SS_PSC_I(**args)
194
+
195
+ _SectionADD(sect_Obj)
196
+ return sect_Obj
197
+
198
+ @staticmethod
199
+ def Value(Name:str,
200
+ OuterPolygon:list,InnerPolygon:list=[],
201
+ Offset:Offset=Offset.CC(),useShear=True,use7Dof=False,id:int=None):
202
+
203
+ args = locals()
204
+ sect_Obj = _SS_PSC_Value(**args)
205
+
206
+ _SectionADD(sect_Obj)
207
+ return sect_Obj
208
+
209
+
210
+ class Composite :
211
+ @staticmethod
212
+ def PSCI(Name='',Symm = True,Joint=[0,0,0,0,0,0,0,0,0],
213
+ Bc=0,tc=0,Hh=0,
214
+ H1=0,
215
+ HL1=0,HL2=0,HL21=0,HL22=0,HL3=0,HL4=0,HL41=0,HL42=0,HL5=0,
216
+ BL1=0,BL2=0,BL21=0,BL22=0,BL4=0,BL41=0,BL42=0,
217
+ HR1=0,HR2=0,HR21=0,HR22=0,HR3=0,HR4=0,HR41=0,HR42=0,HR5=0,
218
+ BR1=0,BR2=0,BR21=0,BR22=0,BR4=0,BR41=0,BR42=0,
219
+ EgdEsb =0, DgdDsb=0,Pgd=0,Psb=0,TgdTsb=0,
220
+ MultiModulus = False,CreepEratio=0,ShrinkEratio=0,
221
+ Offset:Offset=Offset.CC(),useShear=True,use7Dof=False,id:int=None):
222
+
223
+ args = locals()
224
+ sect_Obj = _SS_COMP_PSC_I(**args)
225
+
226
+ _SectionADD(sect_Obj)
227
+ return sect_Obj
228
+
229
+ @staticmethod
230
+ def SteelI_Type1(Name='',Bc=0,tc=0,Hh=0,Hw=0,B1=0,tf1=0,tw=0,B2=0,tf2=0,EsEc =0, DsDc=0,Ps=0,Pc=0,TsTc=0,
231
+ MultiModulus = False,CreepEratio=0,ShrinkEratio=0,
232
+ Offset:Offset=Offset.CC(),useShear=True,use7Dof=False,id:int=None):
233
+
234
+ args = locals()
235
+ sect_Obj = _SS_COMP_STEEL_I_TYPE1(**args)
236
+
237
+ _SectionADD(sect_Obj)
238
+ return sect_Obj
239
+
240
+ class Tapered:
241
+
242
+ @staticmethod
243
+ def DBUSER(Name='',Shape='',params_I:list=[],params_J:list=[],Offset=Offset(),useShear=True,use7Dof=False,id:int=None):
244
+ args = locals()
245
+ sect_Obj = _SS_TAPERED_DBUSER(**args)
246
+
247
+ _SectionADD(sect_Obj)
248
+ return sect_Obj
249
+
250
+ @staticmethod
251
+ def PSC12CEL(Name='',Shape='1CEL',Joint=[0,0,0,0,0,0,0,0],
252
+ HO1_I=0,HO2_I=0,HO21_I=0,HO22_I=0,HO3_I=0,HO31_I=0,
253
+ BO1_I=0,BO11_I=0,BO12_I=0,BO2_I=0,BO21_I=0,BO3_I=0,
254
+ HI1_I=0,HI2_I=0,HI21_I=0,HI22_I=0,HI3_I=0,HI31_I=0,HI4_I=0,HI41_I=0,HI42_I=0,HI5_I=0,
255
+ BI1_I=0,BI11_I=0,BI12_I=0,BI21_I=0,BI3_I=0,BI31_I=0,BI32_I=0,BI4_I=0,
256
+
257
+ HO1_J=0,HO2_J=0,HO21_J=0,HO22_J=0,HO3_J=0,HO31_J=0,
258
+ BO1_J=0,BO11_J=0,BO12_J=0,BO2_J=0,BO21_J=0,BO3_J=0,
259
+ HI1_J=0,HI2_J=0,HI21_J=0,HI22_J=0,HI3_J=0,HI31_J=0,HI4_J=0,HI41_J=0,HI42_J=0,HI5_J=0,
260
+ BI1_J=0,BI11_J=0,BI12_J=0,BI21_J=0,BI3_J=0,BI31_J=0,BI32_J=0,BI4_J=0,
261
+
262
+ Offset:Offset=Offset.CC(),useShear=True,use7Dof=False,id:int=None):
263
+ args = locals()
264
+ sect_Obj = _SS_TAP_PSC_12CELL(**args)
265
+
266
+ _SectionADD(sect_Obj)
267
+ return sect_Obj
268
+
269
+
270
+
271
+
272
+ #--------------------------------- T A P E R E D G R O U P ---------------------------------------------
273
+ class TaperedGroup:
274
+
275
+ data = []
276
+
277
+ def __init__(self, name, elem_list, z_var="LINEAR", y_var="LINEAR", z_exp=2.0, z_from="i", z_dist=0,
278
+ y_exp=2.0, y_from="i", y_dist=0, id=""):
279
+ """
280
+ Args:
281
+ name (str): Tapered Group Name (Required).
282
+ elem_list (list): List of element numbers (Required).
283
+ z_var (str): Section shape variation for Z-axis: "LINEAR" or "POLY" (Required).
284
+ y_var (str): Section shape variation for Y-axis: "LINEAR" or "POLY" (Required).
285
+ z_exp (float, optional): Z-axis exponent. Required if z_var is "POLY".
286
+ z_from (str, optional): Z-axis symmetric plane ("i" or "j"). Defaults to "i" for "POLY".
287
+ z_dist (float, optional): Z-axis symmetric plane distance. Defaults to 0 for "POLY".
288
+ y_exp (float, optional): Y-axis exponent. Required if y_var is "POLY".
289
+ y_from (str, optional): Y-axis symmetric plane ("i" or "j"). Defaults to "i" for "POLY".
290
+ y_dist (float, optional): Y-axis symmetric plane distance. Defaults to 0 for "POLY".
291
+ id (str, optional): ID for the tapered group. Auto-generated if not provided.
292
+
293
+ Example:
294
+ Section.TapperGroup("Linear", [1, 2, 3], "LINEAR", "LINEAR")
295
+ Section.TapperGroup("ZPoly", [4, 5], "POLY", "LINEAR", z_exp=2.5)
296
+ """
297
+ self.NAME = name
298
+ self.ELEM_LIST = elem_list
299
+ self.Z_VAR = z_var
300
+ self.Y_VAR = y_var
301
+
302
+ # Z-axis parameters (only for POLY)
303
+ if z_var == "POLY":
304
+ if z_exp is None:
305
+ raise ValueError("z_exp is required when z_var is 'POLY'")
306
+ self.Z_EXP = z_exp
307
+ self.Z_FROM = z_from if z_from is not None else "i"
308
+ self.Z_DIST = z_dist if z_dist is not None else 0
309
+ else:
310
+ self.Z_EXP = None
311
+ self.Z_FROM = None
312
+ self.Z_DIST = None
313
+
314
+ # Y-axis parameters (only for POLY)
315
+ if y_var == "POLY":
316
+ if y_exp is None:
317
+ raise ValueError("y_exp is required when y_var is 'POLY'")
318
+ self.Y_EXP = y_exp
319
+ self.Y_FROM = y_from if y_from is not None else "i"
320
+ self.Y_DIST = y_dist if y_dist is not None else 0
321
+ else:
322
+ self.Y_EXP = None
323
+ self.Y_FROM = None
324
+ self.Y_DIST = None
325
+
326
+ if id == "":
327
+ id = len(Section.TaperedGroup.data) + 1
328
+ self.ID = id
329
+
330
+ Section.TaperedGroup.data.append(self)
331
+
332
+ @classmethod
333
+ def json(cls):
334
+ json_data = {"Assign": {}}
335
+ for i in cls.data:
336
+ # Base data that's always included
337
+ tapper_data = {
338
+ "NAME": i.NAME,
339
+ "ELEMLIST": i.ELEM_LIST,
340
+ "ZVAR": i.Z_VAR,
341
+ "YVAR": i.Y_VAR
342
+ }
343
+
344
+ # Add Z-axis polynomial parameters only if Z_VAR is "POLY"
345
+ if i.Z_VAR == "POLY":
346
+ tapper_data["ZEXP"] = i.Z_EXP
347
+ tapper_data["ZFROM"] = i.Z_FROM
348
+ tapper_data["ZDIST"] = i.Z_DIST
349
+
350
+ # Add Y-axis polynomial parameters only if Y_VAR is "POLY"
351
+ if i.Y_VAR == "POLY":
352
+ tapper_data["YEXP"] = i.Y_EXP
353
+ tapper_data["YFROM"] = i.Y_FROM
354
+ tapper_data["YDIST"] = i.Y_DIST
355
+
356
+ json_data["Assign"][str(i.ID)] = tapper_data
357
+
358
+ return json_data
359
+
360
+ @classmethod
361
+ def create(cls):
362
+ MidasAPI("PUT", "/db/tsgr", cls.json())
363
+
364
+ @classmethod
365
+ def get(cls):
366
+ return MidasAPI("GET", "/db/tsgr")
367
+
368
+ @classmethod
369
+ def delete(cls):
370
+ cls.clear()
371
+ return MidasAPI("DELETE", "/db/tsgr")
372
+
373
+ @classmethod
374
+ def clear(cls):
375
+ cls.data = []
376
+
377
+ @classmethod
378
+ def sync(cls):
379
+ cls.data = []
380
+ response = cls.get()
381
+
382
+ if response and response != {'message': ''}:
383
+ tsgr_data = response.get('TSGR', {})
384
+ # Iterate through the dictionary of tapered groups from the API response
385
+ for tsgr_id, item_data in tsgr_data.items():
386
+ # Extract base parameters
387
+ name = item_data.get('NAME')
388
+ elem_list = item_data.get('ELEMLIST')
389
+ z_var = item_data.get('ZVAR')
390
+ y_var = item_data.get('YVAR')
391
+
392
+ # Extract optional parameters based on variation type
393
+ z_exp = item_data.get('ZEXP') if z_var == "POLY" else None
394
+ z_from = item_data.get('ZFROM') if z_var == "POLY" else None
395
+ z_dist = item_data.get('ZDIST') if z_var == "POLY" else None
396
+
397
+ y_exp = item_data.get('YEXP') if y_var == "POLY" else None
398
+ y_from = item_data.get('YFROM') if y_var == "POLY" else None
399
+ y_dist = item_data.get('YDIST') if y_var == "POLY" else None
400
+
401
+ Section.TaperedGroup(
402
+ name=name,
403
+ elem_list=elem_list,
404
+ z_var=z_var,
405
+ y_var=y_var,
406
+ z_exp=z_exp,
407
+ z_from=z_from,
408
+ z_dist=z_dist,
409
+ y_exp=y_exp,
410
+ y_from=y_from,
411
+ y_dist=y_dist,
412
+ id=tsgr_id
413
+ )