osis-python 0.3.6__tar.gz → 0.3.9__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 (101) hide show
  1. {osis_python-0.3.6/src/osis_python.egg-info → osis_python-0.3.9}/PKG-INFO +1 -1
  2. {osis_python-0.3.6 → osis_python-0.3.9/src/osis_python.egg-info}/PKG-INFO +1 -1
  3. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/__init__.py +1 -1
  4. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/boundary/manager.py +7 -4
  5. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/core/engine.py +2 -2
  6. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/dynamic/manager.py +18 -15
  7. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/element/manager.py +15 -17
  8. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/geometry/interface.py +1 -1
  9. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/geometry/manager.py +5 -4
  10. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/live/manager.py +21 -12
  11. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/load/manager.py +27 -18
  12. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/material/manager.py +8 -7
  13. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/property/manager.py +5 -5
  14. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/section/manager.py +173 -90
  15. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/settlement/manager.py +13 -8
  16. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/stability/manager.py +6 -5
  17. {osis_python-0.3.6 → osis_python-0.3.9}/LICENSE +0 -0
  18. {osis_python-0.3.6 → osis_python-0.3.9}/README.md +0 -0
  19. {osis_python-0.3.6 → osis_python-0.3.9}/pyproject.toml +0 -0
  20. {osis_python-0.3.6 → osis_python-0.3.9}/setup.cfg +0 -0
  21. {osis_python-0.3.6 → osis_python-0.3.9}/src/osis_python.egg-info/SOURCES.txt +0 -0
  22. {osis_python-0.3.6 → osis_python-0.3.9}/src/osis_python.egg-info/dependency_links.txt +0 -0
  23. {osis_python-0.3.6 → osis_python-0.3.9}/src/osis_python.egg-info/requires.txt +0 -0
  24. {osis_python-0.3.6 → osis_python-0.3.9}/src/osis_python.egg-info/top_level.txt +0 -0
  25. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/boundary/__init__.py +0 -0
  26. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/boundary/interface.py +0 -0
  27. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/control/__init__.py +0 -0
  28. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/control/control.py +0 -0
  29. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/control/io.py +0 -0
  30. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/control/manager.py +0 -0
  31. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/control/nonlinear.py +0 -0
  32. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/core/__init__.py +0 -0
  33. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/core/all_func.py +0 -0
  34. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/core/client.py +0 -0
  35. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/core/command.py +0 -0
  36. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/dynamic/__init__.py +0 -0
  37. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/dynamic/load_to_mass.py +0 -0
  38. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/dynamic/modal.py +0 -0
  39. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/dynamic/seismic.py +0 -0
  40. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/element/__init__.py +0 -0
  41. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/element/interface.py +0 -0
  42. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/general/__init__.py +0 -0
  43. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/general/interface.py +0 -0
  44. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/geometry/__init__.py +0 -0
  45. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/live/__init__.py +0 -0
  46. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/live/analysis.py +0 -0
  47. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/live/grade.py +0 -0
  48. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/live/lane.py +0 -0
  49. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/load/__init__.py +0 -0
  50. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/load/loadcase.py +0 -0
  51. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/load/static.py +0 -0
  52. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/load/tendon.py +0 -0
  53. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/material/__init__.py +0 -0
  54. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/material/interface.py +0 -0
  55. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/node/__init__.py +0 -0
  56. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/node/interface.py +0 -0
  57. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/node/manager.py +0 -0
  58. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/post/__init__.py +0 -0
  59. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/post/combine.py +0 -0
  60. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/post/design_check.py +0 -0
  61. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/post/display.py +0 -0
  62. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/post/manager.py +0 -0
  63. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/project/__init__.py +0 -0
  64. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/project/interface.py +0 -0
  65. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/project/manager.py +0 -0
  66. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/property/__init__.py +0 -0
  67. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/property/component_thickness.py +0 -0
  68. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/property/coordinate.py +0 -0
  69. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/property/creep_shrink.py +0 -0
  70. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/property/damping.py +0 -0
  71. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/property/pu_curve.py +0 -0
  72. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/quick_building/__init__.py +0 -0
  73. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/quick_building/interface.py +0 -0
  74. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/result/__init__.py +0 -0
  75. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/result/check.py +0 -0
  76. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/result/env.py +0 -0
  77. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/result/loadcase.py +0 -0
  78. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/result/manager.py +0 -0
  79. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/result/result.py +0 -0
  80. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/section/__init__.py +0 -0
  81. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/section/common.py +0 -0
  82. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/section/numeric.py +0 -0
  83. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/section/param.py +0 -0
  84. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/section/rebar.py +0 -0
  85. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/section/rib.py +0 -0
  86. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/section/steel.py +0 -0
  87. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/settlement/__init__.py +0 -0
  88. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/settlement/interface.py +0 -0
  89. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/stability/__init__.py +0 -0
  90. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/stability/buckling.py +0 -0
  91. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/stage/__init__.py +0 -0
  92. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/stage/define.py +0 -0
  93. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/stage/manager.py +0 -0
  94. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/stage/overall.py +0 -0
  95. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/thickness/__init__.py +0 -0
  96. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/thickness/interface.py +0 -0
  97. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/thickness/manager.py +0 -0
  98. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/transfer/__init__.py +0 -0
  99. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/transfer/command_map.py +0 -0
  100. {osis_python-0.3.6 → osis_python-0.3.9}/src/pyosis/transfer/generator.py +0 -0
  101. {osis_python-0.3.6 → osis_python-0.3.9}/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.3.6
