osis-python 0.2.1__py3-none-any.whl → 0.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osis-python
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python client library for Osis APDL
5
5
  Author-email: "CCCC Highway Consultant Co. Ltd." <support@osisbim.com>
6
6
  License-Expression: MIT
@@ -1,5 +1,5 @@
1
- osis_python-0.2.1.dist-info/licenses/LICENSE,sha256=T4mkSYliXdU9mYe-NfHkqg6GPhzoYaIQO_a630UzpS4,1088
2
- pyosis/__init__.py,sha256=8SyqCHtWG4c1XqfIIotTxcX1qgMY6oZcibNHPpaB51Q,465
1
+ osis_python-0.2.2.dist-info/licenses/LICENSE,sha256=T4mkSYliXdU9mYe-NfHkqg6GPhzoYaIQO_a630UzpS4,1088
2
+ pyosis/__init__.py,sha256=rZZtLzKLmcHBi8gBnB-9AWMI6yAFktFrY-9xCqAvtWU,465
3
3
  pyosis/boundary/__init__.py,sha256=u9tcY7x__3N7layYVl-JBI3HT9AwBmyGwWO_5beyldc,65
4
4
  pyosis/boundary/interface.py,sha256=tsmP1LVlMhVpHpozlMXHYooN82kSzGoHXMRQLcJ1f8o,7568
5
5
  pyosis/common/__init__.py,sha256=Gl-g0qs3Ks_r19bLEZ1bpBmZ0HvooXYcGvQlvbPf-6U,47
@@ -9,8 +9,8 @@ pyosis/control/__init__.py,sha256=dyvge-GgUpT3BeDwm_Lss1xqNlxAQdt63WJ7QcuZ_O4,24
9
9
  pyosis/control/interface.py,sha256=GrqBDNwrH5dUMA9E5b19w2Ucjw5oK9JgRe-4RJkL2Q0,3574
10
10
  pyosis/core/PyInterface.pyi,sha256=HrWq9eMtaVoQg7qDh55Z3XagTNNbceA0KBK7x38G11w,6142
11
11
  pyosis/core/__init__.py,sha256=ohE6BQddjdaSlM16lvphPmoNmQRaxZyjbhXqwwvN8eU,377
12
- pyosis/core/all_func.py,sha256=boMqLUWKJ5qhiaiu6N9Xq4rxLaPZVXYBLq2Ld2Fhunw,371
13
- pyosis/core/client.py,sha256=fIXvtzF3n20eQmqxZhnrSKbopOd_YyNj2qRpSdZVG9k,1824
12
+ pyosis/core/all_func.py,sha256=jeO4w3Gyrc6XGeQfhjIEOOL0p41PdBTKy3uT33vjurY,390
13
+ pyosis/core/client.py,sha256=Q7j2SjkhDTVDzgf-rL4f58r5GSWToy-iND6UbFYKixw,1807
14
14
  pyosis/core/command.py,sha256=uwFQwRD70EG22QeDkxymZfspGyIfsB_9UU1n8cLJOGQ,9893
15
15
  pyosis/element/__init__.py,sha256=dyvge-GgUpT3BeDwm_Lss1xqNlxAQdt63WJ7QcuZ_O4,24
16
16
  pyosis/element/interface.py,sha256=l4dkBPcbvh-2ReJt0UAvS3wFljshDuFD7SazTeFqivk,10605
@@ -18,13 +18,23 @@ pyosis/general/__init__.py,sha256=dyvge-GgUpT3BeDwm_Lss1xqNlxAQdt63WJ7QcuZ_O4,24
18
18
  pyosis/general/interface.py,sha256=GJctYJ6xzSImOsRMmSGHOPFYnN81__5NFWaKgwzCsV4,522
19
19
  pyosis/geometry/__init__.py,sha256=dyvge-GgUpT3BeDwm_Lss1xqNlxAQdt63WJ7QcuZ_O4,24
20
20
  pyosis/geometry/interface.py,sha256=Dim9rqkpU0DOkNFR1vNiVrPoqzbn-kXwiTY5UrR5ZWE,4481
