midas-civil 1.0.2__py3-none-any.whl → 1.0.4__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/__init__.py CHANGED
@@ -1,3 +1,21 @@
1
+ import requests
2
+ _version_ = "1.0.4"
3
+
4
+
5
+ print('')
6
+ print('*'*20,' MIDAS CIVIL-NX PYTHON LIBRARY v',_version_,' 🐍 ','*'*20)
7
+ print('')
8
+
9
+ resp = requests.get("https://pypi.org/pypi/midas_civil/json").json()
10
+ latest_ver = resp["info"]["version"]
11
+ if _version_ != latest_ver:
12
+ print(
13
+ f"⚠️ Warning: You are using v{_version_}, "
14
+ f"but the latest available version is v{latest_ver}.\n"
15
+ f" Run 'pip install midas_civil --upgrade' to update."
16
+ )
17
+ print("-"*85)
18
+
1
19
  from ._mapi import *
2
20
  from ._model import *
3
21
  from ._boundary import *
@@ -23,9 +41,3 @@ from ._view import *
23
41
  from ._movingload import*
24
42
  from ._settlement import*
25
43
 
26
-
27
-
28
- print('')
29
- print('*'*20,' MIDAS CIVIL-NX PYTHON LIBRARY v1.0.2 🐍 ','*'*20)
30
- print('')
31
-
midas_civil/_mapi.py CHANGED
@@ -3,6 +3,8 @@ import sys
3
3
  import winreg
4
4
 
5
5
 
6
+
7
+
6
8
  def Midas_help():
7
9
  """MIDAS Documnetation : https://midas-rnd.github.io/midasapi-python """
8
10
  print("---"*22)
@@ -15,7 +17,7 @@ class MAPI_COUNTRY:
15
17
 
16
18
  country = "US"
17
19
 
18
- def __init__(self,country:str):
20
+ def __init__(self,country:str="US"):
19
21
  ''' Define Civil NX country to automatically set Base URL and MAPI Key from registry.
20
22
  ```
21
23
  MAPI_COUNTRY('US') # For english version
@@ -35,7 +37,7 @@ class MAPI_COUNTRY:
35
37
  class MAPI_BASEURL:
36
38
  baseURL = "https://moa-engineers.midasit.com:443/civil"
37
39
 
38
- def __init__(self, baseURL:str):
40
+ def __init__(self, baseURL:str = "https://moa-engineers.midasit.com:443/civil"):
39
41
  ''' Define the Base URL for API connection.
