osis-python 0.7.4__tar.gz → 0.7.7__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.
Files changed (124) hide show
  1. {osis_python-0.7.4/src/osis_python.egg-info → osis_python-0.7.7}/PKG-INFO +4 -3
  2. {osis_python-0.7.4 → osis_python-0.7.7}/README.md +3 -2
  3. {osis_python-0.7.4 → osis_python-0.7.7/src/osis_python.egg-info}/PKG-INFO +4 -3
  4. {osis_python-0.7.4 → osis_python-0.7.7}/src/osis_python.egg-info/SOURCES.txt +5 -1
  5. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/__init__.py +1 -1
  6. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/control/manager.py +20 -0
  7. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/__init__.py +1 -0
  8. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/apdl_sync.py +4 -1
  9. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/client.py +50 -0
  10. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/engine.py +25 -0
  11. osis_python-0.7.7/src/pyosis/core/sdk.py +76 -0
  12. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/solver.py +18 -2
  13. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/load/manager.py +17 -0
  14. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/material/manager.py +20 -0
  15. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/node/manager.py +20 -0
  16. osis_python-0.7.7/src/pyosis/property/creep_shrink.py +71 -0
  17. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/property/manager.py +51 -13
  18. osis_python-0.7.7/src/pyosis/result/__init__.py +12 -0
  19. osis_python-0.7.7/src/pyosis/result/headless.py +122 -0
  20. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/result/manager.py +66 -0
  21. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/manager.py +17 -0
  22. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/transfer/generator.py +54 -19
  23. osis_python-0.7.7/src/pyosis/transfer/introspect.py +149 -0
  24. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/transfer/out_to_python.py +59 -3
  25. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/transfer/routes.py +73 -2
  26. osis_python-0.7.7/tests/test_transfer_fixups.py +126 -0
  27. osis_python-0.7.4/src/pyosis/property/creep_shrink.py +0 -53
  28. osis_python-0.7.4/src/pyosis/result/__init__.py +0 -4
  29. {osis_python-0.7.4 → osis_python-0.7.7}/LICENSE +0 -0
  30. {osis_python-0.7.4 → osis_python-0.7.7}/pyproject.toml +0 -0
  31. {osis_python-0.7.4 → osis_python-0.7.7}/setup.cfg +0 -0
  32. {osis_python-0.7.4 → osis_python-0.7.7}/src/osis_python.egg-info/dependency_links.txt +0 -0
  33. {osis_python-0.7.4 → osis_python-0.7.7}/src/osis_python.egg-info/requires.txt +0 -0
  34. {osis_python-0.7.4 → osis_python-0.7.7}/src/osis_python.egg-info/top_level.txt +0 -0
  35. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/boundary/__init__.py +0 -0
  36. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/boundary/interface.py +0 -0
  37. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/boundary/manager.py +0 -0
  38. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/control/__init__.py +0 -0
  39. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/control/control.py +0 -0
  40. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/control/io.py +0 -0
  41. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/control/nonlinear.py +0 -0
  42. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/all_func.py +0 -0
  43. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/basic_manager.py +0 -0
  44. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/batch.py +0 -0
  45. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/command.py +0 -0
  46. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/exceptions.py +0 -0
  47. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/references.py +0 -0
  48. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/core/sync_apdl_cli.py +0 -0
  49. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/display/__init__.py +0 -0
  50. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/display/interface.py +0 -0
  51. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/display/manager.py +0 -0
  52. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/dynamic/__init__.py +0 -0
  53. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/dynamic/load_to_mass.py +0 -0
  54. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/dynamic/manager.py +0 -0
  55. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/dynamic/modal.py +0 -0
  56. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/dynamic/seismic.py +0 -0
  57. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/element/__init__.py +0 -0
  58. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/element/interface.py +0 -0
  59. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/element/manager.py +0 -0
  60. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/general/__init__.py +0 -0
  61. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/general/interface.py +0 -0
  62. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/geometry/__init__.py +0 -0
  63. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/geometry/interface.py +0 -0
  64. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/geometry/manager.py +0 -0
  65. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/live/__init__.py +0 -0
  66. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/live/analysis.py +0 -0
  67. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/live/grade.py +0 -0
  68. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/live/lane.py +0 -0
  69. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/live/manager.py +0 -0
  70. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/load/__init__.py +0 -0
  71. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/load/loadcase.py +0 -0
  72. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/load/static.py +0 -0
  73. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/load/tendon.py +0 -0
  74. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/material/__init__.py +0 -0
  75. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/material/interface.py +0 -0
  76. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/node/__init__.py +0 -0
  77. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/node/interface.py +0 -0
  78. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/post/__init__.py +0 -0
  79. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/post/combine.py +0 -0
  80. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/post/design_check.py +0 -0
  81. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/post/display.py +0 -0
  82. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/post/manager.py +0 -0
  83. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/project/__init__.py +0 -0
  84. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/project/interface.py +0 -0
  85. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/project/manager.py +0 -0
  86. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/property/__init__.py +0 -0
  87. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/property/component_thickness.py +0 -0
  88. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/property/coordinate.py +0 -0
  89. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/property/damping.py +0 -0
  90. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/property/pu_curve.py +0 -0
  91. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/quick_building/__init__.py +0 -0
  92. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/quick_building/interface.py +0 -0
  93. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/result/check.py +0 -0
  94. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/result/env.py +0 -0
  95. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/result/loadcase.py +0 -0
  96. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/result/result.py +0 -0
  97. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/__init__.py +0 -0
  98. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/common.py +0 -0
  99. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/composite.py +0 -0
  100. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/numeric.py +0 -0
  101. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/param.py +0 -0
  102. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/rebar.py +0 -0
  103. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/rib.py +0 -0
  104. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/section/steel.py +0 -0
  105. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/settlement/__init__.py +0 -0
  106. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/settlement/interface.py +0 -0
  107. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/settlement/manager.py +0 -0
  108. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/stability/__init__.py +0 -0
  109. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/stability/buckling.py +0 -0
  110. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/stability/manager.py +0 -0
  111. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/stage/__init__.py +0 -0
  112. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/stage/define.py +0 -0
  113. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/stage/manager.py +0 -0
  114. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/stage/overall.py +0 -0
  115. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/thickness/__init__.py +0 -0
  116. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/thickness/interface.py +0 -0
  117. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/thickness/manager.py +0 -0
  118. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/transfer/__init__.py +0 -0
  119. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/transfer/matrix.py +0 -0
  120. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/transfer/parser.py +0 -0
  121. {osis_python-0.7.4 → osis_python-0.7.7}/src/pyosis/transfer/split.py +0 -0
  122. {osis_python-0.7.4 → osis_python-0.7.7}/tests/test_batch.py +0 -0
  123. {osis_python-0.7.4 → osis_python-0.7.7}/tests/test_delete_occupied.py +0 -0
  124. {osis_python-0.7.4 → osis_python-0.7.7}/tests/test_project_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osis-python