21
+ pyosis/io/__init__.py,sha256=KKJfGxxyrhbE7b1uvUaqM9Q1tNoqzV-6g4Hjex-pVr4,263
22
+ pyosis/io/boundary_info.py,sha256=kKsWBbI-77-jMoNSBzx2ZzkvOYwvoanpi2IHs2kPmr8,6722
23
+ pyosis/io/coordinate.py,sha256=1XksDH5X93Yyp4J1xsDmCSTU_wXo1mSvXZCP89PyOBI,2412
24
+ pyosis/io/element_info.py,sha256=sT9HN9Ham5tN-dSxVV_gpP29SOtCD2gBHiJzm6_Wnmg,12440
25
+ pyosis/io/group_info.py,sha256=8ubPUlKvcfw2gVFOLmRTZRS7BsUEmDGeKrWWbmDUmLU,2136
26
+ pyosis/io/material_info.py,sha256=YEKbYLnV-FFM4snqF4cFhCqWeehrsa09xJOBd1d7HO0,995
27
+ pyosis/io/node_info.py,sha256=c3BINnbCn_p5Lu1MOXTL1DUYXeh_L9fHAs9Y1fYXIWg,5082
28
+ pyosis/io/prestressed_info.py,sha256=pUGrcvE_4tL8c1dJna54aIanynRzO2ZNPh4FYFB1kg0,5081
29
+ pyosis/io/response.py,sha256=ArdqltNm6Usa-C2VzpY8BGoATAyBTDozIG8_tjaXWAA,3176
30
+ pyosis/io/section_info.py,sha256=A1TmBEtnIfnQQnZEAHSZFRvhQVB8GK0NSuLex671F-o,4625
21
31
  pyosis/live/__init__.py,sha256=O76lVxVAVbf6EQjl20PzEFFOGSpp-KERwNabyCO-x_A,64
22
32
  pyosis/live/analysis.py,sha256=ih42Z4Zrf17QcfHXKDsL0BNX11PeXZpodi-AYoxKGpg,5464
23
33
  pyosis/live/grade.py,sha256=hjxUf9RBxVFuSs9J6Y0_A2g5TqJGqozdEg0_QuFZKiA,3223
24
34
  pyosis/live/lane.py,sha256=rxQayG7WMjr_sKYG1VC4jY1EaXvqnPKo5i_iLmdWpLU,5455
25
35
  pyosis/load/__init__.py,sha256=TIUD6x-Up01x2oS6VQgI7mpzZJQfNpGq4VCy-hYI1nw,67
26
36
  pyosis/load/loadcase.py,sha256=ikagLswD4j07XFE0k6HBkJSWFybYQLdH6GmnWIZjZdw,1601
27
- pyosis/load/static.py,sha256=vEc4g1BVqIv35sZb9ZL6LAxCE1Lo_79e-hb6FXmr-bM,11659
37
+ pyosis/load/static.py,sha256=kOp2kAK5W5YBUlhYGYfJ9AqPsYK74QPX-olfFAiOVGc,14024
28
38
  pyosis/load/tendon.py,sha256=5fAj8gYwRpx_hUPB9wfxwU1SF2D7uEWzCkMrnS0bPfU,11503
29
39
  pyosis/material/__init__.py,sha256=dyvge-GgUpT3BeDwm_Lss1xqNlxAQdt63WJ7QcuZ_O4,24
30
40
  pyosis/material/interface.py,sha256=83yFn-RoqLBEiYCYmbnXoMO0Gwd0u6MkWvicgFDmWh4,5699
@@ -43,9 +53,8 @@ pyosis/property/damping.py,sha256=bZiFVWBub2iTgVzDqIj29YxUOoUX3dUVfDYCRTMpLiM,78
43
53
  pyosis/property/pu_curve.py,sha256=qjw-84H3QAAnSuOuF9KxSVysPW1M56zSj_vZhf7DePU,1528
44
54
  pyosis/quick_building/__init__.py,sha256=dyvge-GgUpT3BeDwm_Lss1xqNlxAQdt63WJ7QcuZ_O4,24
45
55
  pyosis/quick_building/interface.py,sha256=xdQrORabxmnlhi537pspFokQBaXSmnZMIxA_kxSo_cE,13951
