osis-python 0.4.0__tar.gz → 0.4.4__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 (103) hide show
  1. {osis_python-0.4.0/src/osis_python.egg-info → osis_python-0.4.4}/PKG-INFO +1 -1
  2. {osis_python-0.4.0 → osis_python-0.4.4/src/osis_python.egg-info}/PKG-INFO +1 -1
  3. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/__init__.py +1 -1
  4. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/boundary/interface.py +6 -5
  5. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/boundary/manager.py +2 -1
  6. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/core/__init__.py +1 -0
  7. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/core/client.py +18 -1
  8. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/core/engine.py +18 -2
  9. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/dynamic/load_to_mass.py +4 -4
  10. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/dynamic/manager.py +27 -22
  11. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/dynamic/seismic.py +12 -8
  12. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/element/interface.py +17 -17
  13. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/element/manager.py +35 -6
  14. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/live/grade.py +19 -2
  15. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/live/manager.py +48 -1
  16. osis_python-0.4.4/src/pyosis/load/loadcase.py +89 -0
  17. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/load/manager.py +55 -33
  18. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/load/static.py +36 -24
  19. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/material/interface.py +3 -3
  20. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/node/interface.py +3 -3
  21. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/post/design_check.py +2 -5
  22. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/post/manager.py +2 -2
  23. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/property/coordinate.py +19 -19
  24. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/property/creep_shrink.py +2 -2
  25. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/property/damping.py +4 -4
  26. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/property/pu_curve.py +6 -6
  27. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/common.py +5 -5
  28. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/composite.py +78 -6
  29. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/manager.py +34 -6
  30. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/rebar.py +35 -0
  31. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/rib.py +10 -9
  32. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/settlement/interface.py +8 -8
  33. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/settlement/manager.py +12 -12
  34. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/stability/buckling.py +4 -4
  35. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/stability/manager.py +6 -6
  36. osis_python-0.4.0/src/pyosis/load/loadcase.py +0 -62
  37. {osis_python-0.4.0 → osis_python-0.4.4}/LICENSE +0 -0
  38. {osis_python-0.4.0 → osis_python-0.4.4}/README.md +0 -0
  39. {osis_python-0.4.0 → osis_python-0.4.4}/pyproject.toml +0 -0
  40. {osis_python-0.4.0 → osis_python-0.4.4}/setup.cfg +0 -0
  41. {osis_python-0.4.0 → osis_python-0.4.4}/src/osis_python.egg-info/SOURCES.txt +0 -0
  42. {osis_python-0.4.0 → osis_python-0.4.4}/src/osis_python.egg-info/dependency_links.txt +0 -0
  43. {osis_python-0.4.0 → osis_python-0.4.4}/src/osis_python.egg-info/requires.txt +0 -0
  44. {osis_python-0.4.0 → osis_python-0.4.4}/src/osis_python.egg-info/top_level.txt +0 -0
  45. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/boundary/__init__.py +0 -0
  46. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/control/__init__.py +0 -0
  47. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/control/control.py +0 -0
  48. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/control/io.py +0 -0
  49. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/control/manager.py +0 -0
  50. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/control/nonlinear.py +0 -0
  51. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/core/all_func.py +0 -0
  52. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/core/command.py +0 -0
  53. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/dynamic/__init__.py +0 -0
  54. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/dynamic/modal.py +0 -0
  55. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/element/__init__.py +0 -0
  56. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/general/__init__.py +0 -0
  57. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/general/interface.py +0 -0
  58. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/geometry/__init__.py +0 -0
  59. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/geometry/interface.py +0 -0
  60. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/geometry/manager.py +0 -0
  61. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/live/__init__.py +0 -0
  62. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/live/analysis.py +0 -0
  63. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/live/lane.py +0 -0
  64. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/load/__init__.py +0 -0
  65. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/load/tendon.py +0 -0
  66. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/material/__init__.py +0 -0
  67. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/material/manager.py +0 -0
  68. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/node/__init__.py +0 -0
  69. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/node/manager.py +0 -0
  70. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/post/__init__.py +0 -0
  71. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/post/combine.py +0 -0
  72. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/post/display.py +0 -0
  73. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/project/__init__.py +0 -0
  74. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/project/interface.py +0 -0
  75. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/project/manager.py +0 -0
  76. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/property/__init__.py +0 -0
  77. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/property/component_thickness.py +0 -0
  78. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/property/manager.py +0 -0
  79. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/quick_building/__init__.py +0 -0
  80. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/quick_building/interface.py +0 -0
  81. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/result/__init__.py +0 -0
  82. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/result/check.py +0 -0
  83. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/result/env.py +0 -0
  84. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/result/loadcase.py +0 -0
  85. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/result/manager.py +0 -0
  86. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/result/result.py +0 -0
  87. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/__init__.py +0 -0
  88. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/numeric.py +0 -0
  89. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/param.py +0 -0
  90. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/section/steel.py +0 -0
  91. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/settlement/__init__.py +0 -0
  92. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/stability/__init__.py +0 -0
  93. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/stage/__init__.py +0 -0
  94. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/stage/define.py +0 -0
  95. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/stage/manager.py +0 -0
  96. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/stage/overall.py +0 -0
  97. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/thickness/__init__.py +0 -0
  98. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/thickness/interface.py +0 -0
  99. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/thickness/manager.py +0 -0
  100. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/transfer/__init__.py +0 -0
  101. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/transfer/command_map.py +0 -0
  102. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/transfer/generator.py +0 -0
  103. {osis_python-0.4.0 → osis_python-0.4.4}/src/pyosis/transfer/parser.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osis-python