3
+ Version: 0.3.9
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.3.6
3
+ Version: 0.3.9
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.3.6"
10
+ __version__ = "0.3.9"
11
11
  __author__ = "CCCC Highway Consultant Co. Ltd." # 中交公路规划设计院 - 工程技术研究中心 - lzh - wjh - myf
12
12
 
13
13
  from .core.engine import OSISEngine
@@ -549,12 +549,15 @@ class BoundaryGroupManager:
549
549
  单个 BoundaryGroup 对象;如果传入列表则返回对象列表;
550
550
  不存在返回 None
551
551
  """
552
- if isinstance(name, str):
553
- name = [name]
554
- elif not isinstance(name, list):
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):
555
558
  raise TypeError(f"不支持的名称类型: {type(name)}")
556
559
 
557
- resp = osis_client("GetBoundaryGroupInfoByNames", {"name": name})
560
+ resp = osis_client("GetBoundaryGroupInfoByNames", {"name": names})
558
561
  if not resp['success']:
559
562
  raise RuntimeError(f"{resp['error']}")
560
563
 
@@ -291,7 +291,7 @@ class OSISEngine:
291
291
  # ──────────────────────────────────────────
292
292
  # 便捷方法(委托给 control manager)
293
293
  # ──────────────────────────────────────────
294
- def export_apdl(self, path) -> None:
294
+ def export_apdl(self, path: str | None = None) -> None:
295
295
  """导出前处理状态为 .out 文件
296
296
 
297
297
  Args:
@@ -299,7 +299,7 @@ class OSISEngine:
299
299
  """
300
300
  self.control.export_apdl(path)
301
301
 
302
- def import_apdl(self, path: str | None = None) -> None:
302
+ def import_apdl(self, path: str) -> None:
303
303
  """读取 .out / .sml 文件
304
304
 
305
305
  Args:
@@ -59,13 +59,14 @@ class LoadToMassManager:
59
59
 
60
60
  def get(self, name: str | list[str]) -> LoadToMass | list[LoadToMass | None] | None:
61
61
  """根据名称获取荷载转换质量"""
62
- if isinstance(name, str):
63
- name = [name]
64
- elif isinstance(name, list):
65
- ...
62
+
63
+ if isinstance(name, list):
64
+ names = [str(x) for x in name]
66
65
  else:
66
+ names = [str(name)]
67
+ if not isinstance(names, list):
67
68
  raise TypeError(f"不支持的名称类型: {type(name)}")
68
- resp = osis_client("GetLoadToMassInfoByNames", {"name": name})
69
+ resp = osis_client("GetLoadToMassInfoByNames", {"name": names})
69
70
  if not resp['success']:
70
71
  raise RuntimeError(f"{resp['error']}")
71
72
  ltm = [LoadToMass._from_dict(d) if d else None for d in resp.get("data", [])]
@@ -254,13 +255,14 @@ class SeisRspSpecManager:
254
255
 
255
256
  def get(self, name: str | list[str]) -> SeisRspSpec | list[SeisRspSpec | None] | None:
256
257
  """根据名称获取地震反应谱"""
257
- if isinstance(name, str):
258
- name = [name]
259
- elif isinstance(name, list):
260
- ...
258
+
259
+ if isinstance(name, list):
260
+ names = [str(x) for x in name]
261
261
  else:
262
+ names = [str(name)]
263
+ if not isinstance(names, list):
262
264
  raise TypeError(f"不支持的名称类型: {type(name)}")
263
- resp = osis_client("GetSeisRspSpecInfoByNames", {"name": name})
265
+ resp = osis_client("GetSeisRspSpecInfoByNames", {"name": names})
264
266
  if not resp['success']:
265
267
  raise RuntimeError(f"{resp['error']}")
266
268
  rsp = [SeisRspSpec._from_dict(d) if d else None for d in resp.get("data", [])]
@@ -409,13 +411,14 @@ class RspecAnalManager:
409
411
 
410
412
  def get(self, name: str | list[str]) -> RspecAnal | list[RspecAnal | None] | None:
411
413
  """根据名称获取反应谱工况"""
412
- if isinstance(name, str):
413
- name = [name]
414
- elif isinstance(name, list):
415
- ...
414
+
415
+ if isinstance(name, list):
416
+ names = [str(x) for x in name]
416
417
  else:
418
+ names = [str(name)]
419
+ if not isinstance(names, list):
417
420
  raise TypeError(f"不支持的名称类型: {type(name)}")
418
- resp = osis_client("GetSeisRespSpecByNames", {"name": name})
421
+ resp = osis_client("GetSeisRespSpecByNames", {"name": names})
419
422
  if not resp['success']:
420
423
  raise RuntimeError(f"{resp['error']}")
421
424
  rsp = [RspecAnal._from_dict(d) if d else None for d in resp.get("data", [])]
@@ -35,13 +35,6 @@ class ElementType(Enum):
35
35
  CABLE = 4
36
36
  SHELL = 5