3
- Version: 0.7.4
3
+ Version: 0.7.7
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
@@ -255,9 +255,10 @@ engine.prop.coord.create_three_point(
255
255
  p3x=0, p3y=1, p3z=0,
256
256
  )
257
257
 
258
- # Creep and shrinkage(no, name, avg_humidity, birth_time, type_coeff, shrink_birth)
258
+ # Creep and shrinkage(no, name, code, fcuk, avg_humidity,
259
+ # component_approximate_size, type_coeff, birth_by_shrinking, fly_ash_ratio)
259
260
  engine.prop.creep_shrink.create(no=1, name="Creep1", avg_humidity=70.0,
260
- birth_time=7, type_coeff=5.0, shrink_birth=3)
261
+ type_coeff=5.0, birth_by_shrinking=3)
261
262
 
262
263
  # Damping (Rayleigh 自定义系数)
263
264
  engine.prop.damping.create_rayleigh_custom(name="Damping1", alpha=0.05, beta=0.005)
@@ -224,9 +224,10 @@ engine.prop.coord.create_three_point(
224
224
  p3x=0, p3y=1, p3z=0,
225
225
  )
226
226
 
227
- # Creep and shrinkage(no, name, avg_humidity, birth_time, type_coeff, shrink_birth)
227
+ # Creep and shrinkage(no, name, code, fcuk, avg_humidity,
228
+ # component_approximate_size, type_coeff, birth_by_shrinking, fly_ash_ratio)
228
229
  engine.prop.creep_shrink.create(no=1, name="Creep1", avg_humidity=70.0,
229
- birth_time=7, type_coeff=5.0, shrink_birth=3)
230
+ type_coeff=5.0, birth_by_shrinking=3)
230
231
 
231
232
  # Damping (Rayleigh 自定义系数)
232
233
  engine.prop.damping.create_rayleigh_custom(name="Damping1", alpha=0.05, beta=0.005)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osis-python
3
- Version: 0.7.4
3
+ Version: 0.7.7
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
@@ -255,9 +255,10 @@ engine.prop.coord.create_three_point(
255
255
  p3x=0, p3y=1, p3z=0,
256
256
  )
257
257
 
