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,278 @@
1
+ from ._mapi import MidasAPI
2
+ from ._load import Load_Case
3
+
4
+
5
+ class BoundaryChangeAssignment:
6
+
7
+ data = []
8
+
9
+ def __init__(self,
10
+ # Support options
11
+ bSPT: bool = False,
12
+ bSPR: bool = False,
13
+ bGSPR: bool = False,
14
+ bCGLINK: bool = False,
15
+ bSSSF: bool = False,
16
+ bPSSF: bool = False,
17
+ bRLS: bool = False,
18
+ bWSSF: bool = False,
19
+ bESSF: bool = False,
20
+ bCDOF: bool = False,
21
+ # Boundary settings
22
+ vBOUNDARY: list = None,
23
+ # Load analysis settings for ST type
24
+ ST_load_assignments: list = None,
25
+ # Load analysis settings for other types
26
+ MV: str = None,
27
+ SM: str = None,
28
+ THRSEV: str = None,
29
+ PO: str = None,
30
+ THNS: str = None,
31
+ ULAT: str = None):
32
+ """
33
+ Boundary Change Assignment constructor.
34
+
35
+ Parameters:
36
+ bSPT: Support (default False)
37
+ bSPR: Point Spring Support (default False)
38
+ bGSPR: General Spring Support (default False)
39
+ bCGLINK: Change General Link Property (default False)
40
+ bSSSF: Section Stiffness Scale Factor (default False)
41
+ bPSSF: Plate Stiffness Scale Factor (default False)
42
+ bRLS: Beam End Release (default False)
43
+ bWSSF: Wall Stiffness Scale Factor (default False)
44
+ bESSF: Element Stiffness Scale Factor (default False)
45
+ bCDOF: Constrain DOF associated with specified displacements/Settlements by boundary group combinations (default False)
46
+ vBOUNDARY: List of boundary assignments in format [["L1", "BG2"], ["L2", "BG1"]]
47
+ ST_load_assignments: List of ST type load cases with BGCNAME assignments in format [["Self-weight", "L1"], ["SIDL", "UNCHANGED"]]
48
+ MV, SM, THRSEV, PO, THNS, ULAT: Boundary group names for respective analysis types
49
+
50
+ Examples:
51
+ # Basic boundary change assignment
52
+ BoundaryChangeAssignment(
53
+ bSPT=True,
54
+ bCDOF=True,
55
+ vBOUNDARY=[["L1", "BG2"], ["L2", "BG1"]],
56
+ ST_load_assignments=[["Self-weight", "L1"]],
57
+ MV="L1"
58
+ )
59
+
60
+ # Complex assignment with multiple load types
61
+ BoundaryChangeAssignment(
62
+ bSPT=True,
63
+ bSPR=False,
64
+ bGSPR=False,
65
+ vBOUNDARY=[["L1", "BG2"], ["L2", "BG1"]],
66
+ ST_load_assignments=[["Self-weight", "L1"], ["SIDL", "L2"]],
67
+ MV="L1",
68
+ SM="L2",
69
+ THRSEV="L1"
70
+ )
71
+ """
72
+
73
+ # ID is always 1 based on the pattern
74
+ self.ID = 1
75
+
76
+ # Set support parameters
77
+ self.bSPT = bSPT
78
+ self.bSPR = bSPR
79
+ self.bGSPR = bGSPR
80
+ self.bCGLINK = bCGLINK
81
+ self.bSSSF = bSSSF
82
+ self.bPSSF = bPSSF
83
+ self.bRLS = bRLS
84
+ self.bWSSF = bWSSF
85
+ self.bESSF = bESSF
86
+ self.bCDOF = bCDOF
87
+
88
+ # Process boundary data
89
+ self.vBOUNDARY = self._process_boundary_data(vBOUNDARY)
90
+
91
+ # Process load analysis data
92
+ self.vLOADANAL = self._process_load_analysis_data(
93
+ ST_load_assignments, MV, SM, THRSEV, PO, THNS, ULAT
94
+ )
95
+
96
+ # Add to static list
97
+ BoundaryChangeAssignment.data.append(self)
98
+
99
+ # Automatically execute the data when instance is created
100
+ self._execute()
101
+
102
+ def _process_boundary_data(self, vBOUNDARY):
103
+ """
104
+ Process boundary data from list format to required JSON structure.
105
+ Input: [["L1", "BG2"], ["L2", "BG1"]]
106
+ Output: [{"BGCNAME": "L1", "vBG": ["BG2"]}, {"BGCNAME": "L2", "vBG": ["BG1"]}]
107
+ """
108
+ if not vBOUNDARY:
109
+ return []
110
+
111
+ boundary_list = []
112
+ for boundary_pair in vBOUNDARY:
113
+ if len(boundary_pair) == 2:
114
+ boundary_list.append({
115
+ "BGCNAME": boundary_pair[0],
116
+ "vBG": [boundary_pair[1]]
117
+ })
118
+
119
+ return boundary_list
120
+
121
+ def _get_load_cases(self):
122
+ """
123
+ Get load cases from the system using Load_Case.get() command.
124
+ This simulates the API call that would retrieve current load cases.
125
+ """
126
+ try:
127
+ # This would be replaced with actual API call: Load_Case.get()
128
+ # For now, using the provided example data structure
129
+ load_cases_response = Load_Case.get()
130
+ return load_cases_response.get('STLD', {})
131
+ except:
132
+ # Fallback to empty if API call fails
133
+ return {}
134
+
135
+ def _convert_st_assignments_to_dict(self, ST_load_assignments):
136
+ """
137
+ Convert ST_load_assignments from list format to dictionary format.
138
+ Input: [["Self-weight", "L1"], ["SIDL", "UNCHANGED"]]
139
+ Output: {"Self-weight": "L1", "SIDL": "UNCHANGED"}
140
+ """
141
+ if not ST_load_assignments:
142
+ return {}
143
+
144
+ assignments_dict = {}
145
+ for assignment_pair in ST_load_assignments:
146
+ if len(assignment_pair) == 2:
147
+ assignments_dict[assignment_pair[0]] = assignment_pair[1]
148
+
149
+ return assignments_dict
150
+
151
+ def _process_load_analysis_data(self, ST_load_assignments, MV, SM, THRSEV, PO, THNS, ULAT):
152
+ """
153
+ Process load analysis data combining user input with system load cases.
154
+ """
155
+ load_anal_list = []
156
+
157
+ # Get current load cases from system
158
+ load_cases = self._get_load_cases()
159
+
160
+ # Process ST type load cases
161
+ st_cases = {case_data['NAME']: case_data for case_data in load_cases.values() } # Assuming ST cases are USER type
162
+
163
+ # Convert ST_load_assignments from list format to dictionary format for internal processing
164
+ st_assignments_dict = self._convert_st_assignments_to_dict(ST_load_assignments)
165
+
166
+ if st_cases:
167
+ for case_name in st_cases.keys():
168
+ bgcname = "UNCHANGED" # Default value
169
+
170
+ # If user provided specific assignment for this load case
171
+ if st_assignments_dict and case_name in st_assignments_dict:
172
+ bgcname = st_assignments_dict[case_name]
173
+
174
+ load_anal_list.append({
175
+ "TYPE": "ST",
176
+ "BGCNAME": bgcname,
177
+ "LCNAME": case_name
178
+ })
179
+
180
+ # Process other load analysis types
181
+ analysis_types = {
182
+ "MV": MV,
183
+ "SM": SM,
184
+ "THRSEV": THRSEV,
185
+ "PO": PO,
186
+ "THNS": THNS,
187
+ "ULAT": ULAT
188
+ }
189
+
190
+ for analysis_type, bgcname in analysis_types.items():
191
+ load_anal_entry = {
192
+ "TYPE": analysis_type,
193
+ "BGCNAME": bgcname if bgcname is not None else "UNCHANGED"
194
+ }
195
+ load_anal_list.append(load_anal_entry)
196
+
197
+ return load_anal_list
198
+
199
+ def _execute(self):
200
+ """
201
+ Automatically sends the BoundaryChangeAssignment to the system when created.
202
+ """
203
+ json_data = {"Assign": {}}
204
+
205
+ boundary_data = {
206
+ "bSPT": self.bSPT,
207
+ "bSPR": self.bSPR,
208
+ "bGSPR": self.bGSPR,
209
+ "bCGLINK": self.bCGLINK,
210
+ "bSSSF": self.bSSSF,
211
+ "bPSSF": self.bPSSF,
212
+ "bRLS": self.bRLS,
213
+ "bWSSF": self.bWSSF,
214
+ "bESSF": self.bESSF,
215
+ "bCDOF": self.bCDOF,
216
+ "vBOUNDARY": self.vBOUNDARY,
217
+ "vLOADANAL": self.vLOADANAL
218
+ }
219
+
220
+ json_data["Assign"][str(self.ID)] = boundary_data
221
+
222
+ # Execute the API call
223
+ MidasAPI("PUT", "/db/bcct", json_data)
224
+
225
+ def __str__(self):
226
+ """
227
+ String representation of the BoundaryChangeAssignment.
228
+ """
229
+ return f"BoundaryChangeAssignment(ID={self.ID}, Boundaries={len(self.vBOUNDARY)}, LoadAnalyses={len(self.vLOADANAL)})"
230
+
231
+ def __repr__(self):
232
+ """
233
+ Detailed representation of the BoundaryChangeAssignment.
234
+ """
235
+ return (f"BoundaryChangeAssignment(ID={self.ID}, "
236
+ f"bSPT={self.bSPT}, bCDOF={self.bCDOF}, "
237
+ f"Boundaries={self.vBOUNDARY}, "
238
+ f"LoadAnalyses={self.vLOADANAL})")
239
+
240
+
241
+
242
+ # Example usage:
243
+ """
244
+ # Example 1: Basic boundary change assignment
245
+ boundary_assignment = BoundaryChangeAssignment(
246
+ bSPT=True,
247
+ bCDOF=True,
248
+ vBOUNDARY=[["L1", "BG2"], ["L2", "BG1"]],
249
+ ST_load_assignments=[["Self-weight", "L1"]],
250
+ MV="L1"
251
+ )
252
+
253
+ # Example 2: Complex assignment with multiple settings
254
+ complex_assignment = BoundaryChangeAssignment(
255
+ bSPT=True,
256
+ bSPR=False,
257
+ bGSPR=False,
258
+ bCGLINK=False,
259
+ bSSSF=False,
260
+ bPSSF=False,
261
+ bRLS=False,
262
+ bCDOF=True,
263
+ vBOUNDARY=[["L1", "BG2"], ["L2", "BG1"]],
264
+ ST_load_assignments=[["Self-weight", "L1"], ["SIDL", "UNCHANGED"]],
265
+ MV="UNCHANGED",
266
+ SM="L2",
267
+ THRSEV="L1",
268
+ PO="UNCHANGED",
269
+ THNS="UNCHANGED",
270
+ ULAT="UNCHANGED"
271
+ )
272
+
273
+ # Example 3: Minimal assignment with defaults
274
+ minimal_assignment = BoundaryChangeAssignment(
275
+ bSPT=True,
276
+ vBOUNDARY=[["L1", "BG2"]]
277
+ )
278
+ """
@@ -0,0 +1,51 @@
1
+ import requests
2
+ from colorama import Fore,Style
3
+ from ._mapi import NX,MidasAPI,MAPI_KEY,MAPI_BASEURL,MAPI_COUNTRY,Midas_help
4
+ _version_ = "1.4.1"
5
+
6
+
7
+ print('\n╭────────────────────────────────────────────────────────────────────────────────────╮')
8
+ print(Style.BRIGHT+f'│ MIDAS CIVIL-NX PYTHON LIBRARY v{_version_} 🐍 │')
9
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
10
+
11
+ if NX.version_check:
12
+ try:
13
+ resp = requests.get("https://pypi.org/pypi/midas_civil/json").json()
14
+ latest_ver = resp["info"]["version"]
15
+ if _version_ != latest_ver:
16
+ print(Fore.YELLOW +'╭─ ⚠️ ──────────────────────────────────────────────────────────────────────────────╮')
17
+ print(f"│ Warning: You are using v{_version_}, but the latest available version is v{latest_ver}. │")
18
+ print(f"│ Run 'pip install midas_civil --upgrade' to update. │")
19
+ print('╰────────────────────────────────────────────────────────────────────────────────────╯\n'+Style.RESET_ALL)
20
+ except:
21
+ pass
22
+
23
+ from ._model import Model
24
+ from ._boundary import Boundary
25
+ from ._utils import getID,getNodeID,utils,getLOC
26
+ from ._node import Node,nodeByID,closestNode,NodeLocalAxis,nodesInRadius,nodesInGroup
27
+ from ._element import Element,elemByID,elemsInGroup #Revise
28
+ from ._group import Group
29
+ from ._load import Load,Load_Case # Revise it
30
+
31
+ from ._loadcomb import LoadCombination
32
+
33
+
34
+ from ._material import Material,CompStrength,CreepShrinkage,TDMatLink
35
+
36
+ from ._section import Section,Offset
37
+
38
+ from ._construction import CS
39
+ from ._thickness import Thickness
40
+ from ._temperature import Temperature
41
+
42
+ from ._tendon import Tendon
43
+ from ._view import View,ResultGraphic,Image
44
+
45
+ from ._movingload import MovingLoad
46
+ from ._settlement import Settlement
47
+ from ._analysiscontrol import AnalysisControl
48
+ from ._BoundaryChangeAssignment import BoundaryChangeAssignment # <=== NEEDS A REVIEW (UNNECESSARY CALL)
49
+
50
+ from ._result_table import Result,TableOptions
51
+