3
- Version: 0.4.0
3
+ Version: 0.4.4
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osis-python
3
- Version: 0.4.0
3
+ Version: 0.4.4
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
@@ -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.4.0"
10
+ __version__ = "0.4.4"
11
11
  __author__ = "CCCC Highway Consultant Co. Ltd." # 中交公路规划设计院 - 工程技术研究中心 - lzh - wjh - myf
12
12
 
13
13
  from .core.engine import OSISEngine
@@ -46,7 +46,7 @@ def osis_boundary_general(nBd: int, eBoundaryType: Literal["GENERAL"]="GENERAL",
46
46
  pass
47
47
 
48
48
  @REGISTRY.register("Boundary")
49
- def osis_boundary_master_slave(nBd: int, eBoundaryType: Literal["MSTSLV"]="MSTSLV", nNode: int = 1, bX: bool = 1, bY: bool = 1, bZ: bool = 1, bRX: bool = 1, bRY: bool = 1, bRZ: bool = 1):
49
+ def osis_boundary_master_slave(nBd: int, eBoundaryType: Literal["MSTSLV"]="MSTSLV", nNode: int = 1, bX: bool = 1, bY: bool = 1, bZ: bool = 1, bRX: bool = 1, bRY: bool = 1, bRZ: bool = 1, bCoincident: Literal[0, 1] | None = 1):
50
50
  '''
51
51
  ## 定义或修改主从约束
52
52
  pyosis.boundary.osis_boundary_master_slave
@@ -61,6 +61,7 @@ def osis_boundary_master_slave(nBd: int, eBoundaryType: Literal["MSTSLV"]="MSTSL
61
61
  bRX (bool): 0 = 释放,1 = 约束
62
62
  bRY (bool): 0 = 释放,1 = 约束
63
63
  bRZ (bool): 0 = 释放,1 = 约束
64
+ bCoincident: 0 = 仅同位移约束,默认1,可缺省
64
65
  Returns:
65
66
  tuple (bool, str): 是否成功,失败原因
66
67
  '''
@@ -69,7 +70,7 @@ def osis_boundary_master_slave(nBd: int, eBoundaryType: Literal["MSTSLV"]="MSTSL
69
70
  @REGISTRY.register("Boundary")
70
71
  def osis_boundary_rigid(nBd: int, eBoundaryType: Literal["RIGID"], nNodeI: int):
71
72
  '''
72
- ## 定义或修改主从约束
73
+ ## 定义或修改刚性连接
73
74
 
74
75
  Args:
75
76
  nBd (int): 编号
@@ -95,10 +96,10 @@ def osis_boundary_release(nBd: int, eBoundaryType: Literal["RELEASE"],
95
96
 
96
97
  Args:
97
98
  nBd (int): 编号
98
- eBoundaryType (str): 固定为 MSTSLV
99
+ eBoundaryType (str): 固定为 RELEASE
99
100
  \\*_state (bool):
100
- * 0 = 释放
101
- * 1 = 约束
101
+ * 0 = 完全释放
102
+ * 1 = 完全约束
102
103
  F\\*i and M\\*i (float): 部分约束的大小,0-1之间,表示释放后残余的约束能力的百分比
103
104
  Returns:
104
105
  tuple (bool, str): 是否成功,失败原因
@@ -659,11 +659,12 @@ class BoundaryManager:
659
659
  bRY: Literal[0, 1] = 1,
660
660
  bRZ: Literal[0, 1] = 1,
661
661
  no: int | None = None,
662
+ bCoincident: int | None = 1,
662
663
  ) -> MstSlvBoundary:
663
664
  """创建主从约束"""
664
665
  if no is None:
665
666
  no = self._next_no()
666
- ok, err = osis_boundary_master_slave(no, "MSTSLV", nNode, bX, bY, bZ, bRX, bRY, bRZ)
667
+ ok, err = osis_boundary_master_slave(no, "MSTSLV", nNode, bX, bY, bZ, bRX, bRY, bRZ,bCoincident)
667
668
  if not ok:
668
669
  raise RuntimeError(f"创建主从约束 {no} 失败: {err}")
669
670
  return self.get(no) # type: ignore[return-value]
@@ -9,3 +9,4 @@ OSISEngine中的函数,将会分发到各个模块,被再次封装,意图
9
9
  """
10
10
 
11
11
  from .command import REGISTRY, osis_run, set_run_mode
12
+ from .client import set_osis_port, set_osis_url
@@ -24,6 +24,23 @@ session = requests.Session()
24
24
  session.mount("http://", adapter)
25
25
  session.mount("https://", adapter) # 如果你后续用HTTPS
26
26
 
27
+ DEFAULT_PORT = 18080
28
+ DEFAULT_URL = "http://localhost"
29
+
30
+ def set_osis_url(url):
31
+ '''
32
+ 设置OSIS默认网址
33
+ '''
34
+ global DEFAULT_URL
35
+ DEFAULT_URL = url
36
+
37
+ def set_osis_port(port):
38
+ '''
39
+ 设置要连接的OSIS端口
40
+ '''
41
+ global DEFAULT_PORT
42
+ DEFAULT_PORT = port
43
+
27
44
  # ========== 通用客户端函数(复用连接池) ==========
28
45
  def osis_client(func_name: str, payload: dict, base_url=None) -> dict:
29
46
  """
@@ -34,7 +51,7 @@ def osis_client(func_name: str, payload: dict, base_url=None) -> dict:
34
51
  Returns:
35
52
  异常时返回 (False, 错误信息)
36
53
  """
37
- base_url = base_url or os.environ.get("OSIS_URL", "http://localhost:18080")
54
+ base_url = base_url or os.environ.get("OSIS_URL", f"{DEFAULT_URL}:{DEFAULT_PORT}")
38
55
  url = f"{base_url}/{func_name}"
39
56
 
40
57
  try:
@@ -19,6 +19,7 @@
19
19
 
20
20
  from __future__ import annotations
21
21
 
22
+ import os
22
23
  from typing import Any
23
24
 
24
25
  from ..material.manager import MaterialManager, material_manager
@@ -48,6 +49,7 @@ from ..general.interface import (
48
49
  osis_solve,
49
50
  )
50
51
  from .command import osis_run
52
+ from .client import set_osis_port, set_osis_url
51
53
 
52
54
 
53
55
  class OSISEngine:
@@ -81,7 +83,12 @@ class OSISEngine:
81
83
  - matrix(), output_result_for_calc_book()
82
84
  """
83
85
 
84
- def __init__(self) -> None:
86
+ def __init__(self, port=None, url="http://localhost") -> None:
87
+ '''
88
+ Args:
89
+ port (int): OSIS 端口号,为 `None` 自动尝试加载 `OSIS_HTTP_PORT` 环境变量,加载失败将设为默认值 18080
90
+ url (str): OSIS 网址
91
+ '''
85
92
  # 引用全局单例管理器
86
93
  self._material = material_manager
87
94
  self._section = section_manager
@@ -103,6 +110,15 @@ class OSISEngine:
103
110
  self._post = post_manager
104
111
  self._result = result_manager
105
112
 
113
+ # OSIS端口与网址
114
+ if port is None:
115
+ self._port = os.environ.get("OSIS_HTTP_PORT", 18080) # 如果设置了环境变量
116
+ else:
117
+ self._port = port
118
+ self._url = url
119
+ set_osis_url(self._url)
120
+ set_osis_port(self._port)
121
+
106
122
  # ──────────────────────────────────────────
107
123
  # 子管理器属性
108
124
  # ──────────────────────────────────────────
@@ -306,7 +322,7 @@ class OSISEngine:
306
322
  path (str): 完整文件名
307
323
 
308
324
  Notes:
309
- path 中如果不输入绝对路径的话,默认使用程序执行文件所在的路径,比如“D:\Rbin\X.sml”。
325
+ path 中如果不输入绝对路径的话,默认使用程序执行文件所在的路径,比如“D:\\Rbin\\X.sml”。
310
326
  """
311
327
  self.control.import_apdl(path)
312
328
 
@@ -42,12 +42,12 @@ def osis_ltm_anal_del(strName: str):
42
42
 
43
43
 
44
44
  @REGISTRY.register("LTMAnalMod")
45
- def osis_ltm_anal_mod(nOld: int, nNew: int):
46
- """修改荷载转换质量编号。
45
+ def osis_ltm_anal_mod(old_name: str, new_name: str):
46
+ """修改荷载转换质量名称。
47
47
 
48
48
  Args:
49
- nOld (int): 旧编号
50
- nNew (int): 新编号
49
+ old_name (str): 旧名称
50
+ new_name (str): 新名称
51
51
 
52
52
  Returns:
53
53
  tuple (bool, str): 返回一个元组,包含:
@@ -138,16 +138,16 @@ class LoadToMassManager:
138
138
  if not ok:
139
139
  raise RuntimeError(f"删除荷载转换质量 {name} 失败: {err}")
140
140
 
141
- def renumber_ltm(self, old_no: int, new_no: int) -> None:
142
- """修改荷载转换质量编号。
141
+ def rename_ltm(self, old_name: str, new_name: str) -> None:
142
+ """修改荷载转换质量名称。
143
143
 
144
144
  Args:
145
- old_no: 旧编号
146
- new_no: 新编号
145
+ old_name: 旧名称
146
+ new_name: 新名称
147
147
  """
148
- ok, err = osis_ltm_anal_mod(old_no, new_no)
148
+ ok, err = osis_ltm_anal_mod(old_name, new_name)
149
149
  if not ok:
150
- raise RuntimeError(f"修改荷载转换质量编号 {old_no} -> {new_no} 失败: {err}")
150
+ raise RuntimeError(f"修改荷载转换质量名称 {old_name} -> {new_name} 失败: {err}")
151
151
 
152
152
  def add_ltm(
153
153
  self,
@@ -298,7 +298,7 @@ class SeisRspSpecManager:
298
298
  names = [str(name)]
299
299
  if not isinstance(names, list):
300
300
  raise TypeError(f"不支持的名称类型: {type(name)}")
301
- resp = osis_client("GetSeisRspSpecInfoByNames", {"name": names})
301
+ resp = osis_client("GetSeisRspSpecByNames", {"name": names})
302
302
  if not resp['success']:
303
303
  raise RuntimeError(f"{resp['error']}")
304
304
  rsp = [SeisRspSpec._from_dict(d) if d else None for d in resp.get("data", [])]
@@ -327,8 +327,13 @@ class SeisRspSpecManager:
327
327
  g: 输入g值
328
328
  spectrum_data: 反应谱数据列表,每个元素为 (周期, 谱值) 元组
329
329
  """
330
- n_num = len(spectrum_data)
331
- ok, err = osis_seis_rsp_spec_import(name, spec_type, g, n_num, spectrum_data)
330
+ if spectrum_data and isinstance(spectrum_data[0], tuple):
331
+ n_num = len(spectrum_data)
332
+ flat = [v for pair in spectrum_data for v in pair]
333
+ else:
334
+ flat = list(spectrum_data)
335
+ n_num = len(flat) // 2
336
+ ok, err = osis_seis_rsp_spec_import(name, spec_type, g, 0, n_num, flat)
332
337
  if not ok:
333
338
  raise RuntimeError(f"创建地震反应谱 {name} 失败: {err}")
334
339
 
@@ -368,7 +373,7 @@ class SeisRspSpecManager:
368
373
  delta_t: 周期间隔
369
374
  """
370
375
  ok, err = osis_seis_rsp_spec_code(
371
- name, spec_type, g,
376
+ name, spec_type, g,1,
372
377
  code, bridge_type, is_long_span, level, intensity,
373
378
  site, direction, period, ksi, t, delta_t
374
379
  )
@@ -385,16 +390,16 @@ class SeisRspSpecManager:
385
390
  if not ok:
386
391
  raise RuntimeError(f"删除地震反应谱 {name} 失败: {err}")
387
392
 
388
- def renumber_rsp_spec(self, old_no: int, new_no: int) -> None:
389
- """修改地震反应谱编号。
393
+ def rename_rsp_spec(self, old_name: str, new_name: str) -> None:
394
+ """修改地震反应谱名称。
390
395
 
391
396
  Args:
392
- old_no: 旧编号
393
- new_no: 新编号
397
+ old_name: 旧名称
398
+ new_name: 新名称
394
399
  """
395
- ok, err = osis_seis_rsp_spec_mod(old_no, new_no)
400
+ ok, err = osis_seis_rsp_spec_mod(old_name, new_name)
396
401
  if not ok:
397
- raise RuntimeError(f"修改地震反应谱编号 {old_no} -> {new_no} 失败: {err}")
402
+ raise RuntimeError(f"修改地震反应谱名称 {old_name} -> {new_name} 失败: {err}")
398
403
 
399
404
  @dataclass(frozen=False)
400
405
  class RspecAnal:
@@ -510,16 +515,16 @@ class RspecAnalManager:
510
515
  if not ok:
511
516
  raise RuntimeError(f"删除反应谱工况 {name} 失败: {err}")
512
517
 
513
- def renumber_rspec_anal(self, old_no: int, new_no: int) -> None:
514
- """修改反应谱工况编号。
518
+ def rename_rspec_anal(self, old_name: str, new_name: str) -> None:
519
+ """修改反应谱工况名称。
515
520
 
516
521
  Args:
517
- old_no: 旧编号
518
- new_no: 新编号
522
+ old_name: 旧名称
523
+ new_name: 新名称
519
524
  """
520
- ok, err = osis_rspec_anal_mod(old_no, new_no)
525
+ ok, err = osis_rspec_anal_mod(old_name, new_name)
521
526
  if not ok:
522
- raise RuntimeError(f"修改反应谱工况编号 {old_no} -> {new_no} 失败: {err}")
527
+ raise RuntimeError(f"修改反应谱工况名称 {old_name} -> {new_name} 失败: {err}")
523
528
 
524
529
  class DynamicManager:
525
530
  """动力分析管理器
@@ -18,6 +18,7 @@ def osis_seis_rsp_spec_import(
18
18
  strName: str,
19
19
  strType: Literal["N", "A", "V", "D"],
20
20
  dG: float,
21
+ inputType: int,
21
22
  nNum: int,
22
23
  spectrum_data: list[tuple[float, float]],
23
24
  ):
@@ -27,6 +28,7 @@ def osis_seis_rsp_spec_import(
27
28
  strName (str): 名称
28
29
  strType (str): 谱类型,N=无量纲加速度谱,A=加速度谱,V=速度谱,D=位移谱
29
30
  dG (float): 输入g值
31
+ inputtype:类型,0 = 导入
30
32
  nNum (int): 点数
31
33
  spectrum_data (list): 反应谱数据列表,每个元素为 (周期, 谱值) 元组
32
34
 
@@ -49,6 +51,7 @@ def osis_seis_rsp_spec_code(
49
51
  strName: str,
50
52
  strType: Literal["N", "A", "V", "D"],
51
53
  dG: float,
54
+ inputType: int = 1,
52
55
  strCode: str = "JTGT_2231_01_2020",
53
56
  strBridgeType: Literal["A", "B", "C", "D"] = "A",
54
57
  nIsLongSpan: Literal[0, 1] = 0,
@@ -67,6 +70,7 @@ def osis_seis_rsp_spec_code(
67
70
  strName (str): 名称
68
71
  strType (str): 谱类型,N=无量纲加速度谱,A=加速度谱,V=速度谱,D=位移谱
69
72
  dG (float): 输入g值
73
+ inputtype:类型,1 = 按规范生成
70
74
  strCode (str): 规范名称,如 "JTGT_2231_01_2020"
71
75
  strBridgeType (str): 桥梁类别,A/B/C/D
72
76
  nIsLongSpan (int): 0=非高速公路和一级公路上的B类大桥特大桥,1=高速公路和一级公路上的B类大桥特大桥
@@ -111,12 +115,12 @@ def osis_seis_rsp_spec_del(strName: str):
111
115
 
112
116
 
113
117
  @REGISTRY.register("SeisRspSpecMod")
114
- def osis_seis_rsp_spec_mod(nOld: int, nNew: int):
115
- """修改地震反应谱编号。
118
+ def osis_seis_rsp_spec_mod(old_name: str, new_name: str):
119
+ """修改地震反应谱名称。
116
120
 
117
121
  Args:
118
- nOld (int): 旧编号
119
- nNew (int): 新编号
122
+ old_name (int): 旧名称
123
+ new_name (int): 新名称
120
124
 
121
125
  Returns:
122
126
  tuple (bool, str): 返回一个元组,包含:
@@ -180,12 +184,12 @@ def osis_rspec_anal_del(strName: str):
180
184
 
181
185
 
182
186
  @REGISTRY.register("RSpecAnalMod")
183
- def osis_rspec_anal_mod(nOld: int, nNew: int):
184
- """修改反应谱工况编号。
187
+ def osis_rspec_anal_mod(old_name: str, new_name: str):
188
+ """修改反应谱工况名称。
185
189
 
186
190
  Args:
187
- nOld (int): 旧编号
188
- nNew (int): 新编号
191
+ old_name (str): 旧名称
192
+ new_name (str): 新名称
189
193
 
190
194
  Returns:
191
195
  tuple (bool, str): 返回一个元组,包含:
@@ -138,9 +138,9 @@ def osis_element_shell(nEle: int=1, eElementType: str="CABLE", bIsThin: bool=1,
138
138
  Args:
139
139
  nEle (int): 单元编号。从 1 开始编号,所有类型的单元均使用同一编号序列。
140
140
  eElementType (str): 不能修改,固定为 SHELL,不区分大小写
141
- bIsThin (bool):
141
+ bIsThin (bool): 0 = 厚壳,1 = 薄壳
142
142
  nMat (int): 材料编号。
143
- nThk (int):
143
+ nThk (int): 厚度编号
144
144
  nNode1 (int): 节点1编号。
145
145
  nNode1 (int): 节点2编号。
146
146
  nNode1 (int): 节点3编号。
@@ -152,11 +152,11 @@ def osis_element_shell(nEle: int=1, eElementType: str="CABLE", bIsThin: bool=1,
152
152
  pass
153
153
 
154
154
  @REGISTRY.register("ElementDel")
155
- def osis_element_del(nEle: int=1):
155
+ def osis_element_del(nEle: int):
156
156
  """删除一个单元
157
157
 
158
158
  Args:
159
- nEle (int): 单元编号,从 1 开始计数
159
+ nEle (int): 单元编号
160
160
 
161
161
  Returns:
162
162
  tuple (bool, str):
@@ -166,7 +166,7 @@ def osis_element_del(nEle: int=1):
166
166
  pass
167
167
 
168
168
  @REGISTRY.register("ElementMod")
169
- def osis_element_mod(nOld: int=1, nNew: int=2):
169
+ def osis_element_mod(nOld: int, nNew: int):
170
170
  """修改一个单元的编号。单元编号存在时,交换
171
171
 
172
172
  Args:
@@ -205,13 +205,13 @@ def osis_element_group(strName: str="单元组1", eOP: Literal["c", "a", "s", "r
205
205
  @REGISTRY.register("TaperEle")
206
206
  def osis_taperele(
207
207
  nIndex: str,
208
- strZType: Literal["0", "1"],
208
+ strZType: Literal[0, 1],
209
209
  dZTrans: float = 1.0,
210
- strZpos: Literal["0", "1"] = "0",
210
+ strZpos: Literal[0, 1] = 0,
211
211
  dZdis: float = 0.0,
212
- strYtype: Literal["0", "1"]="0",
212
+ strYtype: Literal[0, 1]=0,
213
213
  dYtrans: float = 1.0,
214
- strYpos: Literal["0", "1"] = "0",
214
+ strYpos: Literal[0, 1] = 0,
215
215
  dYdis: float = 0.0,
216
216
  *eles: str,
217
217
 
@@ -221,25 +221,25 @@ def osis_taperele(
221
221
 
222
222
  Args:
223
223
  nIndex (str): 变截面单元组名称
224
- strZType (str): 截面Z向过渡类型,
224
+ strZType (int): 截面Z向过渡类型,
225
225
  * 0=线性
226
226
  * 1=多项式
227
227
  dZTrans (float): ZType=0时默认1.0
228
- strZpos (str):
228
+ strZpos (int):
229
229
  * 0=i
230
230
  * 1=j
231
231
  * ZType=0时默认i
232
232
  dZdis (float): 对称面距,ZType=0时默认0.0
233
- strYtype (str): 截面Y向过渡类型
233
+ strYtype (int): 截面Y向过渡类型
234
234
  * 0=线性
235
235
  * 1=多项式
236
236
  dYtrans (float): YType=0时默认1.0
237
- strYpos (str):
237
+ strYpos (int):
238
238
  * 0=i
239
239
  * 1=j
240
240
  * YType=0时默认i
241
241
  dYdis (float): 对称面距,YType=0时默认0.0
242
- *eles (str): 单元组编号,示例:1,3,5to10
242
+ *eles (int | str | list): 单元组编号,示例:1,3,5to10
243
243
 
244
244
  Returns:
245
245
  tuple (bool, str): 返回一个元组,包含:
@@ -264,13 +264,13 @@ def osis_element_tapereledel(strIndex: str) -> tuple[bool, str]:
264
264
  pass
265
265
 
266
266
  @REGISTRY.register("TaperEleMod")
267
- def osis_element_taperelemod(strOldIndex: str, strNewIndex: str) -> tuple[bool, str]:
267
+ def osis_element_taperelemod(old_name: str, new_name: str) -> tuple[bool, str]:
268
268
  """
269
269
  修改变截面组名称
270
270
 
271
271
  Args:
272
- strOldIndex (str):
273
- strNewIndex (str):
272
+ old_name (str):
273
+ new_name (str):
274
274
 
275
275
  Returns:
276
276
  tuple (bool, str): 返回一个元组,包含:
@@ -386,18 +386,47 @@ class TaperEleGroupManager:
386
386
  def create(
387
387
  self,
388
388
  name: str,
389
- z_type: Literal["0", "1"],
389
+ z_type: Literal[0, 1],
390
390
  z_trans: float = 1.0,
391
- z_pos: Literal["0", "1"] = "0",
391
+ z_pos: Literal[0, 1] = 0,
392
392
  z_dis: float = 0.0,
393
- y_type: Literal["0", "1"] = "0",
393
+ y_type: Literal[0, 1] = 0,
394
394
  y_trans: float = 1.0,
395
- y_pos: Literal["0", "1"] = "0",
395
+ y_pos: Literal[0, 1] = 0,
396
396
  y_dis: float = 0.0,
397
397
  *eles: str,
398
398
 
399
399
  ) -> TaperEleGroup:
400
- """创建变截面单元组"""
400
+ """
401
+ 生成或修改变截面单元组
402
+
403
+ Args:
404
+ name (str): 变截面单元组名称
405
+ z_type (int): 截面Z向过渡类型,
406
+ * 0=线性
407
+ * 1=多项式
408
+ z_trans (float): ZType=0时默认1.0
409
+ z_pos (int):
410
+ * 0=i
411
+ * 1=j
412
+ * ZType=0时默认i
413
+ z_dis (float): 对称面距,ZType=0时默认0.0
414
+ y_type (int): 截面Y向过渡类型
415
+ * 0=线性
416
+ * 1=多项式
417
+ y_trans (float): YType=0时默认1.0
418
+ y_pos (int):
419
+ * 0=i
420
+ * 1=j
421
+ * YType=0时默认i
422
+ y_dis (float): 对称面距,YType=0时默认0.0
423
+ *eles (str): 单元组编号,示例:1,3,5to10
424
+
425
+ Returns:
426
+ tuple (bool, str): 返回一个元组,包含:
427
+ - bool: 操作是否成功
428
+ - str: 失败原因
429
+ """
401
430
  ok, err = osis_taperele(
402
431
  name,
403
432
  z_type,
@@ -615,7 +644,7 @@ class ElementManager:
615
644
  ok, err = osis_element_shell(no, "SHELL", bIsThin, nMat, nThk, node1, node2, node3, node4)
616
645
  if not ok:
617
646
  raise RuntimeError(f"创建壳单元 {no} 失败: {err}")
618
- return self.get(no) # type: ignore[return-value]
647
+ return self.get(no)
619
648
 
620
649
  def delete(self, no: int) -> None:
621
650
  """删除单元"""
@@ -73,8 +73,25 @@ def osis_livegrade_fatigue(strName: str="活载-FATIGUE", eCode: str="JTGD60_201
73
73
  '''
74
74
  pass
75
75
 
76
+ @REGISTRY.register("LiveGrade")
77
+ def osis_livegrade_custom(strName: str, eCode: Literal["CUSTOM"] = "CUSTOM", eLiveLoadType: Literal["VG"] = "VG", nGrpNum: int = 1,
78
+ veh_grp_layout=[]):
79
+ """定义或修改活载等级。
80
+
81
+ Args:
82
+ strName: 活载名称
83
+ eCode: 规范类型,固定为 CUSTOM
84
+ eLiveLoadType: 活载类型,轴载组为 VG
85
+ nGrpNum: 轴载组数
86
+ veh_grp_layout: 距左侧轴的轴距, 轴载
87
+
88
+ Returns:
89
+ tuple (bool, str): 是否成功,失败原因
90
+ """
91
+ pass
92
+
76
93
  @REGISTRY.register("LiveGradeDel")
77
- def osis_livegrade_del(strName: str="活载1"):
94
+ def osis_livegrade_del(strName: str):
78
95
  '''
79
96
  删除活载等级
80
97
 
@@ -89,7 +106,7 @@ def osis_livegrade_del(strName: str="活载1"):
89
106
  @REGISTRY.register("LiveGradeMod")
90
107
  def osis_livegrade_mod(strOldName: str, strNewName: str):
91
108
  '''
92
- 修改编号
109
+ 修改名称
93
110
 
94
111
  Args:
95
112
  strOldName (str): 旧名称
@@ -23,7 +23,7 @@ from .grade import (
23
23
  osis_livegrade_crowd,
24
24
  osis_livegrade_fatigue,
25
25
  osis_livegrade_del,
26
- osis_livegrade_mod,
26
+ osis_livegrade_mod, osis_livegrade_custom,
27
27
  )
28
28
  from .analysis import (
29
29
  osis_live_analysis,
@@ -267,6 +267,13 @@ class LiveCase:
267
267
  - SUSPENSION: 悬索桥
268
268
  - CUSTOM: 自定义,直接输入基频
269
269
  mu_params: 冲击系数计算参数列表(根据桥型不同参数不同)
270
+ * SIMPLE = 桥长、弹模、惯性矩、质量
271
+ * CONTINUOUS = 基频计算常数a、基频计算常数b、桥长、弹模、惯性矩、质量
272
+ * ARCH = 拱厚变化系数、拱桥矢跨比、桥长、弹模、惯性矩,质量
273
+ * CABLE_STAYED = 计算常数、主跨跨径
274
+ * CABLE_STAYED_AUX = 计算常数、主跨跨径
275
+ * SUSPENSION = 主跨跨径、弹模、惯性矩、主缆水平拉力、质量
276
+ * CUSTOM = 用户直接输入基频
270
277
  lane_names: 车道名称列表
271
278
 
272
279
  Returns:
@@ -316,6 +323,13 @@ class LiveCase:
316
323
  - SUSPENSION: 悬索桥
317
324
  - CUSTOM: 自定义,直接输入基频
318
325
  mu_params: 冲击系数计算参数列表(根据桥型不同参数不同)
326
+ * SIMPLE = 桥长、弹模、惯性矩、质量
327
+ * CONTINUOUS = 基频计算常数a、基频计算常数b、桥长、弹模、惯性矩、质量
328
+ * ARCH = 拱厚变化系数、拱桥矢跨比、桥长、弹模、惯性矩,质量
329
+ * CABLE_STAYED = 计算常数、主跨跨径
330
+ * CABLE_STAYED_AUX = 计算常数、主跨跨径
331
+ * SUSPENSION = 主跨跨径、弹模、惯性矩、主缆水平拉力、质量
332
+ * CUSTOM = 用户直接输入基频
319
333
  lane_names: 车道名称列表
320
334
 
321
335
  Returns:
@@ -535,6 +549,39 @@ class LiveGradeManager:
535
549
  raise RuntimeError(f"创建疲劳荷载等级 {name} 失败: {err}")
536
550
  return self.get(name)
537
551
 
552
+ def create_custom(self,
553
+ name: str,
554
+ nGrpNum: int = 1,
555
+ veh_grp_layout: list[tuple[float, float]] = (),
556
+ ) -> LiveGrade:
557
+ """创建自定义活载等级
558
+ Args:
559
+ name: 活载等级名称
560
+ eCode: 规范类型,固定为 CUSTOM
561
+ eLiveLoadType: 活载类型,轴载组为 VG
562
+ nGrpNum: 轴载组数
563
+ veh_grp_layout: 距左侧轴的轴距, 轴载
564
+
565
+ Returns:
566
+ 创建的 LiveGrade 对象
567
+
568
+ Raises:
569
+ RuntimeError: 创建失败时抛出异常
570
+ """
571
+ layout_flat: list[float] = []
572
+ for pair in veh_grp_layout:
573
+ if len(pair) != 2:
574
+ raise ValueError(
575
+ f"veh_grp_layout 每项须为 (轴距, 轴载),当前: {pair!r}"
576
+ )
577
+ layout_flat.extend((float(pair[0]), float(pair[1])))
578
+ ok, err = osis_livegrade_custom(
579
+ name, "CUSTOM","VG",nGrpNum, layout_flat
580
+ )
581
+ if not ok:
582
+ raise RuntimeError(f"创建自定义活载等级 {name} 失败: {err}")
583
+ return self.get(name)
584
+
538
585
  def delete(self, name: str) -> None:
539
586
  """删除活载等级
540
587