258
- # Creep and shrinkage(no, name, avg_humidity, birth_time, type_coeff, shrink_birth)
258
+ # Creep and shrinkage(no, name, code, fcuk, avg_humidity,
259
+ # component_approximate_size, type_coeff, birth_by_shrinking, fly_ash_ratio)
259
260
  engine.prop.creep_shrink.create(no=1, name="Creep1", avg_humidity=70.0,
260
- birth_time=7, type_coeff=5.0, shrink_birth=3)
261
+ type_coeff=5.0, birth_by_shrinking=3)
261
262
 
262
263
  # Damping (Rayleigh 自定义系数)
263
264
  engine.prop.damping.create_rayleigh_custom(name="Damping1", alpha=0.05, beta=0.005)
@@ -25,6 +25,7 @@ src/pyosis/core/command.py
25
25
  src/pyosis/core/engine.py
26
26
  src/pyosis/core/exceptions.py
27
27
  src/pyosis/core/references.py
28
+ src/pyosis/core/sdk.py
28
29
  src/pyosis/core/solver.py
29
30
  src/pyosis/core/sync_apdl_cli.py
30
31
  src/pyosis/display/__init__.py
@@ -79,6 +80,7 @@ src/pyosis/quick_building/interface.py
79
80
  src/pyosis/result/__init__.py
80
81
  src/pyosis/result/check.py
81
82
  src/pyosis/result/env.py
83
+ src/pyosis/result/headless.py
82
84
  src/pyosis/result/loadcase.py
83
85
  src/pyosis/result/manager.py
84
86
  src/pyosis/result/result.py
@@ -106,6 +108,7 @@ src/pyosis/thickness/interface.py
106
108
  src/pyosis/thickness/manager.py
107
109
  src/pyosis/transfer/__init__.py
108
110
  src/pyosis/transfer/generator.py
111
+ src/pyosis/transfer/introspect.py
109
112
  src/pyosis/transfer/matrix.py
110
113
  src/pyosis/transfer/out_to_python.py
111
114
  src/pyosis/transfer/parser.py
@@ -113,4 +116,5 @@ src/pyosis/transfer/routes.py
113
116
  src/pyosis/transfer/split.py
114
117
  tests/test_batch.py
115
118
  tests/test_delete_occupied.py
116
- tests/test_project_manager.py
119
+ tests/test_project_manager.py
120
+ tests/test_transfer_fixups.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.7.4"
10
+ __version__ = "0.7.7"
11
11
 
12
12
  from .core.engine import OSISEngine
13
13
  from .core.batch import batch, flush, batch_state, BatchError
@@ -18,6 +18,7 @@ from __future__ import annotations
18
18
  from typing import Literal
19
19
 
20
20
  from ..core import osis_run
