midas-civil 0.0.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.

Potentially problematic release.


This version of midas-civil might be problematic. Click here for more details.

@@ -0,0 +1,139 @@
1
+ from ._mapi import *
2
+
3
+
4
+
5
+ def _ThikADD(self):
6
+ # Commom HERE ---------------------------------------------
7
+ id = int(self.ID)
8
+ if Thickness.ids == []:
9
+ count = 1
10
+ else:
11
+ count = max(Thickness.ids)+1
12
+
13
+ if id==0 :
14
+ self.ID = count
15
+ Thickness.thick.append(self)
16
+ Thickness.ids.append(int(self.ID))
17
+ elif id in Thickness.ids:
18
+ self.ID=int(id)
19
+ print(f'⚠️ Thickness with ID {id} already exist! It will be replaced.')
20
+ index=Thickness.ids.index(id)
21
+ Thickness.thick[index]=self
22
+ else:
23
+ self.ID=id
24
+ Thickness.thick.append(self)
25
+ Thickness.ids.append(int(self.ID))
26
+ # Common END -------------------------------------------------------
27
+
28
+
29
+ def _updateThik(self):
30
+ js2s = {'Assign':{self.ID : _Obj2JS(self)}}
31
+ MidasAPI('PUT','/db/sect',js2s)
32
+ return js2s
33
+
34
+
35
+ def _Obj2JS(obj):
36
+
37
+ js={
38
+ "NAME": obj.NAME,
39
+ "TYPE": obj.TYPE,
40
+ "bINOUT": obj.bINOUT,
41
+ "T_IN": obj.T_IN,
42
+ "T_OUT": obj.T_OUT,
43
+ "OFFSET": obj.OFF_TYPE,
44
+ "O_VALUE": obj.OFFSET
45
+ }
46
+ return js
47
+
48
+
49
+
50
+ def _JS2Obj(id,js):
51
+ name = js['NAME']
52
+ type = js['TYPE']
53
+ binout = js['bINOUT']
54
+ t_in = js['T_IN']
55
+ t_out = js['T_OUT']
56
+ offset = js['OFFSET']
57
+ off_value = js['O_VALUE']
58
+
59
+ t_out2=-1
60
+ if binout:t_out2 = t_out
61
+
62
+ if type == 'VALUE':
63
+ Thickness(t_in,t_out2,off_value,offset,name,id)
64
+
65
+
66
+
67
+ class _common:
68
+ def __str__(self):
69
+ return str(f'ID = {self.ID} \nJSON : {_Obj2JS(self)}\n')
70
+
71
+ def update(self):
72
+ return _updateThik(self)
73
+
74
+
75
+ class Thickness(_common):
76
+ """Create Thicknes"""
77
+ thick = []
78
+ ids = []
79
+
80
+ def __init__(self,thick=0.0,thick_out=-1,offset=0,off_type='rat',name="",id=0):
81
+ self.ID = id
82
+ self.NAME = name
83
+ self.TYPE = 'VALUE'
84
+ self.T_IN = thick
85
+ self.bINOUT = True
86
+
87
+ if thick_out==-1:
88
+ self.T_OUT = thick
89
+ self.bINOUT = False
90
+ else: self.T_OUT = thick_out
91
+
92
+ self.OFFSET = offset
93
+
94
+ if off_type=='rat':
95
+ self.OFF_TYPE = 1
96
+ else: self.OFF_TYPE = 2
97
+
98
+ if offset==0:
99
+ self.OFF_TYPE =0
100
+
101
+ _ThikADD(self)
102
+
103
+
104
+ @classmethod
105
+ def json(cls):
106
+ json = {"Assign":{}}
107
+ for sect in cls.thick:
108
+ js = _Obj2JS(sect)
109
+ json["Assign"][sect.ID] = js
110
+ return json
111
+
112
+ @staticmethod
113
+ def create():
114
+ MidasAPI("PUT","/db/THIK",Thickness.json())
115
+
116
+ @staticmethod
117
+ def get():
118
+ return MidasAPI("GET","/db/THIK")
119
+
120
+
121
+ @staticmethod
122
+ def delete():
123
+ MidasAPI("DELETE","/db/THIK")
124
+ Thickness.thick=[]
125
+ Thickness.ids=[]
126
+
127
+
128
+ @staticmethod
129
+ def sync():
130
+ a = Thickness.get()
131
+ if a != {'message': ''}:
132
+ if list(a['THIK'].keys()) != []:
133
+ Thickness.thick = []
134
+ Thickness.ids=[]
135
+ for sect_id in a['THIK'].keys():
136
+ _JS2Obj(sect_id,a['THIK'][sect_id])
137
+
138
+
139
+
midas_civil/_utils.py ADDED
@@ -0,0 +1,83 @@
1
+ from ._model import *
2
+ from ._mapi import *
3
+
4
+ #Function to remove duplicate set of values from 2 lists
5
+ # def unique_lists(li1, li2):
6
+ # if type (li1) == list and type (li2) == list:
7
+ # if len(li1) == len(li2):
8
+ # indices_to_remove = []
9
+ # for i in range(len(li1)):
10
+ # for j in range(i+1,len(li1)):
11
+ # if li1[i] == li1[j] and li2[i] == li2[j]:
12
+ # indices_to_remove.append(j)
13
+ # for index in sorted(indices_to_remove, reverse = True):
14
+ # del li1[index]
15
+ # del li2[index]
16
+
17
+
18
+ # def sect_inp(sec):
19
+ # """Section ID. Enter one section id or list of section IDs. Sample: sect_inp(1) OR sect_inp([3,2,5])"""
20
+ # Model.units()
21
+ # a = MidasAPI("GET","/db/SECT",{"Assign":{}})
22
+ # if type(sec)==int: sec = [sec]
23
+ # b={}
24
+ # for s in sec:
25
+ # if str(s) in a['SECT'].keys() : b.update({s : a['SECT'][str(s)]})
26
+ # # if elem = [0] and sec!=0: b.update({sec : })
27
+ # if b == {}: b = "The required section ID is not defined in connected model file."
28
+ # return(b)
29
+ #---------------------------------------------------------------------------------------------------------------
30
+
31
+
32
+ def sFlatten(list_of_list):
33
+ # list_of_list = [list_of_list]
34
+ return [item for elem in list_of_list for item in (elem if isinstance(elem, list) else [elem])]
35
+
36
+ # def getID_orig(element_list):
37
+ # """Return ID of Node and Element"""
38
+ # return [beam.ID for beam in sFlatten(element_list)]
39
+
40
+ def getID(*objects):
41
+ objects = list(objects)
42
+ _getID2(objects)
43
+ return objects
44
+
45
+ def _getID2(objects):
46
+ for i in range(len(objects)):
47
+ if isinstance(objects[i], list):
48
+ _getID2(objects[i]) # Recursive call for sublist
49
+ else:
50
+ objects[i] = objects[i].ID
51
+
52
+
53
+
54
+ def getNodeID(*objects):
55
+ objects = list(objects)
56
+ _getNodeID2(objects)
57
+ return objects
58
+
59
+ def _getNodeID2(objects):
60
+ for i in range(len(objects)):
61
+ if isinstance(objects[i], list):
62
+ _getNodeID2(objects[i]) # Recursive call for sublist
63
+ else:
64
+ objects[i] = objects[i].NODES
65
+
66
+
67
+
68
+
69
+ # def getNodeID_orig(element_list):
70
+ # """Return Node IDs of Element"""
71
+ # # return list(sFlatten([beam.NODES for beam in sFlatten(element_list)]))
72
+ # return list(sFlatten([beam.NODES for beam in sFlatten(element_list)]))
73
+
74
+
75
+ def arr2csv(nlist):
76
+ strinff = ",".join(map(str,nlist))
77
+ return strinff
78
+
79
+ def zz_add_to_dict(dictionary, key, value):
80
+ if key in dictionary:
81
+ dictionary[key].append(value)
82
+ else:
83
+ dictionary[key] = [value]
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: midas_civil
3
+ Version: 0.0.1
4
+ Summary: Python library for MIDAS Civil NX
5
+ Author: Sumit Shekhar
6
+ Author-email: sumit.midasit@gmail.com
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Dynamic: author
10
+ Dynamic: author-email
11
+ Dynamic: description
12
+ Dynamic: description-content-type
13
+ Dynamic: license-file
14
+ Dynamic: summary
15
+
16
+ # MIDAS CIVIL NX Python
17
+
18
+
19
+ **`midas-civil`** is a Python library that provides an interface to interact with MIDAS Civil NX using Python scripts.
20
+ This library allows engineers and developers to automate tasks, extract structural analysis results, manipulate model data, and integrate MIDAS Civil NX with other tools or pipelines using Python.
21
+
22
+ ---
23
+
24
+ ## Features
25
+
26
+ * **Model Interaction**: Create, modify, and query elements, nodes, materials, sections, and boundary conditions.
27
+
28
+ * **Automation**: Run simulations and extract results automatically using Python scripts.
29
+
30
+ * **Data Extraction**: Access analysis results including forces, displacements, reactions, stresses, etc.
31
+
32
+ * **Integration**: Seamlessly connect MIDAS Civil NX with data analysis tools like pandas, NumPy, and visualization tools like matplotlib.
33
+
34
+
35
+ ## Installation
36
+ You can install the library using pip:
37
+
38
+ ```py
39
+ pip install midas-civil
40
+ ```
41
+
42
+
43
+ **Requirements:**
44
+ * Python 3+
45
+ * MIDAS Civil NX
46
+
47
+
48
+ ## Documentation
49
+ Python Documentation: [midas python](https://sumit-shekhar.github.io/midasapi-python/)
50
+ API Reference: [Manual](https://support.midasuser.com/hc/en-us/articles/33016922742937-MIDAS-API-Online-Manual)
51
+
52
+
53
+ ## License
54
+ This project is licensed under the MIT License.
@@ -0,0 +1,20 @@
1
+ midas_civil/__init__.py,sha256=mq1dqMgS92chPxRbKzoA7X33jpgz5y-8a_CpBvQUmJI,510
2
+ midas_civil/_boundary.py,sha256=gGZtVtYk7ey68KOK8aNk7wGrb4OSDLqo69ynorfiJ58,19138
3
+ midas_civil/_construction.py,sha256=Pj7V-NYCkkT-aMjKXfs1jKa9klsGh48UXDLwn3BLYTY,18225
4
+ midas_civil/_element.py,sha256=RyuJN2XMCrZoBBJ5a0CDbRISocPL0WyuQvYdKes6vMc,7237
5
+ midas_civil/_group.py,sha256=8iZCIB6XEgFz4Z7QEDU3wd7t18xAtNnqetw5Ch1UOeY,10074
6
+ midas_civil/_load.py,sha256=__qVQgbyfAILyoLv8eDGZ_1uMunzzDG1tUu5zWWD-oA,17213
7
+ midas_civil/_mapi.py,sha256=5B6m4csZiERswaVfgI8pQLopfHXmfwaNlJyLsi204Pw,2132
8
+ midas_civil/_material.py,sha256=SCne-yBZwgSA2scRSSotIW_JuMvxlDKjsCQMRIY5DIU,10706
9
+ midas_civil/_model.py,sha256=mQxxarJGCa1Ge3I7VDnlwrhifiFzlKYVWU4hbdohLlk,14924
10
+ midas_civil/_node.py,sha256=yj17RT3Ei7RafWQVHThjwPGUHe3DTQbuv0MwuDjCJro,3513
11
+ midas_civil/_result.py,sha256=siTMENLIwF_6rvydSjP9aQAWaIlt0pReiqNyDhDevGk,24290
12
+ midas_civil/_result_extract.py,sha256=nYR3cYYZVogVje-Y4Y1Lh1S-lCDs_n-1MCwvkmWk6qA,2454
13
+ midas_civil/_section.py,sha256=56RWJdyvDr7Es7Is8Fxq3jPCPP57WW8ECCYZzhm6bf0,26375
14
+ midas_civil/_thickness.py,sha256=Mungooyfo0_JJUmjPCr25h0PSSW_TtEfcMa-hz3YGZA,3146
15
+ midas_civil/_utils.py,sha256=eymiqO8KaTKdhVY3saebqNS0BbUUmGmgw3-ELKqew0A,2611
16
+ midas_civil-0.0.1.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
17
+ midas_civil-0.0.1.dist-info/METADATA,sha256=6n1o8XKl9ZLM9qzHlrsiBbebpiWDb4xJvEN4bszBDV0,1591
18
+ midas_civil-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ midas_civil-0.0.1.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
20
+ midas_civil-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2025] [MIDAS India]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ midas_civil