46
- pyosis/section/__init__.py,sha256=d293PTOo2RJ1YGD5PTXURuj9ZFhTgASfu1PtMA_52w0,144
56
+ pyosis/section/__init__.py,sha256=9_hvbJTITryZ30-rw18VCiY5Gjeav7PRdh32Ti6YDiw,126
47
57
  pyosis/section/common.py,sha256=DPEV2NZ9ZvqY6As9EIDJX6EnuoHs49MXgEcTxN-ba7U,26572
48
- pyosis/section/io.py,sha256=VKdnR1ps5JZgRyb9jRf_uBI_UmpkWOJIZnC0S-eSCfM,857
49
58
  pyosis/section/numeric.py,sha256=yx32nS9BE8WPVMUWLKv3FVW0BfrhtaQ6qUTSVqKhX6o,1501
50
59
  pyosis/section/param.py,sha256=2lxP1IVhQTvBFgIVhv8yFj0w7WFfplsx2D3sMIPJPe8,3534
51
60
  pyosis/section/rebar.py,sha256=_pYRw0KDlKOYt13oyfiu2jT87AbFQ5qe62NVVLyGCkw,7293
@@ -56,7 +65,7 @@ pyosis/stage/define.py,sha256=6CJEYU3e5sEfL9ZuTKQnAeiZKl99io86rEYNIyMZrhQ,3955
56
65
  pyosis/stage/overall.py,sha256=eUenFLvdO5PRlMjk0ZqeoHE1aSWqNyZqI-dh9nTDIw0,2157
57
66
  pyosis/thickness/__init__.py,sha256=dyvge-GgUpT3BeDwm_Lss1xqNlxAQdt63WJ7QcuZ_O4,24
58
67
  pyosis/thickness/interface.py,sha256=l9EYI45_RwHSEnNmn1ctoiu_q8Q2zkrH7QOiN0D26Dk,1314
59
- osis_python-0.2.1.dist-info/METADATA,sha256=ZMPbdn4tUunKpGNd1dXXeV2jWFLMJsltIkgV0MM5-Mc,3447
60
- osis_python-0.2.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
61
- osis_python-0.2.1.dist-info/top_level.txt,sha256=6VDNySkQKwipRXcN8ayKVci4vAXi4oPyWLqFhNVcIfM,7
62
- osis_python-0.2.1.dist-info/RECORD,,
68
+ osis_python-0.2.2.dist-info/METADATA,sha256=dmQCgGpHj5Z1_4MpZGwWKzPtUZI_1OqZQQmnehRtuY8,3447
69
+ osis_python-0.2.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
70
+ osis_python-0.2.2.dist-info/top_level.txt,sha256=6VDNySkQKwipRXcN8ayKVci4vAXi4oPyWLqFhNVcIfM,7
71
+ osis_python-0.2.2.dist-info/RECORD,,
pyosis/__init__.py CHANGED
@@ -7,7 +7,7 @@ A library for extending OSIS functionality.
7
7
  A library that allows users to use CAE with great flexibility.
8
8
  """
9
9
 
10
- __version__ = "0.2.1"
10
+ __version__ = "0.2.2"
11
11
  __author__ = "CCCC Highway Consultant Co. Ltd." # 中交公路规划设计院 - 工程技术研究中心 - lzh - wjh - myf
12
12
 
13
13
  # from .core import engine
pyosis/core/all_func.py CHANGED
@@ -13,4 +13,5 @@ from ..general import *
13
13
  from ..section import *
14
14
  from ..stage import *
15
15
  from ..geometry import *
16
- from ..thickness import *
16
+ from ..thickness import *
17
+ from ..io import *
pyosis/core/client.py CHANGED
@@ -30,7 +30,7 @@ def osis_client(func_name: str, payload: dict) -> dict | tuple[bool, str]:
30
30
  Args:
31
31
  func_name: C++ 接口名(如 "OSIS_Run", "OSIS_Run_Batch")
32
32
  payload: 请求参数字典(自动序列化为 JSON)
33
- Returns:
33
+ Returns:
34
34
  异常时返回 (False, 错误信息)
35
35
  """