21
+ from ..core.client import osis_client
21
22
  from .control import (
22
23
  osis_acel,
23
24
  osis_calc_tendon,
@@ -373,6 +374,25 @@ class ControlManager:
373
374
  if not ok:
374
375
  raise RuntimeError(f"设置模态分析参数失败: {err}")
375
376
 
377
+ # ── 查询 ────────────────────────────────────
378
+
379
+ def summary(self) -> list[dict]:
380
+ '''获取分析控制摘要(走 GetAnalysisControlSummary 端点)
381
+
382
+ 汇总当前模型将要执行的分析类型(特征值分析、施工阶段分析等),
383
+ 每项含 name/type/summary/count。
384
+
385
+ Returns:
386
+ list[dict]: 分析控制摘要列表,未定义分析时为空列表
387
+
388
+ Raises:
389
+ RuntimeError: 查询失败时抛出异常
390
+ '''
391
+ resp = osis_client("GetAnalysisControlSummary", {})
392
+ if not resp.get("success"):
393
+ raise RuntimeError(f"{resp.get('error')}")
394
+ return list(resp.get("data") or [])
395
+
376
396
  def __repr__(self) -> str:
377
397
  return "ControlManager()"
378
398
 
@@ -14,3 +14,4 @@ from .batch import batch, flush, batch_state, BatchError
14
14
  from .basic_manager import BasicManager, LazyRef
15
15
  from .exceptions import DependencyError
16
16
  from .references import get_references, raise_if_occupied
17
+ from .sdk import health, sdk_version, list_commands, instance_info
@@ -51,8 +51,11 @@ class ApdlSessionStore:
51
51
 
52
52
 
53
53
  # 读取 .out 文件内容
54
+ # 实测 5.1(2026-10 构建)export_apdl 导出为 UTF-8(无 BOM);UTF-8 中文可能
55
+ # 恰好是合法 GBK,GBK 优先会静默乱码,所以 UTF-8 在前。旧版若导出 GBK,
56
+ # 按 UTF-8 解码通常直接抛错并回落到 GBK,不会误判。
54
57
  def _read_out_text(path: Path) -> str:
55
- for encoding in ("gbk", "utf-8", "gb2312", "gb18030", "latin-1"):
58
+ for encoding in ("utf-8-sig", "utf-8", "gbk", "gb18030", "latin-1"):
56
59
  try:
57
60
  return path.read_text(encoding=encoding)
58
61
  except UnicodeDecodeError:
@@ -102,4 +102,54 @@ def osis_client(
102
102
 
103
103
  except requests.RequestException as e:
104
104
  return {"success": False, "error": f"调用失败: {str(e)}"}
105
+
106
+
107
+ def osis_get(
108
+ path: str,
109
+ base_url=None,
110
+ timeout: float | None = None,
111
+ ) -> dict:
112
+ """
113
+ 通用 OSIS GET 客户端(复用连接池)
114
+
115
+ 用于只绑定 GET 的端点(如 /instance);/health、/sdk/* 同时支持
116
+ GET/POST,查询类调用统一走本函数。
117
+
118
+ Args:
119
+ path: 端点路径(如 "instance",无需前导斜杠)
120
+ Returns:
121
+ 成功时返回端点 JSON;失败时返回 {"success": False, "error": ...}
122
+ """
123
+ from .batch import batch_state, flush as _flush
124
+ if batch_state.active and batch_state.buffer and not batch_state.flushing:
125
+ _flush()
126
+
127
+ base_url = base_url or os.environ.get("OSIS_URL", f"{DEFAULT_URL}:{DEFAULT_PORT}")
128
+ url = f"{base_url}/{path.lstrip('/')}"
129
+
130
+ try:
131
+ response = session.get(
132
+ url,
133
+ timeout=timeout if timeout is not None else DEFAULT_TIMEOUT,
134
+ )
135
+
136
+ data = None
137
+ if response.content:
138
+ try:
139
+ data = response.json()
140
+ except ValueError:
141
+ pass
142
+
143
+ if response.status_code == 404:
144
+ return {"success": False, "error": f"接口不存在: {path}"}
145
+
146
+ if response.ok: # 200-299
147
+ if data is not None:
148
+ return data
149
+ return {"success": False, "error": f"接口返回空数据: {path}"}
150
+
151
+ return {"success": False, "error": f"HTTP {response.status_code}: {response.text[:200]}"}
152
+
153
+ except requests.RequestException as e:
154
+ return {"success": False, "error": f"调用失败: {str(e)}"}
105
155
 
@@ -52,6 +52,7 @@ from ..general.interface import (
52
52
  )
53
53
  from .command import osis_run
54
54
  from .client import set_osis_port, set_osis_url
55
+ from .sdk import sdk_version, list_commands, instance_info, health as _sdk_health
55
56
 
56
57
 
57
58
  class OSISEngine:
@@ -329,6 +330,30 @@ class OSISEngine:
329
330
  """输出计算书所需结果"""
330
331
  return output_result_for_calc_book()
331
332
 
333
+ # ──────────────────────────────────────────
334
+ # 服务端元信息(/sdk/*、/instance)
335
+ # ──────────────────────────────────────────
336
+
337
+ def sdk_version(self) -> dict:
338
+ """查询 SDK/OSIS 版本与 ABI
339
+
340
+ Returns:
341
+ {"success": True, "sdk": 版本串, "osis": 版本串, "abi": ABI, "port": 端口}
342
+ """
343
+ return sdk_version()
344
+
345
+ def list_commands(self) -> list[str]:
346
+ """查询运行时可用命令名(GUI 书册命令不列出)"""
347
+ return list_commands()
348
+
349
+ def instance_info(self) -> dict:
350
+ """查询 OSIS 实例信息(pid/port/project/version/state)"""
351
+ return instance_info()
352
+
353
+ def is_alive(self) -> bool:
354
+ """存活探测(POST /health,不碰工程状态)"""
355
+ return _sdk_health()
356
+
332
357
  # ──────────────────────────────────────────
333
358
  # 便捷方法(委托给 project manager)
334
359
  # ──────────────────────────────────────────
@@ -0,0 +1,76 @@
1
+ """SDK 元信息与服务端实例查询
2
+
3
+ 对应 PySolver 端点 /health、/sdk/version、/sdk/commands、GET /instance。
4
+ 这些端点同时支持 GET/POST(/instance 仅 GET),不依赖工程状态。
5
+
6
+ 用法:
7
+ from pyosis.core.sdk import sdk_version, list_commands, instance_info
8
+ sdk_version() # {"success": True, "sdk": "5.1.x", "osis": ..., "abi": ..., "port": ...}
9
+ list_commands() # 运行时可用的命令名列表
10
+ instance_info() # {"pid": ..., "port": ..., "project": ..., "version": ..., "state": ...}
11
+ """
12
+ from __future__ import annotations
13
+
14
+ from .client import osis_client, osis_get
15
+
16
+
17
+ def health(base_url=None) -> bool:
18
+ """存活探测(POST /health)。
19
+
20
+ 只证明 HTTP server 在跑,不碰工程/command 状态。
21
+
22
+ Returns:
23
+ bool: server 存活返回 True
24
+ """
25
+ resp = osis_client("health", {}, base_url=base_url)
26
+ return bool(resp.get("success"))
27
+
28
+
29
+ def sdk_version(base_url=None) -> dict:
30
+ """查询 SDK/OSIS 版本与 ABI(POST/GET /sdk/version)。
31
+
32
+ Returns:
33
+ {"success": True, "sdk": 版本串, "osis": 版本串, "abi": ABI, "port": 端口}
34
+
35
+ Raises:
36
+ RuntimeError: 查询失败时抛出
37
+ """
38
+ resp = osis_client("sdk/version", {}, base_url=base_url)
39
+ if not resp.get("success"):
40
+ raise RuntimeError(f"查询 SDK 版本失败: {resp.get('error')}")
41
+ return resp
42
+
43
+
44
+ def list_commands(base_url=None) -> list[str]:
45
+ """查询运行时可用命令名(POST/GET /sdk/commands)。
46
+
47
+ 返回当前工程命令流可识别的命令名(GUI 书册命令不列出)。
48
+
49
+ Returns:
50
+ list[str]: 命令名列表
51
+
52
+ Raises:
53
+ RuntimeError: 查询失败时抛出
54
+ """
55
+ resp = osis_client("sdk/commands", {}, base_url=base_url)
56
+ if not resp.get("success"):
57
+ raise RuntimeError(f"查询命令列表失败: {resp.get('error')}")
58
+ return list(resp.get("commands") or [])
59
+
60
+
61
+ def instance_info(base_url=None) -> dict:
62
+ """查询 OSIS 实例信息(GET /instance)。
63
+
64
+ broker 登记实例时用它确认端口实际归属。
65
+
66
+ Returns:
67
+ {"pid": 进程号, "port": HTTP 端口, "project": 工程路径,
68
+ "version": 版本, "state": 实例状态}
69
+
70
+ Raises:
71
+ RuntimeError: 查询失败时抛出
72
+ """
73
+ resp = osis_get("instance", base_url=base_url)
74
+ if not isinstance(resp, dict) or resp.get("error"):
75
+ raise RuntimeError(f"查询实例信息失败: {resp.get('error', resp)}")
76
+ return resp
@@ -22,7 +22,8 @@ class OSISSolver:
22
22
 
23
23
  Args:
24
24
  osis_install_path: OSIS 安装根目录,根目录下需有 PySolver.dll。
25
- port: HTTP server 端口;<0 用 PySolver 默认 18080。端口被占会失败。
25
+ port: HTTP server 端口;<=0 由系统随机分配(bind :0),实际端口
26
+ 回写 self.port;默认 18080。指定端口被占会失败。
26
27
  host: 监听地址,默认 127.0.0.1。
27
28
 
28
29
  Raises:
@@ -83,7 +84,18 @@ class OSISSolver:
83
84
  self._add_dll_search_dir(os.path.dirname(path))
84
85
 
85
86
  try:
86
- lib = ctypes.CDLL(path)
87
+ # Debug 构建的依赖(如 HPDI.OSIS.IO 的 DebugWnd)会在 DLL 静态初始化里
88
+ # AllocConsole + freopen 劫持 stdio——python 宿主的输出被抢走、
89
+ # 解释器退出码变 120。加载前 dup 一份标准流,加载完立刻恢复。
90
+ saved_out = os.dup(1)
91
+ saved_err = os.dup(2)
92
+ try:
93
+ lib = ctypes.CDLL(path)
94
+ finally:
95
+ os.dup2(saved_out, 1)
96
+ os.dup2(saved_err, 2)
97
+ os.close(saved_out)
98
+ os.close(saved_err)
87
99
  except OSError as e:
88
100
  raise RuntimeError(f"OSISSolver: 加载 {path} 失败: {e}")
89
101
 
@@ -102,6 +114,10 @@ class OSISSolver:
102
114
 
103
115
  self._lib = lib
104
116
  self._started = True
117
+ # port<=0(随机分配)时 AutoBootstrap 返回系统分配的实际端口,回写,
118
+ # self.url / engine 连接才指向正确地址
119
+ if actual_port > 0:
120
+ self._port = actual_port
105
121
  self._wait_ready()
106
122
  return self
107
123
 
@@ -1873,6 +1873,23 @@ class TendonManager:
1873
1873
  "shapes": self.shape.count()
1874
1874
  }
1875
1875
 
1876
+ def prestress_loads(self) -> list[dict]:
1877
+ """获取所有预应力荷载(走 GetAllPrestressedLoadInfo 端点)
1878
+
1879
+ 遍历所有荷载工况下的预应力荷载(钢束张拉信息)。
1880
+
1881
+ Returns:
1882
+ list[dict]: 每条含 name/tensionMethod/tensionMethodName/
1883
+ tensionForce/tensionForceName/beg/end/relatedLoadCase/loadCase
1884
+
1885
+ Raises:
1886
+ RuntimeError: 查询失败时抛出异常
1887
+ """
1888
+ resp = osis_client("GetAllPrestressedLoadInfo", {})
1889
+ if not resp.get("success"):
1890
+ raise RuntimeError(f"{resp.get('error')}")
1891
+ return [d for d in resp.get("data") or [] if isinstance(d, dict) and d]
1892
+
1876
1893
  def clear(self) -> None:
1877
1894
  """清空所有钢束形状和钢束特性(先清空形状,再清空特性)"""
1878
1895
  self.shape.clear()
@@ -121,6 +121,26 @@ class MaterialManager(BasicManager):
121
121
 
122
122
  return materials
123
123
 
124
+ def all_prestressed(self) -> list[Material]:
125
+ """获取所有预应力材料(走 GetAllPrestressedMaterialInfo 端点)
126
+
127
+ 与 all() 的区别:只返回材料类型为预应力(PRESTRESSED)的材料,
128
+ 服务端按类型过滤,不需要客户端再筛。
129
+
130
+ Returns:
131
+ list[Material]: 预应力材料列表
132
+
133
+ Raises:
134
+ RuntimeError: 查询失败时抛出异常
135
+ """
136
+ resp = osis_client("GetAllPrestressedMaterialInfo", {})
137
+ if not resp.get("success"):
138
+ raise RuntimeError(f"{resp.get('error')}")
139
+ return [
140
+ Material._from_dict(d) for d in resp.get("data", [])
141
+ if isinstance(d, dict) and "no" in d
142
+ ]
143
+
124
144
  def get_dependencies(self, no: int) -> dict[str, list]:
125
145
  """查询材料被谁引用"""
126
146
  return get_references("Material", no=no)
@@ -111,6 +111,26 @@ class NodeManager(BasicManager):
111
111
  raise RuntimeError(f"{resp['error']}")
112
112
  nodes = [Node._from_dict(d) for d in resp.get("data", []) if "no" in d]
113
113
  return nodes
114
+
115
+ def coordinates(self) -> dict[int, tuple[float, float, float]]:
116
+ """获取所有节点坐标(走 GetCoordinate 端点)
117
+
118
+ 比 all() 更轻量——只要坐标不要分组等附加信息时用这个。
119
+
120
+ Returns:
121
+ dict: {节点编号: (x, y, z)}
122
+
123
+ Raises:
124
+ RuntimeError: 查询失败时抛出异常
125
+ """
126
+ resp = osis_client("GetCoordinate", {})
127
+ if not resp.get("success"):
128
+ raise RuntimeError(f"{resp.get('error')}")
129
+ return {
130
+ d["id"]: (d.get("x", 0.0), d.get("y", 0.0), d.get("z", 0.0))
131
+ for d in resp.get("data") or []
132
+ if isinstance(d, dict) and "id" in d
133
+ }
114
134
 
115
135
  # ── 增删改 ────────────────────────────────
116
136
 
@@ -0,0 +1,71 @@
1
+ '''
2
+ pyosis.property.creep_shrink 的 Docstring
3
+
4
+ 时间依存性材料属性
5
+ '''
6
+ from ..core import REGISTRY
7
+
8
+ @REGISTRY.register("CrpShrk")
9
+ def osis_creep_shrink(
10
+ nNO: int = 1,
11
+ strName: str = "收缩徐变1",
12
+ strCode: str = "JTG3362_2018",
13
+ dFcuk: float = 5.0e7,
14
+ dAvgHumidity: float = 70.0,
15
+ dComponentApproximateSize: float = 1.0,
16
+ dTypeCoeff: float = 5.0,
17
+ nBirthByShrinking: int = 3,
18
+ dFlyAshRatio: float = 0.0,
19
+ ):
20
+ """
21
+ 创建或修改收缩徐变特性
22
+
23
+ 命令流:CrpShrk, Index, Name, Code, Fcuk, AVG.Humidity,
24
+ ComponentApproximateSize, Type.Coeff, BirthByShrinking, FlyAshRatio
25
+ 参数按此顺序组装,共 9 个,缺一不可(软件侧会校验参数个数)。
26
+
27
+ Args:
28
+ nNO (int): 收缩徐变特性编号(Index)
29
+ strName (str): 名称(Name)
30
+ strCode (str): 规范(Code),目前只支持 JTG3362_2018
31
+ dFcuk (float): 28天龄期的混凝土强度(Fcuk),按工程当前压力单位填写,
32
+ 默认单位 Pa 下 5.0e7 即 50MPa,合法区间 1MPa~200MPa
33
+ dAvgHumidity (float): 周围环境的相对湿度,百分比,取值 40~99
34
+ dComponentApproximateSize (float): 构件大致尺寸(m),必须大于 0
35
+ dTypeCoeff (float): 水泥种类系数(Type.Coeff)
36
+ nBirthByShrinking (int): 收缩开始时的混凝土龄期,天数(BirthByShrinking)
37
+ dFlyAshRatio (float): 粉煤灰添加量,百分比,取值 0~50
38
+
39
+ Returns:
40
+ tuple (bool, str): 是否成功,失败原因
41
+ """
42
+ pass
43
+
44
+ @REGISTRY.register('CrpShrkDel')
45
+ def osis_creep_shrink_del(nNO: int):
46
+ """删除收缩徐变特性
47
+
48
+ Args:
49
+ nNO (int): 收缩徐变特性编号
50
+
51
+ Returns:
52
+ tuple (bool, str):
53
+ - bool: 操作是否成功
54
+ - str: 失败原因(如果操作失败)
55
+ """
56
+ pass
57
+
58
+ @REGISTRY.register('CrpShrkMod')
59
+ def osis_creep_shrink_mod(nOld: int, nNew: int):
60
+ """修改一个收缩徐变特性的编号。收缩徐变特性编号存在时,交换
61
+
62
+ Args:
63
+ nOld (int): 旧编号
64
+ nNew (int): 新编号
65
+
66
+ Returns:
67
+ tuple (bool, str):
68
+ - bool: 操作是否成功
69
+ - str: 失败原因(如果操作失败)
70
+ """
71
+ pass
@@ -3,7 +3,7 @@
3
3
  用法:
4
4
  >>> from pyosis.property import property_manager
5
5
  >>> property_manager.coord.create_three_point(1, 0, 0, 0, 10, 0, 0, 0, 10, 0)
6
- >>> property_manager.creep_shrink.create(1, "CS1", 70.0, 7, 5.0, 3)
6
+ >>> property_manager.creep_shrink.create(1, "CS1", "JTG3362_2018", 5.0e7, 70.0, 1.0, 5.0, 3)
7
7
  >>> property_manager.damping.create_modal("Damp1", 0.05)
8
8
  >>> property_manager.pu_curve.create(1, "PU1", 0, 3, 0.0, 0.01, 0.02, 0.0, 100.0, 150.0)
9
9
  """
@@ -295,24 +295,39 @@ class CoordinateManager(BasicManager):
295
295
  class CreepShrink:
296
296
  """收缩徐变对象"""
297
297
  avg_humidity: float
298
- birth_by_shrinking: int
299
- birth_time: int
298
+ birth_by_shrinking: int # 收缩起始龄期(天),接口字段 birthByShrinking
299
+ birth_time: int # 只读遗留字段,当前命令流已不再写入
300
+ code: str # 规范,仅 JTG3362_2018
301
+ component_approximate_size: float # 构件大致尺寸(m)
302
+ fcuk: float # 28天龄期混凝土强度,工程当前压力单位
303
+ fly_ash_ratio: float # 粉煤灰添加量(%)
300
304
  name: str
301
305
  no: int
302
- shrink_birth: int
303
306
  related_material: list[int]
307
+ shrink_birth: int # 同 birth_by_shrinking 的旧名,读到的是同一个值
304
308
  type_coeff: float
305
309
  @classmethod
306
310
  def _from_dict(cls, d: dict) -> CreepShrink:
307
- """从接口 dict 构造 CreepShrink 对象(内部使用)"""
311
+ """从接口 dict 构造 CreepShrink 对象(内部使用)
312
+
313
+ 收缩起始龄期的接口字段名是 birthByShrinking;旧的 shrinkBirth 读出来
314
+ 恒为 None,因此 birth_by_shrinking 与 shrink_birth 两个属性都取该字段。
315
+ """
316
+ birth = d.get("birthByShrinking")
317
+ if birth is None:
318
+ birth = d.get("shrinkBirth")
308
319
  return cls(
309
320
  avg_humidity=d.get("avgHumidity"),
310
- birth_by_shrinking=d.get("birthByShrinking"),
321
+ birth_by_shrinking=birth,
311
322
  birth_time=d.get("birthTime"),
323
+ code=d.get("code"),
324
+ component_approximate_size=d.get("componentApproximateSize"),
325
+ fcuk=d.get("fcuk"),
326
+ fly_ash_ratio=d.get("flyAshRatio"),
312
327
  name=d.get("name"),
313
328
  no=d.get("no"),
314
- shrink_birth=d.get("shrinkBirth"),
315
329
  related_material=list(d.get("relatedMaterial") or []),
330
+ shrink_birth=birth,
316
331
  type_coeff = d.get("typeCoeff"),
317
332
  )
318
333
 
@@ -373,20 +388,33 @@ class CreepShrinkManager(BasicManager):
373
388
  self,
374
389
  no: int = 1,
375
390
  name: str = "收缩徐变1",
391
+ code: str = "JTG3362_2018",
392
+ fcuk: float = 5.0e7,
376
393
  avg_humidity: float = 70.0,
377
- birth_time: int = 7,
394
+ component_approximate_size: float = 1.0,
378
395
  type_coeff: float = 5.0,
379
- shrink_birth: int = 3,
396
+ birth_by_shrinking: int = 3,
397
+ fly_ash_ratio: float = 0.0,
398
+ shrink_birth: int | None = None,
380
399
  ) -> CreepShrink:
381
400
  '''创建或修改收缩徐变特性
382
401
 
402
+ 形参顺序与命令流字段顺序一致:
403
+ CrpShrk, Index, Name, Code, Fcuk, AVG.Humidity,
404
+ ComponentApproximateSize, Type.Coeff, BirthByShrinking, FlyAshRatio
405
+
383
406
  Args:
384
407
  no (int): 收缩徐变特性编号
385
408
  name (str): 特性名称
386
- avg_humidity (float): 年平均湿度(百分比)
387
- birth_time (int): 混凝土龄期(天)
409
+ code (str): 规范,目前只支持 JTG3362_2018
410
+ fcuk (float): 28天龄期的混凝土强度,按工程当前压力单位填写,
411
+ 默认单位 Pa 下 5.0e7 即 50MPa,合法区间 1MPa~200MPa
412
+ avg_humidity (float): 周围环境的相对湿度(百分比),40~99
413
+ component_approximate_size (float): 构件大致尺寸(m),大于 0
388
414
  type_coeff (float): 水泥种类系数
389
- shrink_birth (int): 收缩开始时的混凝土龄期(天数)
415
+ birth_by_shrinking (int): 收缩开始时的混凝土龄期(天数)
416
+ fly_ash_ratio (float): 粉煤灰添加量(百分比),0~50
417
+ shrink_birth (int|None): birth_by_shrinking 的旧写法,传了就覆盖上面的值
390
418
 
391
419
  Returns:
392
420
  创建的 CreepShrink 对象
@@ -394,8 +422,18 @@ class CreepShrinkManager(BasicManager):
394
422
  Raises:
395
423
  RuntimeError: 创建失败时抛出
396
424
  '''
425
+ if shrink_birth is not None:
426
+ birth_by_shrinking = shrink_birth
397
427
  ok, err = osis_creep_shrink(
398
- no, name, avg_humidity, birth_time, type_coeff, shrink_birth,
428
+ nNO=no,
429
+ strName=name,
430
+ strCode=code,
431
+ dFcuk=fcuk,
432
+ dAvgHumidity=avg_humidity,
433
+ dComponentApproximateSize=component_approximate_size,
434
+ dTypeCoeff=type_coeff,
435
+ nBirthByShrinking=birth_by_shrinking,
436
+ dFlyAshRatio=fly_ash_ratio,
399
437
  )
400
438
  if not ok:
401
439
  raise RuntimeError(f"创建收缩徐变特性 {no} 失败: {err}")
@@ -0,0 +1,12 @@
1
+ from .loadcase import *
2
+ from .check import *
3
+ from .env import *
4
+ from .manager import ResultManager, result_manager
5
+ from .headless import (
6
+ get_node_displacement,
7
+ get_element_force,
8
+ get_support_reaction,
9
+ node_displacement_df,
10
+ element_force_df,
11
+ support_reaction_df,
12
+ )