midas-civil 1.0.0__py3-none-any.whl → 1.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.

midas_civil/_group.py CHANGED
@@ -1,29 +1,44 @@
1
1
 
2
2
  from ._mapi import *
3
3
 
4
-
5
-
6
-
4
+ from ._utils import _convItem2List
5
+ from ._utils import sFlatten
7
6
 
8
7
  # ----------- HELPER FUNCTION -----------
9
8
  # -------- RETRIEVE NODE / ELEMENT FROM STRUCTURE GROUP -------
10
9
 
11
- def nodesInGroup(groupName:str) -> list | int:
10
+ def nodesInGroup(groupName:str|list,unique:bool=True) -> list:
12
11
  ''' Returns Node ID list in a Structure Group '''
13
- for i in Group.Structure.Groups:
14
- if i.NAME == groupName:
15
- return i.NLIST
16
- print('⚠️ Structure group not found !')
17
- return []
12
+ groupNames = _convItem2List(groupName)
13
+ nlist = []
14
+ for gName in groupNames:
15
+ chk=1
16
+ for i in Group.Structure.Groups:
17
+ if i.NAME == gName:
18
+ chk=0
19
+ nlist.append(i.NLIST)
20
+ if chk:
21
+ print(f'⚠️ "{gName}" - Structure group not found !')
22
+ if unique:
23
+ return list(dict.fromkeys(sFlatten(nlist)))
24
+ return sFlatten(nlist)
18
25
 
19
26
 
20
- def elemsInGroup(groupName:str) -> list:
27
+ def elemsInGroup(groupName:str|list,unique:bool=True) -> list:
21
28
  ''' Returns Element ID list in a Structure Group '''
22
- for i in Group.Structure.Groups:
23
- if i.NAME == groupName:
24
- return i.ELIST
25
- print('⚠️ Structure group not found !')
26
- return []
29
+ groupNames = _convItem2List(groupName)
30
+ elist = []
31
+ for gName in groupNames:
32
+ chk=1
33
+ for i in Group.Structure.Groups:
34
+ if i.NAME == gName:
35
+ chk=0
36
+ elist.append(i.ELIST)
37
+ if chk:
38
+ print(f'⚠️ "{gName}" - Structure group not found !')
39
+ if unique:
40
+ return list(dict.fromkeys(sFlatten(elist)))
41
+ return sFlatten(elist)
27
42
 
28
43
 
29
44
  # -------- ADD ELEMENT TO STRUCTURE GROUP -------
@@ -116,7 +131,7 @@ class Group:
116
131
  if up == 0: print(f"⚠️ Structure group {name} is not defined!")
117
132
 
118
133
  @classmethod
119
- def json(cls):
134
+ def json(cls) -> dict:
120
135
  """Generates the json file for all defined structure groups."""
121
136
  json = {"Assign":{}}
122
137
  for i in cls.Groups:
@@ -133,7 +148,7 @@ class Group:
133
148
  MidasAPI("PUT",cls.url,cls.json())
134
149
 
135
150
  @classmethod
136
- def get(cls):
151
+ def get(cls) -> dict:
137
152
  return MidasAPI("GET",cls.url)
138
153
 
139
154
 
@@ -177,25 +192,9 @@ class Group:
177
192
  else: self.ID= max(Group.Boundary.ids)+1
178
193
  Group.Boundary.ids.append(self.ID)
179
194
  Group.Boundary.Groups.append(self)
180
-
181
- # @classmethod
182
- # def update(cls, name,operation = "r", nlist = [],elist = [] ):
183
- # """Group name, element list, node list, operation ("add" or "replace").\n
184
- # Sample: update_SG("Girder", [1,2,...20],[],"replace")"""
185
- # up = 0
186
- # for i in cls.Groups:
187
- # if name == i.NAME:
188
- # up = 1
189
- # if operation == "r":
190
- # i.ELIST = list(set(elist))
191
- # i.NLIST = list(set(nlist))
192
- # if operation == "a":
193
- # i.ELIST = list(set(i.ELIST + elist))
194
- # i.NLIST = list(set(i.NLIST + nlist))
195
- # if up == 0: print(f"⚠️ Boundary group {name} is not defined!")
196
195
 