36
36
  url = f"http://localhost:8080/{func_name}"
@@ -44,8 +44,7 @@ def osis_client(func_name: str, payload: dict) -> dict | tuple[bool, str]:
44
44
  timeout=30 # 批量调用适当延长超时
45
45
  )
46
46
  response.raise_for_status() # 抛出 HTTP 状态码错误
47
- return tuple(response.json())
48
-
47
+ return response.json()
49
48
  except Exception as e:
50
49
  # 异常时保持和 C++ 一致的返回格式
51
50
  return False, f"调用失败: {str(e)}"
pyosis/io/__init__.py ADDED
@@ -0,0 +1,10 @@
1
+ # io/__init__.py
2
+ from .coordinate import *
3
+ from .group_info import *
4
+ from .element_info import *
5
+ from .node_info import *
6
+ from .response import *
7
+ from .section_info import *
8
+ from .material_info import *
9
+ from .boundary_info import *
10
+ from .prestressed_info import *
@@ -0,0 +1,239 @@
1
+ # cpp/boundary_info.py
2
+
3
+ from ..core.client import osis_client
4
+ from .response import OSISParse
5
+
6
+
7
+ class BoundaryInfo(OSISParse):
8
+ """
9
+ GetAllBoundaryInfo 接口返回封装
10
+
11
+ 返回格式:
12
+ {
13
+ "success": true,
14
+ "data": [
15
+ {
16
+ "no": int,
17
+ "name": str,
18
+ "type": int, # 1=General, 2=MstSlv, 4=Release, 5=ElstcSpt, 6=GeneralElstcSpt
19
+ "entityVec": [int, ...],
20
+ "isOccupied": bool,
21
+ "isSelected": bool,
22
+ "isPloted": bool,
23
+ # type=1 (General) 特有:
24
+ "coorNO": int,
25
+ "constraints": [int, ...], # 7个约束值
26
+ # type=2 (MstSlv) 特有:
27
+ "masterNO": int,
28
+ "constraints": [int, ...],
29
+ # type=4 (Release) 特有:
30
+ "endIState": [int, ...],
31
+ "endJState": [int, ...],
32
+ "endI": [float, ...],
33
+ "endJ": [float, ...],
34
+ # type=5 (ElstcSpt) 特有:
35
+ "coorNO": int,
36
+ "k": [float, ...],
37
+ "elasticK": [{"isFixed": bool, "value": float}, ...],
38
+ # type=6 (GeneralElstcSpt) 特有:
39
+ "coorNO": int,
40
+ "flagM": bool,
41
+ "flagC": bool,
42
+ "stiffnessMatrix": [[float, ...], ...],
43
+ "massMatrix": [[float, ...], ...], # 仅当flagM=True时
44
+ "dampingMatrix": [[float, ...], ...], # 仅当flagC=True时
45
+ },
46
+ ...
47
+ ]
48
+ }
49
+ """
50
+
51
+ # 边界类型枚举映射
52
+ BOUNDARY_TYPE_NAMES = {
53
+ 1: "General",
54
+ 2: "MstSlv",
55
+ 3: "Rigid",
56
+ 4: "Release",
57
+ 5: "ElstcSpt",
58
+ 6: "GeneralElstcSpt",
59
+ }
60
+
61
+ def __init__(self):
62
+ super().__init__(osis_client("GetAllBoundaryInfo", {}))
63
+ self._bd_map: dict[int, dict] = {bd["no"]: bd for bd in self.data}
64
+
65
+ def get_by_no(self, no: int) -> dict | None:
66
+ """
67
+ 根据边界编号获取边界信息
68
+
69
+ Args:
70
+ no: 边界编号
71
+
72
+ Returns:
73
+ 边界信息 dict;未找到返回 None
74
+ """
75
+ return self._bd_map.get(no)
76
+
77
+ def get_no_list(self) -> list:
78
+ """
79
+ 获取所有边界编号列表
80
+
81
+ Returns:
82
+ 边界编号列表
83
+ """
84
+ return [bd.get("no") for bd in self.data]
85
+
86
+ def get_type(self, no: int) -> int | None:
87
+ """
88
+ 根据边界编号获取边界类型编号
89
+
90
+ Args:
91
+ no: 边界编号
92
+
93
+ Returns:
94
+ 边界类型编号(1=General, 2=MstSlv, 4=Release, 5=ElstcSpt, 6=GeneralElstcSpt);未找到返回 None
95
+ """
96
+ bd = self.get_by_no(no)
97
+ return bd.get("type") if bd else None
98
+
99
+ def get_type_name(self, no: int) -> str | None:
100
+ """
101
+ 根据边界编号获取边界类型名称
102
+
103
+ Args:
104
+ no: 边界编号
105
+
106
+ Returns:
107
+ 边界类型名称字符串;未找到返回 None
108
+ """
109
+ bd = self.get_by_no(no)
110
+ if bd:
111
+ return self.BOUNDARY_TYPE_NAMES.get(bd.get("type"), "Unknown")
112
+ return None
113
+
114
+ def get_entity_vec(self, no: int) -> list | None:
115
+ """
116
+ 根据边界编号获取关联的节点/单元列表
117
+
118
+ Args:
119
+ no: 边界编号
120
+
121
+ Returns:
122
+ 关联的节点/单元编号列表;未找到返回 None
123
+ """
124
+ bd = self.get_by_no(no)
125
+ return bd.get("entityVec") if bd else None
126
+
127
+ def get_master_no(self, no: int) -> int | None:
128
+ """
129
+ 根据边界编号获取主从边界的主节点编号
130
+
131
+ Args:
132
+ no: 边界编号
133
+
134
+ Returns:
135
+ 主节点编号;未找到或非主从边界返回 None
136
+ """
137
+ bd = self.get_by_no(no)
138
+ return bd.get("masterNO") if bd else None
139
+
140
+ def get_constraints(self, no: int) -> list | None:
141
+ """
142
+ 根据边界编号获取边界约束值
143
+
144
+ Args:
145
+ no: 边界编号
146
+
147
+ Returns:
148
+ 约束值列表(7个);未找到返回 None
149
+ """
150
+ bd = self.get_by_no(no)
151
+ return bd.get("constraints") if bd else None
152
+
153
+ def get_coor_no(self, no: int) -> int | None:
154
+ """
155
+ 根据边界编号获取局部坐标系编号
156
+
157
+ Args:
158
+ no: 边界编号
159
+
160
+ Returns:
161
+ 局部坐标系编号;未找到返回 None
162
+ """
163
+ bd = self.get_by_no(no)
164
+ return bd.get("coorNO") if bd else None
165
+
166
+ def is_occupied(self, no: int) -> bool | None:
167
+ """
168
+ 根据边界编号判断边界是否被节点/单元占用
169
+
170
+ Args:
171
+ no: 边界编号
172
+
173
+ Returns:
174
+ 是否被占用;未找到返回 None
175
+ """
176
+ bd = self.get_by_no(no)
177
+ return bd.get("isOccupied") if bd else None
178
+
179
+ def is_selected(self, no: int) -> bool | None:
180
+ """
181
+ 根据边界编号判断边界是否被选中
182
+
183
+ Args:
184
+ no: 边界编号
185
+
186
+ Returns:
187
+ 是否选中;未找到返回 None
188
+ """
189
+ bd = self.get_by_no(no)
190
+ return bd.get("isSelected") if bd else None
191
+
192
+ def get_stiffness_matrix(self, no: int) -> list | None:
193
+ """
194
+ 根据边界编号获取GeneralElstcSpt边界的刚度矩阵
195
+
196
+ Args:
197
+ no: 边界编号
198
+
199
+ Returns:
200
+ 6x6刚度矩阵;未找到或非GeneralElstcSpt类型返回 None
201
+ """
202
+ bd = self.get_by_no(no)
203
+ return bd.get("stiffnessMatrix") if bd else None
204
+
205
+ def get_mass_matrix(self, no: int) -> list | None:
206
+ """
207
+ 根据边界编号获取GeneralElstcSpt边界的质量矩阵
208
+
209
+ Args:
210
+ no: 边界编号
211
+
212
+ Returns:
213
+ 6x6质量矩阵;未找到、非GeneralElstcSpt类型或flagM=False时返回 None
214
+ """
215
+ bd = self.get_by_no(no)
216
+ return bd.get("massMatrix") if bd else None
217
+
218
+ def get_damping_matrix(self, no: int) -> list | None:
219
+ """
220
+ 根据边界编号获取GeneralElstcSpt边界的阻尼矩阵
221
+
222
+ Args:
223
+ no: 边界编号
224
+
225
+ Returns:
226
+ 6x6阻尼矩阵;未找到、非GeneralElstcSpt类型或flagC=False时返回 None
227
+ """
228
+ bd = self.get_by_no(no)
229
+ return bd.get("dampingMatrix") if bd else None
230
+
231
+
232
+ def get_all_boundary_info() -> BoundaryInfo:
233
+ """
234
+ 获取所有边界信息
235
+
236
+ Returns:
237
+ BoundaryInfo 对象
238
+ """
239
+ return BoundaryInfo()
@@ -0,0 +1,98 @@
1
+ # io/coordinate.py
2
+
3
+ import json
4
+
5
+ from .response import OSISParse
6
+ from ..core.client import osis_client
7
+
8
+
9
+ class Coordinate(OSISParse):
10
+ """
11
+ GetCoordinate 接口返回封装
12
+
13
+ 返回格式:
14
+ {"success": true, "data": [{"id": int, "x": float, "y": float, "z": float}, ...]}
15
+ """
16
+
17
+ def __init__(self):
18
+ super().__init__(osis_client("GetCoordinate",{}))
19
+ self._node_map: dict[int, dict] = {node["id"]: node for node in self.data}
20
+
21
+ def get_by_id(self, node_id: int) -> dict | None:
22
+ """
23
+ 根据节点 ID 获取节点坐标信息
24
+
25
+ Args:
26
+ node_id: 节点编号
27
+
28
+ Returns:
29
+ 节点坐标 dict,包含 id, x, y, z 字段;未找到返回 None
30
+ """
31
+ return self._node_map.get(node_id)
32
+
33
+ def get_id_list(self) -> list:
34
+ """
35
+ 获取所有节点 ID 列表
36
+
37
+ Returns:
38
+ 节点编号列表
39
+ """
40
+ return [node.get("id") for node in self.data]
41
+
42
+ def get_x(self, node_id: int) -> float | None:
43
+ """
44
+ 根据节点 ID 获取 X 坐标
45
+
46
+ Args:
47
+ node_id: 节点编号
48
+
49
+ Returns:
50
+ X 坐标值;节点不存在返回 None
51
+ """
52
+ node = self.get_by_id(node_id)
53
+ return node.get("x") if node else None
54
+
55
+ def get_y(self, node_id: int) -> float | None:
56
+ """
57
+ 根据节点 ID 获取 Y 坐标
58
+
59
+ Args:
60
+ node_id: 节点编号
61
+
62
+ Returns:
63
+ Y 坐标值;节点不存在返回 None
64
+ """
65
+ node = self.get_by_id(node_id)
66
+ return node.get("y") if node else None
67
+
68
+ def get_z(self, node_id: int) -> float | None:
69
+ """
70
+ 根据节点 ID 获取 Z 坐标
71
+
72
+ Args:
73
+ node_id: 节点编号
74
+
75
+ Returns:
76
+ Z 坐标值;节点不存在返回 None
77
+ """
78
+ node = self.get_by_id(node_id)
79
+ return node.get("z") if node else None
80
+
81
+ def get_xyz(self, node_id: int) -> tuple | None:
82
+ """
83
+ 根据节点 ID 获取 (X, Y, Z) 坐标元组
84
+
85
+ Args:
86
+ node_id: 节点编号
87
+
88
+ Returns:
89
+ (x, y, z) 元组;节点不存在返回 None
90
+ """
91
+ node = self.get_by_id(node_id)
92
+ if node:
93
+ return node.get("x"), node.get("y"), node.get("z")
94
+ return None
95
+
96
+
97
+ def get_coordinate() -> Coordinate:
98
+ return Coordinate()