osis-python 0.2.1__tar.gz → 0.2.2__tar.gz
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.
- {osis_python-0.2.1/src/osis_python.egg-info → osis_python-0.2.2}/PKG-INFO +1 -1
- {osis_python-0.2.1 → osis_python-0.2.2/src/osis_python.egg-info}/PKG-INFO +1 -1
- {osis_python-0.2.1 → osis_python-0.2.2}/src/osis_python.egg-info/SOURCES.txt +10 -1
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/__init__.py +1 -1
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/core/all_func.py +2 -1
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/core/client.py +2 -3
- osis_python-0.2.2/src/pyosis/io/__init__.py +10 -0
- osis_python-0.2.2/src/pyosis/io/boundary_info.py +239 -0
- osis_python-0.2.2/src/pyosis/io/coordinate.py +98 -0
- osis_python-0.2.2/src/pyosis/io/element_info.py +489 -0
- osis_python-0.2.2/src/pyosis/io/group_info.py +82 -0
- osis_python-0.2.2/src/pyosis/io/material_info.py +39 -0
- osis_python-0.2.2/src/pyosis/io/node_info.py +192 -0
- osis_python-0.2.2/src/pyosis/io/prestressed_info.py +170 -0
- osis_python-0.2.2/src/pyosis/io/response.py +135 -0
- osis_python-0.2.2/src/pyosis/io/section_info.py +162 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/load/static.py +52 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/section/__init__.py +1 -2
- osis_python-0.2.1/src/pyosis/section/io.py +0 -28
- {osis_python-0.2.1 → osis_python-0.2.2}/LICENSE +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/README.md +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/pyproject.toml +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/setup.cfg +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/osis_python.egg-info/dependency_links.txt +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/osis_python.egg-info/requires.txt +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/osis_python.egg-info/top_level.txt +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/boundary/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/boundary/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/common/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/common/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/common/project.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/control/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/control/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/core/PyInterface.pyi +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/core/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/core/command.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/element/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/element/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/general/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/general/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/geometry/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/geometry/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/live/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/live/analysis.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/live/grade.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/live/lane.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/load/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/load/loadcase.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/load/tendon.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/material/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/material/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/node/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/node/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/post/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/post/check.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/post/env.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/post/loadcase.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/post/result.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/property/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/property/comp_thickness.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/property/coordinate.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/property/creep_shrink.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/property/damping.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/property/pu_curve.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/quick_building/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/quick_building/interface.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/section/common.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/section/numeric.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/section/param.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/section/rebar.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/section/rib.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/section/steel.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/stage/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/stage/define.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/stage/overall.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/thickness/__init__.py +0 -0
- {osis_python-0.2.1 → osis_python-0.2.2}/src/pyosis/thickness/interface.py +0 -0
|
@@ -25,6 +25,16 @@ src/pyosis/general/__init__.py
|
|
|
25
25
|
src/pyosis/general/interface.py
|
|
26
26
|
src/pyosis/geometry/__init__.py
|
|
27
27
|
src/pyosis/geometry/interface.py
|
|
28
|
+
src/pyosis/io/__init__.py
|
|
29
|
+
src/pyosis/io/boundary_info.py
|
|
30
|
+
src/pyosis/io/coordinate.py
|
|
31
|
+
src/pyosis/io/element_info.py
|
|
32
|
+
src/pyosis/io/group_info.py
|
|
33
|
+
src/pyosis/io/material_info.py
|
|
34
|
+
src/pyosis/io/node_info.py
|
|
35
|
+
src/pyosis/io/prestressed_info.py
|
|
36
|
+
src/pyosis/io/response.py
|
|
37
|
+
src/pyosis/io/section_info.py
|
|
28
38
|
src/pyosis/live/__init__.py
|
|
29
39
|
src/pyosis/live/analysis.py
|
|
30
40
|
src/pyosis/live/grade.py
|
|
@@ -52,7 +62,6 @@ src/pyosis/quick_building/__init__.py
|
|
|
52
62
|
src/pyosis/quick_building/interface.py
|
|
53
63
|
src/pyosis/section/__init__.py
|
|
54
64
|
src/pyosis/section/common.py
|
|
55
|
-
src/pyosis/section/io.py
|
|
56
65
|
src/pyosis/section/numeric.py
|
|
57
66
|
src/pyosis/section/param.py
|
|
58
67
|
src/pyosis/section/rebar.py
|
|
@@ -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.
|
|
10
|
+
__version__ = "0.2.2"
|
|
11
11
|
__author__ = "CCCC Highway Consultant Co. Ltd." # 中交公路规划设计院 - 工程技术研究中心 - lzh - wjh - myf
|
|
12
12
|
|
|
13
13
|
# from .core import engine
|
|
@@ -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
|
|
48
|
-
|
|
47
|
+
return response.json()
|
|
49
48
|
except Exception as e:
|
|
50
49
|
# 异常时保持和 C++ 一致的返回格式
|
|
51
50
|
return False, f"调用失败: {str(e)}"
|
|
@@ -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()
|