197
196
  @classmethod
198
- def json(cls):
197
+ def json(cls) -> dict:
199
198
  "Generates the json file for all defined structure groups."
200
199
  json = {"Assign":{}}
201
200
  for i in cls.Groups:
@@ -210,7 +209,7 @@ class Group:
210
209
  MidasAPI("PUT",cls.url,cls.json())
211
210
 
212
211
  @classmethod
213
- def get(cls):
212
+ def get(cls) -> dict:
214
213
  return MidasAPI("GET",cls.url)
215
214
 
216
215
 
@@ -247,24 +246,9 @@ class Group:
247
246
  Group.Load.ids.append(self.ID)
248
247
  Group.Load.Groups.append(self)
249
248
 
250
- # @classmethod
251
- # def update(cls, name,operation = "r", nlist = [],elist = [] ):
252
- # """Group name, element list, node list, operation ("add" or "replace").\n
253
- # Sample: update_SG("Girder", [1,2,...20],[],"replace")"""
254
- # up = 0
255
- # for i in cls.Groups:
256
- # if name == i.NAME:
257
- # up = 1
258
- # if operation == "r":
259
- # i.ELIST = list(set(elist))
260
- # i.NLIST = list(set(nlist))
261
- # if operation == "a":
262
- # i.ELIST = list(set(i.ELIST + elist))
263
- # i.NLIST = list(set(i.NLIST + nlist))
264
- # if up == 0: print(f"⚠️ Boundary group {name} is not defined!")
265
249
 
266
250
  @classmethod
267
- def json(cls):
251
+ def json(cls) -> dict:
268
252
  "Generates the json file for all defined structure groups."
269
253
  json = {"Assign":{}}
270
254
  for i in cls.Groups:
@@ -278,7 +262,7 @@ class Group:
278
262
  MidasAPI("PUT",cls.url,cls.json())
279
263
 
280
264
  @classmethod
281
- def get(cls):
265
+ def get(cls) -> dict:
282
266
  return MidasAPI("GET",cls.url)
283
267
 
284
268
  @classmethod
@@ -312,25 +296,10 @@ class Group:
312
296
  else: self.ID= max(Group.Tendon.ids)+1
313
297
  Group.Tendon.ids.append(self.ID)
314
298
  Group.Tendon.Groups.append(self)
315
-
316
- # @classmethod
317
- # def update(cls, name,operation = "r", nlist = [],elist = [] ):
318
- # """Group name, element list, node list, operation ("add" or "replace").\n
319
- # Sample: update_SG("Girder", [1,2,...20],[],"replace")"""
320
- # up = 0
321
- # for i in cls.Groups:
322
- # if name == i.NAME:
323
- # up = 1
324
- # if operation == "r":
325
- # i.ELIST = list(set(elist))
326
- # i.NLIST = list(set(nlist))
327
- # if operation == "a":
328
- # i.ELIST = list(set(i.ELIST + elist))
329
- # i.NLIST = list(set(i.NLIST + nlist))
330
- # if up == 0: print(f"⚠️ Boundary group {name} is not defined!")
299
+
331
300
 
332
301
  @classmethod
333
- def json(cls):
302
+ def json(cls) -> dict:
334
303
  "Generates the json file for all defined structure groups."
335
304
  json = {"Assign":{}}
336
305
  for i in cls.Groups:
@@ -344,7 +313,7 @@ class Group:
344
313
  MidasAPI("PUT",cls.url,cls.json())
345
314
 
346
315
  @classmethod
347
- def get(cls):
316
+ def get(cls) -> dict:
348
317
  return MidasAPI("GET",cls.url)
349
318
 
350
319
  @classmethod
midas_civil/_utils.py CHANGED
@@ -80,4 +80,10 @@ def zz_add_to_dict(dictionary, key, value):
80
80
  if key in dictionary:
81
81
  dictionary[key].append(value)
82
82
  else:
83
- dictionary[key] = [value]
83
+ dictionary[key] = [value]
84
+
85
+
86
+ def _convItem2List(item):
87
+ if isinstance(item,list):
88
+ return item
89
+ return [item]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: midas_civil
3
- Version: 1.0.0
3
+ Version: 1.0.1
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
@@ -28,10 +28,14 @@ Dynamic: summary
28
28
 
