osis-python 0.3.4__tar.gz → 0.3.8__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.3.4/src/osis_python.egg-info → osis_python-0.3.8}/PKG-INFO +1 -1
- {osis_python-0.3.4 → osis_python-0.3.8/src/osis_python.egg-info}/PKG-INFO +1 -1
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/__init__.py +2 -1
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/boundary/manager.py +14 -4
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/core/client.py +11 -12
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/core/command.py +44 -90
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/core/engine.py +5 -4
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/dynamic/__init__.py +1 -1
- osis_python-0.3.8/src/pyosis/dynamic/manager.py +534 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/element/manager.py +103 -20
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/general/interface.py +0 -1
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/geometry/interface.py +1 -1
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/geometry/manager.py +5 -4
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/live/manager.py +21 -12
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/load/__init__.py +1 -1
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/load/manager.py +68 -21
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/material/manager.py +8 -7
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/property/manager.py +107 -1
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/section/manager.py +136 -96
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/settlement/manager.py +13 -8
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/stability/manager.py +54 -0
- osis_python-0.3.4/src/pyosis/dynamic/manager.py +0 -347
- {osis_python-0.3.4 → osis_python-0.3.8}/LICENSE +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/README.md +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/pyproject.toml +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/setup.cfg +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/osis_python.egg-info/SOURCES.txt +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/osis_python.egg-info/dependency_links.txt +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/osis_python.egg-info/requires.txt +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/osis_python.egg-info/top_level.txt +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/boundary/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/boundary/interface.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/control/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/control/control.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/control/io.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/control/manager.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/control/nonlinear.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/core/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/core/all_func.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/dynamic/load_to_mass.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/dynamic/modal.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/dynamic/seismic.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/element/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/element/interface.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/general/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/geometry/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/live/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/live/analysis.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/live/grade.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/live/lane.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/load/loadcase.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/load/static.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/load/tendon.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/material/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/material/interface.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/node/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/node/interface.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/node/manager.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/post/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/post/combine.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/post/design_check.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/post/display.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/post/manager.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/project/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/project/interface.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/project/manager.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/property/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/property/component_thickness.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/property/coordinate.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/property/creep_shrink.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/property/damping.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/property/pu_curve.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/quick_building/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/quick_building/interface.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/result/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/result/check.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/result/env.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/result/loadcase.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/result/manager.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/result/result.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/section/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/section/common.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/section/numeric.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/section/param.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/section/rebar.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/section/rib.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/section/steel.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/settlement/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/settlement/interface.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/stability/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/stability/buckling.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/stage/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/stage/define.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/stage/manager.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/stage/overall.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/thickness/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/thickness/interface.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/thickness/manager.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/transfer/__init__.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/transfer/command_map.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/transfer/generator.py +0 -0
- {osis_python-0.3.4 → osis_python-0.3.8}/src/pyosis/transfer/parser.py +0 -0
|
@@ -7,9 +7,10 @@ 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.3.
|
|
10
|
+
__version__ = "0.3.8"
|
|
11
11
|
__author__ = "CCCC Highway Consultant Co. Ltd." # 中交公路规划设计院 - 工程技术研究中心 - lzh - wjh - myf
|
|
12
12
|
|
|
13
|
+
from .core.engine import OSISEngine
|
|
13
14
|
# from .core import engine
|
|
14
15
|
# from .ai.agents import BaseAgent
|
|
15
16
|
# from .core import osis_run
|
|
@@ -529,6 +529,13 @@ class BoundaryGroupManager:
|
|
|
529
529
|
ok, err = osis_boundary_group(name, "d")
|
|
530
530
|
if not ok:
|
|
531
531
|
raise RuntimeError(f"删除边界组 {name} 失败: {err}")
|
|
532
|
+
|
|
533
|
+
def rename(self, old_name, new_name) -> None:
|
|
534
|
+
"""修改边界组名"""
|
|
535
|
+
ok, err = osis_boundary_group(old_name, "m", [new_name])
|
|
536
|
+
if not ok:
|
|
537
|
+
raise RuntimeError(f"修改边界组名 {old_name} -> {new_name} 失败: 失败: {err}")
|
|
538
|
+
return self.get(new_name)
|
|
532
539
|
|
|
533
540
|
# ── 查询 ──────────────────────────────────
|
|
534
541
|
|
|
@@ -542,12 +549,15 @@ class BoundaryGroupManager:
|
|
|
542
549
|
单个 BoundaryGroup 对象;如果传入列表则返回对象列表;
|
|
543
550
|
不存在返回 None
|
|
544
551
|
"""
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
552
|
+
|
|
553
|
+
if isinstance(name, list):
|
|
554
|
+
names = [str(x) for x in name]
|
|
555
|
+
else:
|
|
556
|
+
names = [str(name)]
|
|
557
|
+
if not isinstance(names, list):
|
|
548
558
|
raise TypeError(f"不支持的名称类型: {type(name)}")
|
|
549
559
|
|
|
550
|
-
resp = osis_client("GetBoundaryGroupInfoByNames", {"name":
|
|
560
|
+
resp = osis_client("GetBoundaryGroupInfoByNames", {"name": names})
|
|
551
561
|
if not resp['success']:
|
|
552
562
|
raise RuntimeError(f"{resp['error']}")
|
|
553
563
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os
|
|
1
2
|
import requests
|
|
2
3
|
import json
|
|
3
4
|
from requests.adapters import HTTPAdapter
|
|
@@ -24,7 +25,7 @@ session.mount("http://", adapter)
|
|
|
24
25
|
session.mount("https://", adapter) # 如果你后续用HTTPS
|
|
25
26
|
|
|
26
27
|
# ========== 通用客户端函数(复用连接池) ==========
|
|
27
|
-
def osis_client(func_name: str, payload: dict) -> dict:
|
|
28
|
+
def osis_client(func_name: str, payload: dict, base_url=None) -> dict:
|
|
28
29
|
"""
|
|
29
30
|
通用 OSIS 接口客户端(复用连接池,高效批量调用)
|
|
30
31
|
Args:
|
|
@@ -33,7 +34,8 @@ def osis_client(func_name: str, payload: dict) -> dict:
|
|
|
33
34
|
Returns:
|
|
34
35
|
异常时返回 (False, 错误信息)
|
|
35
36
|
"""
|
|
36
|
-
|
|
37
|
+
base_url = base_url or os.environ.get("OSIS_URL", "http://localhost:18080")
|
|
38
|
+
url = f"{base_url}/{func_name}"
|
|
37
39
|
|
|
38
40
|
try:
|
|
39
41
|
response = session.post(
|
|
@@ -53,18 +55,15 @@ def osis_client(func_name: str, payload: dict) -> dict:
|
|
|
53
55
|
# 接口不存在
|
|
54
56
|
if response.status_code == 404:
|
|
55
57
|
return {"success": False, "error": f"接口不存在: {func_name}"}
|
|
56
|
-
# 200
|
|
57
|
-
# if response.ok:
|
|
58
|
-
return data if data is not None else {"success": False, "error": f"接口不存在: {func_name}" }
|
|
59
58
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
if response.ok: # 200-299
|
|
60
|
+
if data is not None:
|
|
61
|
+
return data
|
|
62
|
+
return {"success": False, "error": f"接口返回空数据: {func_name}"}
|
|
63
|
+
|
|
64
|
+
# 其他错误状态码 (500, 502, etc.)
|
|
65
|
+
return {"success": False, "error": f"HTTP {response.status_code}: {response.text[:200]}"}
|
|
64
66
|
|
|
65
|
-
# 无结构化 body 时退回文本 / 状态码
|
|
66
|
-
# detail = response.text.strip() if response.text else ""
|
|
67
|
-
# return {"success": False, "error": detail if detail else f"HTTP {response.status_code}"}# False, detail if detail else f"HTTP {response.status_code}"
|
|
68
67
|
|
|
69
68
|
except requests.RequestException as e:
|
|
70
69
|
return {"success": False, "error": f"调用失败: {str(e)}"}
|
|
@@ -12,27 +12,6 @@ from typing import Dict, Any, Tuple, Literal, Optional
|
|
|
12
12
|
# from .engine import OSISEngine
|
|
13
13
|
from .client import osis_client
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
# def osis_run(strCmd: str="", mode: Literal["stash", "exec"]="exec") -> Tuple[bool, str, Any]:
|
|
17
|
-
# '''
|
|
18
|
-
# 直接以命令流的形式运行OSIS功能
|
|
19
|
-
|
|
20
|
-
# Args:
|
|
21
|
-
# strCmd: 完整的命令流
|
|
22
|
-
# mode: 运行模式,此参数为了同时执行多条命令提高效率
|
|
23
|
-
# * 使用 stash 仅会将命令流存到OSIS中,不会执行
|
|
24
|
-
# * 收到 exec 信号才会执行暂存包括当前的所有命令流。
|
|
25
|
-
|
|
26
|
-
# Returns:
|
|
27
|
-
# tuple (bool, str, Any): 是否成功,失败原因,其他结果数据
|
|
28
|
-
# '''
|
|
29
|
-
# # # 自动判断模式:非空默认暂存,为空默认执行
|
|
30
|
-
# # if mode is None:
|
|
31
|
-
# # mode = "stash" if strCmd else "exec"
|
|
32
|
-
|
|
33
|
-
# e = OSISEngine.GetInstance()
|
|
34
|
-
# return e.OSIS_Run(strCmd, mode)
|
|
35
|
-
|
|
36
15
|
# def _log(text, filename="pyosis.log"):
|
|
37
16
|
# """简单的日志函数"""
|
|
38
17
|
# timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
@@ -54,83 +33,58 @@ def osis_run(strCmd: str="", mode: Literal["stash", "exec"]="exec") -> tuple[boo
|
|
|
54
33
|
"""
|
|
55
34
|
response = osis_client("OSIS_Run", locals())
|
|
56
35
|
return response['success'], response['error']
|
|
57
|
-
# # 1. 配置 C++ 服务地址
|
|
58
|
-
# url = "http://localhost:8080/OSIS_Run"
|
|
59
|
-
|
|
60
|
-
# # 2. 构造请求参数(JSON 格式,UTF-8 编码)
|
|
61
|
-
# payload = {
|
|
62
|
-
# "strCmd": strCmd,
|
|
63
|
-
# "mode": mode
|
|
64
|
-
# }
|
|
65
|
-
|
|
66
|
-
# # 3. 发送 POST 请求(自动处理中文编码)
|
|
67
|
-
# try:
|
|
68
|
-
# response = requests.post(
|
|
69
|
-
# url,
|
|
70
|
-
# data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
|
|
71
|
-
# headers={"Content-Type": "application/json; charset=utf-8"},
|
|
72
|
-
# timeout=10
|
|
73
|
-
# )
|
|
74
|
-
# response.raise_for_status() # 抛出 HTTP 错误
|
|
75
|
-
|
|
76
|
-
# # 4. 解析返回值,还原为 C++ 原生返回格式
|
|
77
|
-
# resp_data = response.json()
|
|
78
|
-
# return resp_data["success"], resp_data["message"]
|
|
79
36
|
|
|
80
|
-
# except Exception as e:
|
|
81
|
-
# # 异常时返回和 C++ 一致的格式
|
|
82
|
-
# return False, f"调用失败:{str(e)}"
|
|
83
|
-
|
|
84
|
-
|
|
85
37
|
def _log(text, log_dir="pyosis_logs"):
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
text: 要记录的代码行
|
|
92
|
-
log_dir: 日志文件夹路径
|
|
93
|
-
Returns:
|
|
94
|
-
目标文件路径
|
|
95
|
-
"""
|
|
96
|
-
# 创建日志目录
|
|
97
|
-
if not os.path.exists(log_dir):
|
|
98
|
-
os.makedirs(log_dir)
|
|
99
|
-
files = []
|
|
100
|
-
else:
|
|
101
|
-
# 获取所有文件(排除子目录)
|
|
102
|
-
files = [os.path.join(log_dir, f) for f in os.listdir(log_dir)
|
|
103
|
-
if os.path.isfile(os.path.join(log_dir, f))]
|
|
104
|
-
|
|
105
|
-
current_time = datetime.datetime.now()
|
|
106
|
-
target_file = None
|
|
107
|
-
is_new_file = True
|
|
38
|
+
...
|
|
39
|
+
# def _log(text, log_dir="pyosis_logs"):
|
|
40
|
+
# """
|
|
41
|
+
# 同一轮执行(<1秒间隔)的代码追加到同一文件,
|
|
42
|
+
# 超过1秒则创建新文件
|
|
108
43
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
44
|
+
# Args:
|
|
45
|
+
# text: 要记录的代码行
|
|
46
|
+
# log_dir: 日志文件夹路径
|
|
47
|
+
# Returns:
|
|
48
|
+
# 目标文件路径
|
|
49
|
+
# """
|
|
50
|
+
# # 创建日志目录
|
|
51
|
+
# if not os.path.exists(log_dir):
|
|
52
|
+
# os.makedirs(log_dir)
|
|
53
|
+
# files = []
|
|
54
|
+
# else:
|
|
55
|
+
# # 获取所有文件(排除子目录)
|
|
56
|
+
# files = [os.path.join(log_dir, f) for f in os.listdir(log_dir)
|
|
57
|
+
# if os.path.isfile(os.path.join(log_dir, f))]
|
|
58
|
+
|
|
59
|
+
# current_time = datetime.datetime.now()
|
|
60
|
+
# target_file = None
|
|
61
|
+
# is_new_file = True
|
|
62
|
+
|
|
63
|
+
# # 查找最近修改的文件
|
|
64
|
+
# if files:
|
|
65
|
+
# latest_file = max(files, key=os.path.getmtime)
|
|
66
|
+
# mtime = datetime.datetime.fromtimestamp(os.path.getmtime(latest_file))
|
|
113
67
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
68
|
+
# # 如果小于1秒,追加到该文件
|
|
69
|
+
# if (current_time - mtime).total_seconds() < 1.0:
|
|
70
|
+
# target_file = latest_file
|
|
71
|
+
# is_new_file = False
|
|
118
72
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
73
|
+
# # 需要创建新文件
|
|
74
|
+
# if is_new_file:
|
|
75
|
+
# timestamp = current_time.strftime("%Y%m%d_%H%M%S_%f")[:-3] # 毫秒级
|
|
76
|
+
# target_file = os.path.join(log_dir, f"session_{timestamp}.txt")
|
|
123
77
|
|
|
124
|
-
|
|
125
|
-
|
|
78
|
+
# with open(target_file, 'a', encoding='utf-8') as f:
|
|
79
|
+
# f.write(f"{text}\n")
|
|
126
80
|
|
|
127
|
-
|
|
81
|
+
# return target_file
|
|
128
82
|
|
|
129
|
-
def _tmp(text, tmp_file="tmp.tmp", clear=False): # 运行时临时信息
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
83
|
+
# def _tmp(text, tmp_file="tmp.tmp", clear=False): # 运行时临时信息
|
|
84
|
+
# if clear:
|
|
85
|
+
# os.remove(tmp_file)
|
|
86
|
+
# with open(tmp_file, "a+", encoding="utf-8") as f:
|
|
87
|
+
# f.write(text)
|
|
134
88
|
|
|
135
89
|
class OSISFunctionRegistry:
|
|
136
90
|
"""
|
|
@@ -206,7 +206,7 @@ class OSISEngine:
|
|
|
206
206
|
# 通用操作(直接暴露 general 和 core 的函数)
|
|
207
207
|
# ──────────────────────────────────────────
|
|
208
208
|
|
|
209
|
-
def run(self, cmd: str = "") ->
|
|
209
|
+
def run(self, cmd: str = "") -> None:
|
|
210
210
|
"""执行 OSIS 命令流
|
|
211
211
|
|
|
212
212
|
Args:
|
|
@@ -244,7 +244,7 @@ class OSISEngine:
|
|
|
244
244
|
if not ok:
|
|
245
245
|
raise RuntimeError(f"清屏失败: {err}")
|
|
246
246
|
|
|
247
|
-
def matrix(self, name: str, data: Any) ->
|
|
247
|
+
def matrix(self, name: str, data: Any) -> str:
|
|
248
248
|
"""定义矩阵(用于自定义截面等)
|
|
249
249
|
|
|
250
250
|
Args:
|
|
@@ -257,6 +257,7 @@ class OSISEngine:
|
|
|
257
257
|
ok, err = osis_matrix(name, data)
|
|
258
258
|
if not ok:
|
|
259
259
|
raise RuntimeError(f"定义失败: {err}")
|
|
260
|
+
return name
|
|
260
261
|
|
|
261
262
|
def output_result_for_calc_book(self) -> dict:
|
|
262
263
|
"""输出计算书所需结果"""
|
|
@@ -290,7 +291,7 @@ class OSISEngine:
|
|
|
290
291
|
# ──────────────────────────────────────────
|
|
291
292
|
# 便捷方法(委托给 control manager)
|
|
292
293
|
# ──────────────────────────────────────────
|
|
293
|
-
def export_apdl(self, path) -> None:
|
|
294
|
+
def export_apdl(self, path: str | None = None) -> None:
|
|
294
295
|
"""导出前处理状态为 .out 文件
|
|
295
296
|
|
|
296
297
|
Args:
|
|
@@ -298,7 +299,7 @@ class OSISEngine:
|
|
|
298
299
|
"""
|
|
299
300
|
self.control.export_apdl(path)
|
|
300
301
|
|
|
301
|
-
def import_apdl(self, path: str
|
|
302
|
+
def import_apdl(self, path: str) -> None:
|
|
302
303
|
"""读取 .out / .sml 文件
|
|
303
304
|
|
|
304
305
|
Args:
|