37
37
 
38
- ELEMENT_TYPE_NAMES: dict[int, str] = {
39
- 1: "BEAM3D",
40
- 2: "TRUSS",
41
- 3: "SPRING",
42
- 4: "CABLE",
43
- 5: "SHELL",
44
- }
45
38
 
46
39
 
47
40
  # ──────────────────────────────────────────────
@@ -77,9 +70,10 @@ class Element:
77
70
  @classmethod
78
71
  def _from_dict(cls, d: dict) -> Element:
79
72
  """从接口 dict 构造 Material 对象(内部使用)"""
73
+ raw_type = int(d.get("type"))
80
74
  return cls(
81
75
  no=d.get("no"),
82
- element_type=d.get("type"),
76
+ element_type=ElementType(raw_type) if raw_type in [t.value for t in ElementType] else ElementType.UNASSIGNED,
83
77
  mat=d.get("mat"),
84
78
  node_vec=d.get("nodeVec"),
85
79
  node_i=d.get("nodeI"),
@@ -329,12 +323,15 @@ class ElementGroupManager:
329
323
  单个 ElementGroup 对象;如果传入列表则返回对象列表;
330
324
  不存在返回 None
331
325
  """
332
- if isinstance(name, str):
333
- name = [name]
334
- elif not isinstance(name, list):
326
+
327
+ if isinstance(name, list):
328
+ names = [str(x) for x in name]
329
+ else:
330
+ names = [str(name)]
331
+ if not isinstance(names, list):
335
332
  raise TypeError(f"不支持的名称类型: {type(name)}")
336
333
 
337
- resp = osis_client("GetElementGroupInfoByNames", {"name": name})
334
+ resp = osis_client("GetElementGroupInfoByNames", {"name": names})
338
335
  if not resp['success']:
339
336
  raise RuntimeError(f"{resp['error']}")
340
337
 
@@ -391,13 +388,14 @@ class TaperEleGroupManager:
391
388
  Returns:
392
389
  TaperEleGroup | list[TaperEleGroup | None]: 变截面单元组对象
393
390
  """
394
- if isinstance(name, str):
395
- name = [name]
396
- elif isinstance(name, list):
397
- ...
391
+
392
+ if isinstance(name, list):
393
+ names = [str(x) for x in name]
398
394
  else:
395
+ names = [str(name)]
396
+ if not isinstance(names, list):
399
397
  raise TypeError(f"不支持的名称类型: {type(name)}")
400
- resp = osis_client("GetTaperEleGroupInfoByNames", {"name": name})
398
+ resp = osis_client("GetTaperEleGroupInfoByNames", {"name": names})
401
399
  if not resp['success']:
402
400
  raise RuntimeError(f"{resp['error']}")
403
401
  taper_ele_groups = [
@@ -105,7 +105,7 @@ def osis_spline3d_arc3d(strName: str, type: str, eOwner: str, *coordinates: floa
105
105
  """
106
106
  pass
107
107
 
108
- @REGISTRY.register('Spline3D')
108
+ @REGISTRY.register('Spline3DDel')
109
109
  def osis_spline3d_del(strName: str):
110
110
  """删除三维样条曲线。
111
111
 
@@ -280,11 +280,12 @@ class GeometryManager:
280
280
  Returns:
281
281
  单个 Spline 对象,或 Spline 对象列表
282
282
  """
283
- if isinstance(name, str):
284
- names = [name]
285
- elif isinstance(name, list):
286
- names = name
283
+
284
+ if isinstance(name, list):
285
+ names = [str(x) for x in name]
287
286
  else:
287
+ names = [str(name)]
288
+ if not isinstance(names, list):
288
289
  raise TypeError(f"不支持的名称类型: {type(name)}")
289
290
 
290
291
  resp = osis_client("GetSplineInfoByNames", {"name": names})
@@ -574,12 +574,15 @@ class LiveGradeManager:
574
574
  TypeError: 名称类型不支持时抛出
575
575
  RuntimeError: 接口调用失败时抛出
576
576
  """
577
- if isinstance(name, str):
578
- name = [name]
579
- elif not isinstance(name, list):
577
+
578
+ if isinstance(name, list):
579
+ names = [str(x) for x in name]
580
+ else:
581
+ names = [str(name)]
582
+ if not isinstance(names, list):
580
583
  raise TypeError(f"不支持的名称类型: {type(name)}")
581
584
 
582
- resp = osis_client("GetGradeInfoByNames", {"name": name})
585
+ resp = osis_client("GetGradeInfoByNames", {"name": names})
583
586
  if not resp['success']:
584
587
  raise RuntimeError(f"{resp['error']}")
585
588
 
@@ -779,12 +782,15 @@ class LaneManager:
779
782
  TypeError: 名称类型不支持时抛出
780
783
  RuntimeError: 接口调用失败时抛出
781
784
  """
782
- if isinstance(name, str):
783
- name = [name]
784
- elif not isinstance(name, list):
785
+
786
+ if isinstance(name, list):
787
+ names = [str(x) for x in name]
788
+ else:
789
+ names = [str(name)]
790
+ if not isinstance(names, list):
785
791
  raise TypeError(f"不支持的名称类型: {type(name)}")
786
792
 
787
- resp = osis_client("GetLaneInfoByNames", {"name": name})
793
+ resp = osis_client("GetLaneInfoByNames", {"name": names})
788
794
  if not resp['success']:
789
795
  raise RuntimeError(f"{resp['error']}")
790
796
 
@@ -904,12 +910,15 @@ class LiveCaseManager:
904
910
  TypeError: 名称类型不支持时抛出
905
911
  RuntimeError: 接口调用失败时抛出
906
912
  """
907
- if isinstance(name, str):
908
- name = [name]
909
- elif not isinstance(name, list):
913
+
914
+ if isinstance(name, list):
915
+ names = [str(x) for x in name]
916
+ else:
917
+ names = [str(name)]
918
+ if not isinstance(names, list):
910
919
  raise TypeError(f"不支持的名称类型: {type(name)}")
911
920
 
912
- resp = osis_client("GetLiveInfoByNames", {"name": name})
921
+ resp = osis_client("GetLiveInfoByNames", {"name": names})
913
922
  if not resp['success']:
914
923
  raise RuntimeError(f"{resp['error']}")
915
924
 
@@ -792,12 +792,12 @@ class TendonShape:
792
792
  def layout(
793
793
  self,
794
794
  layout_type: Literal['GLOBAL', "ELEMENT"],
795
- n_ele: int,
796
- n_beg: int,
797
- n_dir: int,
798
- d_offset_x: float = 0.0,
799
- d_offset_y: float = 0.0,
800
- d_offset_z: float = 0.0,
795
+ n_ele: int = None,
796
+ n_beg: int = None,
797
+ n_dir: int = None,
798
+ d_offset_x: float = None,
799
+ d_offset_y: float = None,
800
+ d_offset_z: float = None,
801
801
  ) -> None:
802
802
  """布置钢束形状"""
803
803
  ok, err = osis_layout_tendons(self.name, layout_type, n_ele, n_beg, n_dir, d_offset_x, d_offset_y, d_offset_z)
@@ -1118,12 +1118,15 @@ class TendonPropManager:
1118
1118
  TypeError: 名称类型不支持时抛出
1119
1119
  RuntimeError: 接口调用失败时抛出
1120
1120
  """
1121
- if isinstance(name, str):
1122
- name = [name]
1123
- elif not isinstance(name, list):
1121
+
1122
+ if isinstance(name, list):
1123
+ names = [str(x) for x in name]
1124
+ else:
1125
+ names = [str(name)]
1126
+ if not isinstance(names, list):
1124
1127
  raise TypeError(f"不支持的名称类型: {type(name)}")
1125
1128
 
1126
- resp = osis_client("GetTendonPropInfoByNames", {"name": name})
1129
+ resp = osis_client("GetTendonPropInfoByNames", {"name": names})
1127
1130
  if not resp['success']:
1128
1131
  raise RuntimeError(f"{resp['error']}")
1129
1132
 
@@ -1303,12 +1306,15 @@ class TendonShapeManager:
1303
1306
  TypeError: 名称类型不支持时抛出
1304
1307
  RuntimeError: 接口调用失败时抛出
1305
1308
  """
1306
- if isinstance(name, str):
1307
- name = [name]
1308
- elif not isinstance(name, list):
1309
+
1310
+ if isinstance(name, list):
1311
+ names = [str(x) for x in name]
1312
+ else:
1313
+ names = [str(name)]
1314
+ if not isinstance(names, list):
1309
1315
  raise TypeError(f"不支持的名称类型: {type(name)}")
1310
1316
 
1311
- resp = osis_client("GetTendonShapeInfoByNames", {"name": name})
1317
+ resp = osis_client("GetTendonShapeInfoByNames", {"name": names})
1312
1318
  if not resp['success']:
1313
1319
  raise RuntimeError(f"{resp['error']}")
1314
1320
 
@@ -1490,12 +1496,15 @@ class LoadCaseManager:
1490
1496
  Returns:
1491
1497
  LoadCase 对象或数组;工况不存在返回 None
1492
1498
  """
1493
- if isinstance(name, str):
1494
- name = [name]
1495
- elif not isinstance(name, list):
1499
+
1500
+ if isinstance(name, list):
1501
+ names = [str(x) for x in name]
1502
+ else:
1503
+ names = [str(name)]
1504
+ if not isinstance(names, list):
1496
1505
  raise TypeError(f"不支持的名称类型: {type(name)}")
1497
1506
 
1498
- resp = osis_client("GetLoadCaseInfoByNames", {"name": name})
1507
+ resp = osis_client("GetLoadCaseInfoByNames", {"name": names})
1499
1508
  if not resp['success']:
1500
1509
  raise RuntimeError(f"{resp['error']}")
1501
1510
 
@@ -11,7 +11,7 @@
11
11
  from __future__ import annotations
12
12
 
13
13
  from dataclasses import dataclass
14
- from typing import Literal
14
+ from typing import Literal, Union
15
15
  from enum import Enum
16
16
  from ..core.client import osis_client
17
17
  from .interface import (
@@ -61,10 +61,11 @@ class Material:
61
61
  @classmethod
62
62
  def _from_dict(cls, d: dict) -> Material:
63
63
  """从接口 dict 构造 Material 对象(内部使用)"""
64
+ raw_type = int(d.get("materialType"))
64
65
  return cls(
65
66
  no=d.get("no"),
66
67
  name=d.get("name"),
67
- material_type=d.get("materialType"),
68
+ material_type=MaterialType(raw_type) if raw_type in [t.value for t in MaterialType] else MaterialType.UNASSIGNED ,
68
69
  code=d.get("code"),
69
70
  grade=d.get("grade"),
70
71
  e=d.get("e"),
@@ -135,8 +136,8 @@ class MaterialManager:
135
136
  name: str,
136
137
  eCode: Literal["JTG3362_2018", "JTGD62_2004"],
137
138
  eGrade: Literal["C15", "C20", "C25", "C30", "C35", "C40", "C45", "C50", "C55", "C60", "C65", "C70", "C75", "C80"],
138
- nCrepShrk: int | None = None,
139
- dDmp: float = 0.0,
139
+ nCrepShrk: int | str = "",
140
+ dDmp: float = 0.05,
140
141
  no: int | None = None,
141
142
  ) -> Material:
142
143
  """创建混凝土材料
@@ -269,14 +270,14 @@ class MaterialManager:
269
270
  def create_custom(
270
271
  self,
271
272
  name: str,
272
- no: int | None = None,
273
- dE: float = 0,
273
+ dE: float = 1,
274
274
  dG: float = 0,
275
275
  dMu: float = 0,
276
276
  dExpCoeff: float = 0,
277
277
  dUnitWeight: float = 0,
278
278
  dDensity: float = 0,
279
279
  dDmp: float = 0,
280
+ no: int | None = None,
280
281
  ) -> Material:
281
282
  """创建自定义材料
282
283
 
@@ -319,7 +320,7 @@ class MaterialManager:
319
320
  if not ok:
320
321
  raise RuntimeError(f"删除材料 {no} 失败: {err}")
321
322
 
322
- def renumber(self, old_no: int, new_no: int) -> None:
323
+ def renumber(self, old_no: int, new_no: int) -> Material | list[Material | None]:
323
324
  """修改材料编号
324
325
 
325
326
  Args:
@@ -253,13 +253,13 @@ class DampingManager:
253
253
 
254
254
  def get(self, name: str | list[str]) -> Damping | list[Damping | None] | None:
255
255
  """根据名称获取阻尼模型"""
256
- if isinstance(name, str):
257
- name = [name]
258
- elif isinstance(name, list):
259
- ...
256
+ if isinstance(name, list):
257
+ names = [str(x) for x in name]
260
258
  else:
259
+ names = [str(name)]
260
+ if not isinstance(names, list):
261
261
  raise TypeError(f"不支持的名称类型: {type(name)}")
262
- resp = osis_client("GetDampingInfoByNames", {"name": name})
262
+ resp = osis_client("GetDampingInfoByNames", {"name": names})
263
263
  if not resp['success']:
264
264
  raise RuntimeError(f"{resp['error']}")
265
265
  dampings = [Damping._from_dict(d) if d else None for d in resp.get("data", [])]
@@ -10,6 +10,7 @@ from __future__ import annotations
10
10
 
11
11
  from dataclasses import dataclass, field
12
12
  from typing import Literal
13
+ from enum import Enum
13
14
 
14
15
  from ..core.client import osis_client
15
16
 
@@ -72,6 +73,73 @@ from .rib import (
72
73
  )
73
74
 
74
75
 
76
+ class SectionType(Enum):
77
+ UNASSIGNED = 0 # 未分配
78
+ LSHAPE = 1 # L形与倒L形
79
+ TSHAPE = 2 # T形与倒T形
80
+ ISHAPE = 3 # 工字形
81
+ CIRCLE = 4 # 圆形与圆管形
82
+ RECTANGLE = 5 # 实腹与空腹矩形(可倒圆/斜角)
83
+ ROUNDEDEND = 6 # 实腹与空腹圆端形
84
+ HOLLOWSLAB = 7 # 空心板梁
85
+ SMALLBOX = 8 # 小箱梁
86
+ TGIRDER = 9 # T梁
87
+ CONVENTIONALBOX = 10 # 常规箱梁
88
+ FLATBOX = 11 # 扁平箱梁
89
+ DOUBLESIDEBOX = 12 # 双边箱梁
90
+ RIBBEDSLAB = 13 # 肋板式
91
+ CUSTOM = 14 # 常规自定义截面
92
+
93
+ STEELI = 21 # 工字钢梁截面
94
+ STEELBOX = 22 # 箱型钢梁截面
95
+ STEELBOXTHREECELL = 23 # 单箱单/三室钢梁截面
96
+ STEELBOXITF = 24 # 单箱单室斜顶板钢梁界面
97
+ STEELCANTIBOX = 25 # 悬臂单箱单/双室钢梁界面
98
+ STEELCANTIBOXIBF = 26 # 悬臂单箱单/双室斜底板钢梁截面
99
+ STEELCUSTOM = 27 # 钢梁自定义截面,采用几何点线形式输入
100
+ STEELCUSTOMPLATE = 28 # 钢梁自定义截面,采用参数板形式输入
101
+
102
+ COMPOSITESTEELI = 41 # 钢-工字型组合截面
103
+ COMPOSITESTEELTROUGH = 42 # 钢-槽型组合截面
104
+ COMPOSITESTEELBOX = 43 # 钢-箱型组合截面
105
+ COMPOSITECUSTOM = 44 # 自定义组合截面
106
+
107
+ NUMERICAL = 51 # 数值截面
108
+
109
+ @dataclass(frozen=False)
110
+ class Rebar:
111
+ """钢筋基类"""
112
+ has_bent_up_rebar: bool # 是否有弯起钢筋
113
+ has_shear_stirrup: bool # 是否有抗剪箍筋
114
+ has_torsional_stirrup: bool # 是否有扭转箍筋
115
+ has_web_vertical_rebar: bool # 是否有腹板竖筋
116
+ longitudinal_rebars: list[dict] # 纵筋
117
+ longitudinal_rebars_count: int # 纵筋数量
118
+ @staticmethod
119
+ def empty() -> Rebar:
120
+ """无钢筋信息时的占位对象(内部使用)"""
121
+ return Rebar(
122
+ has_bent_up_rebar=False,
123
+ has_shear_stirrup=False,
124
+ has_torsional_stirrup=False,
125
+ has_web_vertical_rebar=False,
126
+ longitudinal_rebars=[],
127
+ longitudinal_rebars_count=0,
128
+ )
129
+ @classmethod
130
+ def _from_dict(cls, d: dict) -> Rebar:
131
+ """从接口 dict 构造 Rebar 对象(内部使用)"""
132
+ lr = d.get("longitudinalRebars")
133
+ cnt = d.get("longitudinalRebarsCount")
134
+ return cls(
135
+ has_bent_up_rebar=bool(d.get("hasBentUpRebar")),
136
+ has_shear_stirrup=bool(d.get("hasShearStirrup")),
137
+ has_torsional_stirrup=bool(d.get("hasTorsionalStirrup")),
138
+ has_web_vertical_rebar=bool(d.get("hasWebVerticalRebar")),
139
+ longitudinal_rebars=list(lr) if isinstance(lr, list) else [],
140
+ longitudinal_rebars_count=int(cnt) if cnt is not None else 0,
141
+ )
142
+
75
143
  # ──────────────────────────────────────────────
76
144
  # Section 基类
77
145
  # ──────────────────────────────────────────────
@@ -86,50 +154,60 @@ class Section:
86
154
  """
87
155
 
88
156
  no: int # 截面编号
89
- name: str = "" # 截面名称
90
- type: int = 0 # 截面类型
91
- prop: dict | None = None # 截面属性
92
- prop_factor: dict | None = None # 截面因子
93
- offset_type_y: int = 0 # 偏移类型 Y
94
- offset_value_y: float = 0.0 # 偏移值 Y
95
- offset_type_z: int = 0 # 偏移类型 Z
96
- offset_value_z: float = 0.0 # 偏移值 Z
97
- stress_points: list[dict] = field(default_factory=list) # 应力点
98
- boundary: dict | None = None # 边界
99
- height: float = 0.0 # 高度
100
- modeling_point_x: float = 0.0 # 模型点 X
101
- modeling_point_y: float = 0.0 # 模型点 Y
102
- contour: list[dict] = field(default_factory=list) # 轮廓
103
- has_concrete_section: bool = False # 是否有混凝土截面
104
- has_steel_section: bool = False # 是否有钢截面
105
- related_elements: list[int] = field(default_factory=list) # 相关元素
106
-
157
+ name: str # 截面名称
158
+ section_type: SectionType # 截面类型
159
+ prop: dict # 截面属性
160
+ prop_factor: dict # 截面因子
161
+ offset_type_y: int # 偏移类型 Y
162
+ offset_value_y: float # 偏移值 Y
163
+ offset_type_z: int # 偏移类型 Z
164
+ offset_value_z: float # 偏移值 Z
165
+ stress_points: list[dict] # 应力点
166
+ boundary: dict # 边界
167
+ height: float # 高度
168
+ modeling_point_x: float # 模型点 X
169
+ modeling_point_y: float # 模型点 Y
170
+ contour: list[dict] # 轮廓
171
+ has_concrete_section: bool # 是否有混凝土截面
172
+ has_steel_section: bool # 是否有钢截面
173
+ related_elements: list[int] # 相关单元
174
+ rebar: Rebar # 钢筋
107
175
  @classmethod
108
176
  def _from_dict(cls, d: dict) -> Section:
109
177
  """从接口 dict 构造 Section 对象(内部使用)"""
178
+ raw_type = int(d.get("type", 0))
179
+ sp = d.get("stressPoints")
180
+ ct = d.get("contour")
181
+ rel = d.get("relatedElement")
182
+ raw_rebar = d.get("rebar")
183
+ if isinstance(raw_rebar, dict):
184
+ rebar_obj = Rebar._from_dict(raw_rebar)
185
+ else:
186
+ rebar_obj = Rebar.empty()
110
187
  return cls(
111
188
  no=d.get("no"),
112
189
  name=d.get("name"),
113
- type=d.get("type"),
190
+ section_type=SectionType(raw_type) if raw_type in [t.value for t in SectionType] else SectionType.UNASSIGNED,
114
191
  prop=d.get("prop"),
115
192
  prop_factor=d.get("propFactor"),
116
193
  offset_type_y=d.get("offsetTypeY"),
117
194
  offset_value_y=d.get("offsetValueY"),
118
195
  offset_type_z=d.get("offsetTypeZ"),
119
196
  offset_value_z=d.get("offsetValueZ"),
120
- stress_points=list(d.get("stressPoints")),
197
+ stress_points=list(sp) if isinstance(sp, list) else [],
121
198
  boundary=d.get("boundary"),
122
199
  height=d.get("height"),
123
200
  modeling_point_x=d.get("modelingPointX"),
124
201
  modeling_point_y=d.get("modelingPointY"),
125
- contour=list(d.get("contour")),
202
+ contour=list(ct) if isinstance(ct, list) else [],
126
203
  has_concrete_section=d.get("hasConcreteSection"),
127
204
  has_steel_section=d.get("hasSteelSection"),
128
- related_elements=list(d.get("relatedElement")),
205
+ related_elements=list(rel) if isinstance(rel, list) else [],
206
+ rebar = rebar_obj,
129
207
  )
130
208
 
131
209
  def __repr__(self) -> str:
132
- return f"Section(no={self.no}, name={self.name!r}, type={self.type})"
210
+ return f"Section(no={self.no}, name={self.name!r}, type={self.section_type.name})"
133
211
 
134
212
  # ── 实例方法 ──────────────────────────────
135
213
 
@@ -812,12 +890,13 @@ class SectionManager:
812
890
  def create_steel_i(
813
891
  self,
814
892
  name: str,
815
- h: float = 0.0,
816
- bt: float = 0.0,
817
- bb: float = 0.0,
818
- tt: float = 0.0,
819
- tb: float = 0.0,
820
- tw: float = 0.0,
893
+ # 暂时去掉默认值
894
+ h: float,
895
+ bt: float,
896
+ bb: float,
897
+ tt: float,
898
+ tb: float,
899
+ tw: float,
821
900
  web_rib_pos: Literal["Left", "Right", "Both"] = "Both",
822
901
  no: int | None = None,
823
902
  ) -> Section:
@@ -844,14 +923,14 @@ class SectionManager:
844
923
  def create_steel_box(
845
924
  self,
846
925
  name: str,
847
- h: float = 0.0,
848
- bt: float = 0.0,
849
- bct: float = 0.0,
850
- bb: float = 0.0,
851
- bcb: float = 0.0,
852
- tt: float = 0.0,
853
- tb: float = 0.0,
854
- tw: float = 0.0,
926
+ h: float,
927
+ bt: float,
928
+ bct: float,
929
+ bb: float,
930
+ bcb: float,
931
+ tt: float,
932
+ tb: float,
933
+ tw: float,
855
934
  same_layout: Literal[0, 1] = 1,
856
935
  no: int | None = None,
857
936
  ) -> Section:
@@ -880,21 +959,22 @@ class SectionManager:
880
959
  def create_steel_box_three_cell(
881
960
  self,
882
961
  name: str,
883
- h: float = 0.0,
884
- bt: float = 0.0,
885
- bb: float = 0.0,
886
- i: float = 0.0,
887
- a1: float = 0.0,
888
- a2: float = 0.0,
889
- dt: float = 0.0,
890
- tt1: float = 0.0,
891
- tt2: float = 0.0,
892
- tb1: float = 0.0,
893
- db: float = 0.0,
894
- tb2: float = 0.0,
895
- tb3: float = 0.0,
896
- tw1: float = 0.0,
897
- dw: float = 0.0,
962
+ # 暂时去掉默认值
963
+ h: float,
964
+ bt: float,
965
+ bb: float,
966
+ i: float,
967
+ a1: float,
968
+ a2: float,
969
+ dt: float,
970
+ tt1: float,
971
+ tt2: float,
972
+ tb1: float,
973
+ db: float,
974
+ tb2: float,
975
+ tb3: float,
976
+ tw1: float,
977
+ dw: float,
898
978
  has_web: Literal[0, 1] = 1,
899
979
  tw2: float = 0.0,
900
980
  web_rib_pos: Literal["Left", "Right", "Both"] = "Both",
@@ -937,22 +1017,23 @@ class SectionManager:
937
1017
  def create_steel_box_itf(
938
1018
  self,
939
1019
  name: str,
940
- h: float = 0.0,
941
- b: float = 0.0,
942
- bt: float = 0.0,
943
- bb: float = 0.0,
944
- i: float = 0.0,
945
- a1: float = 0.0,
946
- a2: float = 0.0,
947
- dt: float = 0.0,
948
- tt1: float = 0.0,
949
- tt2: float = 0.0,
950
- tt3: float = 0.0,
951
- tb1: float = 0.0,
952
- db: float = 0.0,
953
- tb2: float = 0.0,
954
- tb3: float = 0.0,
955
- tw1: float = 0.0,
1020
+ # 暂时去掉默认值
1021
+ h: float,
1022
+ b: float,
1023
+ bt: float,
1024
+ bb: float,
1025
+ i: float,
1026
+ a1: float,
1027
+ a2: float,
1028
+ dt: float,
1029
+ tt1: float,
1030
+ tt2: float,
1031
+ tt3: float,
1032
+ tb1: float,
1033
+ db: float,
1034
+ tb2: float,
1035
+ tb3: float,
1036
+ tw1: float,
956
1037
  no: int | None = None,
957
1038
  ) -> Section:
958
1039
  """创建单箱单室斜顶板钢截面(STEELBOXITF)。
@@ -990,16 +1071,17 @@ class SectionManager:
990
1071
  def create_steel_canti_box(
991
1072
  self,
992
1073
  name: str,
993
- h: float = 0.0,
994
- bt: float = 0.0,
995
- bb: float = 0.0,
996
- i: float = 0.0,
997
- a: float = 0.0,
998
- dt: float = 0.0,
999
- tt1: float = 0.0,
1000
- tt2: float = 0.0,
1001
- tb1: float = 0.0,
1002
- tw1: float = 0.0,
1074
+ # 暂时去掉默认值
1075
+ h: float,
1076
+ bt: float,
1077
+ bb: float,
1078
+ i: float,
1079
+ a: float,
1080
+ dt: float,
1081
+ tt1: float,
1082
+ tt2: float,
1083
+ tb1: float,
1084
+ tw1: float,
1003
1085
  has_web: Literal[0, 1] = 1,
1004
1086
  tw2: float = 0.0,
1005
1087
  web_rib_pos: Literal["Left", "Right", "Both"] = "Both",
@@ -1041,18 +1123,19 @@ class SectionManager:
1041
1123
  def create_steel_canti_box_ibf(
1042
1124
  self,
1043
1125
  name: str,
1044
- h: float = 0.0,
1045
- bt: float = 0.0,
1046
- bb: float = 0.0,
1047
- bc: float = 0.0,
1048
- i: float = 0.0,
1049
- a: float = 0.0,
1050
- dt: float = 0.0,
1051
- tt1: float = 0.0,
1052
- tt2: float = 0.0,
1053
- tb1: float = 0.0,
1054
- tb2: float = 0.0,
1055
- tw1: float = 0.0,
1126
+ # 暂时去掉默认值
1127
+ h: float,
1128
+ bt: float,
1129
+ bb: float,
1130
+ bc: float,
1131
+ i: float,
1132
+ a: float,
1133
+ dt: float,
1134
+ tt1: float,
1135
+ tt2: float,
1136
+ tb1: float,
1137
+ tb2: float,
1138
+ tw1: float,
1056
1139
  has_web: Literal[0, 1] = 1,
1057
1140
  tw2: float = 0.0,
1058
1141
  web_rib_pos: Literal["Left", "Right", "Both"] = "Both",
@@ -220,12 +220,14 @@ class SettlementGroupManager:
220
220
  单个 SettlementGroup 对象;如果传入列表则返回对象列表;
221
221
  不存在返回 None
222
222
  """
223
- if isinstance(name, str):
224
- name = [name]
225
- elif not isinstance(name, list):
223
+ if isinstance(name, list):
224
+ names = [str(x) for x in name]
225
+ else:
226
+ names = [str(name)]
227
+ if not isinstance(names, list):
226
228
  raise TypeError(f"不支持的名称类型: {type(name)}")
227
229
 
228
- resp = osis_client("GetSetlGrpInfoByNames", {"name": name})
230
+ resp = osis_client("GetSetlGrpInfoByNames", {"name": names})
229
231
  if not resp['success']:
230
232
  raise RuntimeError(f"{resp['error']}")
231
233
 
@@ -332,12 +334,15 @@ class SettlementManager:
332
334
  单个 Settlement 对象;如果传入列表则返回对象列表;
333
335
  不存在返回 None
334
336
  """
335
- if isinstance(name, str):
336
- name = [name]
337
- elif not isinstance(name, list):
337
+
338
+ if isinstance(name, list):
339
+ names = [str(x) for x in name]
340
+ else:
341
+ names = [str(name)]
342
+ if not isinstance(names, list):
338
343
  raise TypeError(f"不支持的名称类型: {type(name)}")
339
344
 
340
- resp = osis_client("GetSettlementInfoByNames", {"name": name})
345
+ resp = osis_client("GetSettlementInfoByNames", {"name": names})
341
346
  if not resp['success']:
342
347
  raise RuntimeError(f"{resp['error']}")
343
348
 
@@ -94,13 +94,14 @@ class StabilityManager:
94
94
  return buckl_cases
95
95
  def get(self, name: str | list[str]) -> BucklCase | list[BucklCase | None] | None:
96
96
  """根据名称获取屈曲工况"""
97
- if isinstance(name, str):
98
- name = [name]
99
- elif isinstance(name, list):
100
- ...
97
+
98
+ if isinstance(name, list):
99
+ names = [str(x) for x in name]
101
100
  else:
101
+ names = [str(name)]
102
+ if not isinstance(names, list):
102
103
  raise TypeError(f"不支持的名称类型: {type(name)}")
103
- resp = osis_client("GetBucklingInfoByNames", {"name": name})
104
+ resp = osis_client("GetBucklingInfoByNames", {"name": names})
104
105
  if not resp['success']:
105
106
  raise RuntimeError(f"{resp['error']}")
106
107
  buckl_cases = [BucklCase._from_dict(d) if d else None for d in resp.get("data", [])]
File without changes
File without changes
File without changes
File without changes