29
29
  ![MIDAS PYTHON](https://midas-rnd.github.io/midasapi-python/assets/banner.png)
30
30
 
31
+ ---
32
+
33
+ [![PyPI Downloads](https://static.pepy.tech/badge/midas-civil)](https://pepy.tech/projects/midas-civil)
34
+
31
35
  **`midas-civil`** is a Python library that provides an interface to interact with MIDAS Civil NX using Python scripts.
32
36
  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.
33
37
 
34
- ---
38
+
35
39
 
36
40
  ## Features
37
41
 
@@ -3,7 +3,7 @@ midas_civil/_boundary.py,sha256=s5mgZIc1b0-P7AdWuaPAQ5cIbHL5CR1YRKJA7KE4W_U,3295
3
3
  midas_civil/_construction.py,sha256=q9C3gGdvky5t7jCDzd6lBRv6pm8cMycI91xfkgDV37Y,40673
4
4
  midas_civil/_construction_backup.py,sha256=Pj7V-NYCkkT-aMjKXfs1jKa9klsGh48UXDLwn3BLYTY,18225
5
5
  midas_civil/_element.py,sha256=hlH6NZfSBOrKQO7R22wZYbmLA20MB8rX7g_Td6G4mgo,27544
6
- midas_civil/_group.py,sha256=BPZcsuIVKr2vR1SezfCXS0sUn1W7aJfOJGc8ZvTAXvo,11526
6
+ midas_civil/_group.py,sha256=Go4If-cwdKMfIDlNi1MYYq4jPYOa3MlVvNkX2pTkyCs,9864
7
7
  midas_civil/_load.py,sha256=TltWAjDaeC5MNW8IIPKgpLahDQgJR3J6SzinkCrJS7A,30171
8
8
  midas_civil/_mapi.py,sha256=Fabn3QX6OHJeV_s_01KMvOwkSye0kfgpiUUgPplAzxA,4597
9
9
  midas_civil/_material.py,sha256=uJEIHJM9OhwTRWUI2mtd_0BQSxdlYhATYJu9P7tNNBA,69511
@@ -18,10 +18,10 @@ midas_civil/_settlement.py,sha256=U7lJYBqGbuCv7qziEEznDyA4M_SCjJeIjc0lDeGfE4Y,51
18
18
  midas_civil/_temperature.py,sha256=EfvivFWfxyM8yFCvWJgXLhaCofGwLKEBGFUuW8yHnfQ,24209
19
19
  midas_civil/_tendon.py,sha256=mXNJeLikFsBpgn8u9fED2qx9oqnKh3XtIpYwp3moEfk,33395
20
20
  midas_civil/_thickness.py,sha256=4xQsLA3Q_gIGCwLc_glFmiErdWdQUSwhlEhJ_IPJseA,3248
21
- midas_civil/_utils.py,sha256=eymiqO8KaTKdhVY3saebqNS0BbUUmGmgw3-ELKqew0A,2611
21
+ midas_civil/_utils.py,sha256=GR9cj-mgRPmtwmgqEj4JeEjMlRS6zmvhcxFV5IHbpRk,2708
22
22
  midas_civil/_view.py,sha256=o7rkfoQzmgAb3dT0ujPIQLVwVlveo3rMRIbZU1UosZo,849
23
- midas_civil-1.0.0.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
24
- midas_civil-1.0.0.dist-info/METADATA,sha256=BlyY3us0N1lB2l6slGBPScjlDiS1WrTmw7qHRx7pWCA,1957
25
- midas_civil-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
- midas_civil-1.0.0.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
27
- midas_civil-1.0.0.dist-info/RECORD,,
23
+ midas_civil-1.0.1.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
24
+ midas_civil-1.0.1.dist-info/METADATA,sha256=Ts49ALWXNRTNfpF9G7jSqaf1WirpMN1l34b1Fy7UmZA,2064
25
+ midas_civil-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ midas_civil-1.0.1.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
27
+ midas_civil-1.0.1.dist-info/RECORD,,