40
42
  ```
41
43
  MAPI_BASEURL('https://moa-engineers.midasit.com:443/civil')
@@ -69,6 +71,7 @@ class MAPI_BASEURL:
69
71
  class MAPI_KEY:
70
72
  """MAPI key from Civil NX.\n\nEg: MAPI_Key("eadsfjaks568wqehhf.ajkgj345qfhh")"""
71
73
  data = ""
74
+ count = 1
72
75
 
73
76
  def __init__(self, mapi_key:str):
74
77
  MAPI_KEY.data = mapi_key
@@ -81,13 +84,15 @@ class MAPI_KEY:
81
84
  registry_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_path, 0, winreg.KEY_READ)
82
85
  value = winreg.QueryValueEx(registry_key, "Key")
83
86
  my_key = value[0]
84
- print(f' 🔑 MAPI-KEY is taken from Registry entry. >> {my_key[:35]}...')
85
87
  MAPI_KEY(my_key)
88
+ print(f' 🔑 MAPI-KEY is taken from Registry entry. >> {my_key[:35]}...')
89
+ print("-"*85)
86
90
  except:
87
91
  print(f"🔑 MAPI KEY is not defined. Click on Apps > API Settings to copy the MAPI Key.\n Define it using MAPI_KEY('xxxx')")
88
92
  sys.exit(0)
89
93
  else:
90
94
  my_key = MAPI_KEY.data
95
+
91
96
  return my_key
92
97
  #---------------------------------------------------------------------------------------------------------------
93
98
 
@@ -126,6 +131,11 @@ def MidasAPI(method:str, command:str, body:dict={})->dict:
126
131
  sys.exit(0)
127
132
 
128
133
  # print(method, command, response.status_code , "✅")
134
+ if MAPI_KEY.count == 1:
135
+ MAPI_KEY.count = 0
136
+ _checkUSER()
137
+
138
+
129
139
 
130
140
  return response.json()
131
141
 
@@ -141,4 +151,14 @@ def _setUNIT(unitJS):
141
151
  "1" : unitJS
142
152
  }
143
153
  }
144
- MidasAPI('PUT','/db/UNIT',js)
154
+ MidasAPI('PUT','/db/UNIT',js)
155
+
156
+
157
+ def _checkUSER():
158
+ try:
159
+ resp = MidasAPI('GET','/config/ver',{})['VER']
160
+ print(f"Connected to {resp["NAME"]} 🟢")
161
+ print(f"USER : {resp["USER"]} | COMPANY : {resp["COMPANY"]}")
162
+ print("-"*85)
163
+ except:
164
+ print("")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: midas_civil
3
- Version: 1.0.2
3
+ Version: 1.0.4
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
@@ -1,11 +1,11 @@
1
- midas_civil/__init__.py,sha256=FLQxclh4avM2ich9ZhAxFcFLM1fVCGKlFjVNnwW9B2o,581
1
+ midas_civil/__init__.py,sha256=LjRnvtkFv9PHNywiXVJmWjF2XagqckgqYOaMxEpX0EY,997
2
2
  midas_civil/_boundary.py,sha256=s5mgZIc1b0-P7AdWuaPAQ5cIbHL5CR1YRKJA7KE4W_U,32958
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=O6PBn5yWI_EFpHpCMOVoo8zsA5fup1pwdY058LSc0pY,30411
6
6
  midas_civil/_group.py,sha256=Go4If-cwdKMfIDlNi1MYYq4jPYOa3MlVvNkX2pTkyCs,9864
7
7
  midas_civil/_load.py,sha256=TltWAjDaeC5MNW8IIPKgpLahDQgJR3J6SzinkCrJS7A,30171
8
- midas_civil/_mapi.py,sha256=SnX16e19jAuFEc7W_95FtY7aadfmdkgVxZie6hkgyEY,4867
8
+ midas_civil/_mapi.py,sha256=m7bI1eZ02VPRWBdJTn0tnn7bO-hVnKj5GqyizQ8ahqA,5322
9
9
  midas_civil/_material.py,sha256=uJEIHJM9OhwTRWUI2mtd_0BQSxdlYhATYJu9P7tNNBA,69511
10
10
  midas_civil/_model.py,sha256=I7lzMsOhqWcDcBYtPSqBUs97sBEf5M1mJ0KLftyGGB4,16597
11
11
  midas_civil/_movingload.py,sha256=kzTbi4vFjOnUYOyhDDTmSHFU-sDGb_MgMBNXUmFmUZc,80001
@@ -20,8 +20,8 @@ midas_civil/_tendon.py,sha256=mXNJeLikFsBpgn8u9fED2qx9oqnKh3XtIpYwp3moEfk,33395
20
20
  midas_civil/_thickness.py,sha256=4xQsLA3Q_gIGCwLc_glFmiErdWdQUSwhlEhJ_IPJseA,3248
21
21
  midas_civil/_utils.py,sha256=GR9cj-mgRPmtwmgqEj4JeEjMlRS6zmvhcxFV5IHbpRk,2708
22
22
  midas_civil/_view.py,sha256=o7rkfoQzmgAb3dT0ujPIQLVwVlveo3rMRIbZU1UosZo,849
23
- midas_civil-1.0.2.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
24
- midas_civil-1.0.2.dist-info/METADATA,sha256=25Lm__RTdXyuo2Gwkgm3Qp4snPVKVP-CMHqpHgd1fLI,2085
25
- midas_civil-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
- midas_civil-1.0.2.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
27
- midas_civil-1.0.2.dist-info/RECORD,,
23
+ midas_civil-1.0.4.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
24
+ midas_civil-1.0.4.dist-info/METADATA,sha256=ahfga-BmOgin0XPh0XXLnYIIrOhgiMSuDouGS-88AJk,2085
25
+ midas_civil-1.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ midas_civil-1.0.4.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
27
+ midas_civil-1.0.4.dist-info/RECORD,,