osis-python 0.8.0__py3-none-any.whl → 0.8.1__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osis-python
3
- Version: 0.8.0
3
+ Version: 0.8.1
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
@@ -306,6 +306,27 @@ lc.create_gravity()
306
306
  lc.create_nforce(1, fx=1000)
307
307
  ```
308
308
 
309
+ ### Enums
310
+
311
+ All type codes live in `pyosis.core.enums`. Each member's **name is the OSIS command-stream spelling**, so a member converts straight to a string; its value is the integer code the JSON carries:
312
+
313
+ ```python
314
+ from pyosis.core.enums import ElementType, SectionType
315
+
316
+ SectionType.Rectangle.value # 5 — code as sent by OSIS
317
+ str(SectionType.Rectangle) # "Rectangle"
318
+ SectionType.name_of(5) # "Rectangle"
319
+ SectionType.of(404) # SectionType.Unassigned — unknown code falls back
320
+ ```
321
+
322
+ Available: `ElementType`, `BoundaryType`, `MaterialType`, `MaterialCode`, `SectionType`, `LoadCaseType`, `SplineType`, `TensionType`, `LiveGradeType`. Data-class fields that carry a type expose a `type_name` / `code_name` / `grade_name` property for convenience.
323
+
324
+ The `Xxx_TYPE_NAMES` dicts from pyosis 0.x are gone; use `XxxType.name_of(code)` instead.
325
+
326
+ > **Migration note (0.8.0):** member names were normalized to the OSIS spelling, so `Enum.name` changed for some values — `SectionType.CUSTOM.name` is now `"CustomShape"`, `ElementType.UNASSIGNED.name` is now `"Unassigned"`. Code that compared against the old names, or indexed the old `*_TYPE_NAMES` dicts, needs updating. The old all-caps aliases (`SectionType.CUSTOM`, `ElementType.UNASSIGNED`, …) still resolve to the same values.
327
+
328
+ > **Migration note (0.8.1):** vehicles are no longer a separate concept. OSIS has no vehicle entity — a vehicle is just one value of the live-load grade (`LiveGradeType.VEHICLE`), alongside highway/crowd/fatigue grades. Removed: `engine.live.vehicle`, `VehicleManager`, `vehicle_manager`, `LiveGrade.is_vehicle`, `LiveGrade.live_type_for_custom`, `LiveTypeForCustom`. Use `engine.live.grade` with `LiveGrade.grade_name` instead. `SplineType` member names also moved to the OSIS spelling (`GENERAL`/`NATURAL`/`ARC3D`/`ARC2D`), so `SplineType.General.name` is now `"GENERAL"`; the old spellings remain as aliases.
329
+
309
330
  ### Explicit Numbering
310
331
 
311
332
  Some `create_*` functions support explicit numbering via the `no` parameter. If not specified, the number is automatically assigned:
@@ -1,14 +1,14 @@
1
- osis_python-0.8.0.dist-info/licenses/LICENSE,sha256=T4mkSYliXdU9mYe-NfHkqg6GPhzoYaIQO_a630UzpS4,1088
2
- pyosis/__init__.py,sha256=eTE740oKVuI2f5Gb1OOGMmuWnYFc6kTOyActxwS14U0,440
1
+ osis_python-0.8.1.dist-info/licenses/LICENSE,sha256=T4mkSYliXdU9mYe-NfHkqg6GPhzoYaIQO_a630UzpS4,1088
2
+ pyosis/__init__.py,sha256=L2jEIndOU-aOJxcGYb8AWtfJZOHIpK6auTRVtv76jWs,440
3
3
  pyosis/boundary/__init__.py,sha256=W5LfF-jugWa-YI8pnfELZaz0pXLa-D8TiGnBn12HGGQ,102
4
4
  pyosis/boundary/interface.py,sha256=obqQUVFuQK9I7S8IaBZ2VBYfyXgNVBS0PQa9LzRlaAc,8990
5
- pyosis/boundary/manager.py,sha256=DotTkqDWoZw8ES4h4R0eheYrvQxb2gXHekSKpWftIOs,40474
5
+ pyosis/boundary/manager.py,sha256=A2D4gpef8NwpqFqrOPANun_U3XA7kVY5QI86yQRooLg,40404
6
6
  pyosis/control/__init__.py,sha256=98UAXB9Wkf93pGUKIjoGBBrSCblVeAwc_MXeaAB-UIA,119
7
7
  pyosis/control/control.py,sha256=4bX92TDJnf1D5A3YY7ZZrU7iUeAxKCjQe9z_F_SEHBs,2816
8
8
  pyosis/control/io.py,sha256=buaut3-W8kwJIe3PgjtgOU0JCSgDfOEd2cS3mxYsfuc,591
9
9
  pyosis/control/manager.py,sha256=EZEOlsgsg2rmOPIVjNFIdgwgxo9c0ZpKfjAr4wmx73Q,11610
10
10
  pyosis/control/nonlinear.py,sha256=26W_2GhD_0cn3YQxJjgbPR1oEopJWyuFWGlgx0q023I,1604
11
- pyosis/core/__init__.py,sha256=T7gaTtLWz8sPHB0s2T_GfCbpaFTwCXxTfEmecVyLR9A,1048
11
+ pyosis/core/__init__.py,sha256=eIzZJgbJgc8goRZEKZQ9tcOUEzSdrx5UL5YUgFv6XsE,1106
12
12
  pyosis/core/all_func.py,sha256=VhvAeMJMCQJ1redjqdkm7meTw1PJNDoRdmXXh2LzkVo,521
13
13
  pyosis/core/apdl_sync.py,sha256=SMBUwTdBCdQMQAPnC7gV1RS1Lp2XAVeHjQKEvFnkf54,5559
14
14
  pyosis/core/basic_manager.py,sha256=z3Qh5LpHg4AOyTrGffC09mPnW-yUT-UuhKnFe4GLUOM,7204
@@ -16,9 +16,9 @@ pyosis/core/batch.py,sha256=jPA9U3ahGRZdY8y1wCSZyVpBPmGOtQtvM3vfDgqM2sM,6851
16
16
  pyosis/core/client.py,sha256=_9NxTf1D_3BFgt7A73v5C-Qk3KORku_Sq85RnNi3ZxQ,4849
17
17
  pyosis/core/command.py,sha256=bZ5nS1wvwhjwIsogWQh5-1dAcbsJoyB8MR85WUprZ0s,8863
18
18
  pyosis/core/engine.py,sha256=ZAclt7GSIlZ8-DWH1Q9Tr7Jb4Jwza88-pNW4OiMCDCc,16880
19
- pyosis/core/enums.py,sha256=qY1-A9smleQk_9VxDmd0k9cwggT6zI5I24HQhd2yTJY,11331
19
+ pyosis/core/enums.py,sha256=unCYvb_b8d_97dosuNDnJ_MTXixmAyinrNWoQP31zV4,12943
20
20
  pyosis/core/exceptions.py,sha256=x0I0Emooejy8wF1ZBWGz7Yc1N70MitsnhhQv9txJQj8,1093
21
- pyosis/core/normalize.py,sha256=DB0OS63G-TOhdpGvOKPqJ2xyyKGuURDe_hPV2B5I0XI,1326
21
+ pyosis/core/normalize.py,sha256=7BmGqx3CgHFCbNqVHMA-zX9rK-d84K2h3tgY3vvKxzQ,1469
22
22
  pyosis/core/references.py,sha256=JQ8260aqVB5PhhGrqMt7W7fmrsmE69dFdrE6EyyLADg,2755
23
23
  pyosis/core/sdk.py,sha256=GL_Z8I66B4lqzB9K9JibG5TClqoo6uBaBMyTTlB981Y,2485
24
24
  pyosis/core/solver.py,sha256=RmW7uJJkV-K18ArkNIW4C-GYlE5sAXE4Vi5rhjyMcvY,7105
@@ -33,29 +33,28 @@ pyosis/dynamic/modal.py,sha256=__as3Nl7Ks2ntgcZwAA9UhvsvTfBl-1zSUOTsnPVf-Y,640
33
33
  pyosis/dynamic/seismic.py,sha256=8DIh7xkUgl0UwweDq4WoYSNzMxpLnpDaM4W_7u3rg_A,6380
34
34
  pyosis/element/__init__.py,sha256=fZgmxJiNhCe3Ki8vNEdZOhyinxwvlF6Jcu-DgD-c6YM,92
35
35
  pyosis/element/interface.py,sha256=xLd2ljq0qW5uvqV0Lo2e6Ly7NShh_p2I5vQNdcA8P4Q,9872
36
- pyosis/element/manager.py,sha256=4LKbljGxBaZL-PcnqXA1Ei04_evAYxnDQma3XP-6HUY,39550
36
+ pyosis/element/manager.py,sha256=I4zXJKQXJp22rfeoeF-WsDQDeRY7-VD1h24Sto5oiYM,39479
37
37
  pyosis/general/__init__.py,sha256=dyvge-GgUpT3BeDwm_Lss1xqNlxAQdt63WJ7QcuZ_O4,24
38
38
  pyosis/general/interface.py,sha256=YRXQ-iXYVhiUBiUd7fpA0NOtL5VSueOHcobj625aQeU,5382
39
39
  pyosis/geometry/__init__.py,sha256=mlAXlxaohcEcm8-6anyDo1fevh_IzYz2OXBn0_DIrCY,99
40
40
  pyosis/geometry/interface.py,sha256=OHpsFEgjQok8FXpsOXXbCxfe9PPF6ac2rU6fii91jkY,4444
41
- pyosis/geometry/manager.py,sha256=tfLXZd4eBT8y7F0tEVOXQY57xKzShqQ2iLt0h_QOto0,13454
42
- pyosis/live/__init__.py,sha256=Y36H7paj8nbFBeT6a8shKzMQnxnsfJIRzjUvivuc7HA,165
41
+ pyosis/geometry/manager.py,sha256=zGRSSlFBp-2ovULLcBhRsIINSYcuNVIZaM79nyvabVI,13457
42
+ pyosis/live/__init__.py,sha256=jl0pMkfAGRnukwuCbc6fOJoWo-ufMnFm4lyBV-xQQxc,112
43
43
  pyosis/live/analysis.py,sha256=sI0jE65KS2EylpmBbySNcGsUHvvk9-6SZ0-37ZXsmbk,5486
44
44
  pyosis/live/grade.py,sha256=GjFxV_FImMK_ahfB0DNePGwdifUbiFK8r-cSXlnrVP8,3774
45
45
  pyosis/live/lane.py,sha256=i1-mnKQuo_XLimtcX2ZV4PBC_A0FBneWxJU198X1MMc,5487
46
- pyosis/live/manager.py,sha256=JBVeQF6DJY0uLfc74qnzlnTqyo-63IBHHzfSqqfInPg,51195
47
- pyosis/live/vehicle.py,sha256=-0UasXdnqdcgwnNIdqZYLbKAizTN3IhG5hLlH_NV8yE,4428
46
+ pyosis/live/manager.py,sha256=yO_ayqUtE2zwW7ZIO3CkiEHjcbbelpDHs-A7jOfWcik,50567
48
47
  pyosis/load/__init__.py,sha256=AdCBsdf4QPVzbKwbj2C24Fnl9sPmlB9h542LjLFcqHM,135
49
48
  pyosis/load/loadcase.py,sha256=5DOty5OBtxHPguw_gYUqL3FFbXRkCjA2IVpCdAzJSJU,2457
50
- pyosis/load/manager.py,sha256=tfanb5D4EKGL-EaWnajg4etNjqvUZOUO4hufZhLvmKQ,82957
49
+ pyosis/load/manager.py,sha256=QKCjIaKUQqmJ_bALuyjBZpxuC9n2I1dEOzbCLFtlmmg,82960
51
50
  pyosis/load/static.py,sha256=vvwx5WmXUL-M3GvlH9GA-oaTZQmvLaawR76dFNVrwgc,22773
52
51
  pyosis/load/tendon.py,sha256=2AJxvYJU8PEJ-rH-vbLUjd0CwmhIeSFEx9asuWpT_0s,11528
53
52
  pyosis/material/__init__.py,sha256=W0oDx9SY_zngAcrMCO_0sF773-OxCfL1B-w2IeWlZ_g,79
54
53
  pyosis/material/interface.py,sha256=SiHWjLPUDR1f3EMObGlYQUlKgpfoh1VuGJgVAQfariA,5729
55
- pyosis/material/manager.py,sha256=4LlZ6B7ZWrmscru8cThxsZ7eKgTHGxbKSqAG9WLf8KA,17161
54
+ pyosis/material/manager.py,sha256=J4aDa_IsSBXvRK6r8WQl7bQqhGw3Tn7R_ck8VFI-VCM,17087
56
55
  pyosis/node/__init__.py,sha256=6BKMR_HhFuvf-wr_U1H4njEj95pqgiHh6ApFl2JWMQ0,71
57
56
  pyosis/node/interface.py,sha256=T0lL1pHD069Qw3PTxufUF6cJl9fAKiclAL_ISgboaz8,1208
58
- pyosis/node/manager.py,sha256=pyCGHbIzAPaSKEseDOTBKlQbhz781y5h0jSH6UJH5qM,9598
57
+ pyosis/node/manager.py,sha256=5Cj3oFmadWl1KnO_zaWI3KqR73eBTiOlXebdBG1wliA,9612
59
58
  pyosis/post/__init__.py,sha256=Zh8Jvy6715tCZxwlTfV86-8cyh0OqqK2vCTlG_VARYY,120
60
59
  pyosis/post/combine.py,sha256=0EajaRAJK3d_rkW7t9Cmxc4wHM87TOBYroWnnBK2ldM,4587
61
60
  pyosis/post/design_check.py,sha256=vJzpu63yBjU4QDUIxvLOhUvqPrZ56q301ADCgHdu0eA,11257
@@ -83,7 +82,7 @@ pyosis/result/result.py,sha256=wUyRaHSwyijLpodWIHPFQVEOn6LP8MfYp7xLhC-RiIo,1194
83
82
  pyosis/section/__init__.py,sha256=VjNbQWgWHtLO6la39oXgbQMnQPR0-b1DPIM52Cj--jg,179
84
83
  pyosis/section/common.py,sha256=yI61YQH8btfkoBGnXF7wp3kFhZVW06XABIJZnvkDk3E,26616
85
84
  pyosis/section/composite.py,sha256=CWNcPagXbL4D8uUouRk8ux7Xv41bE2dXM8JfWX77pBI,9353
86
- pyosis/section/manager.py,sha256=UYhp6f1Ro6lJALVP_UsY6Y01i7AO3xV-B3fce74RAMo,93629
85
+ pyosis/section/manager.py,sha256=avJMoJX8_A11XmmTZj9Wo-sKZFoidE7cFIjLh-xmHI4,94050
87
86
  pyosis/section/numeric.py,sha256=lDO1KvSTmzBE56wkfDw5xxDhWi-kM0szXPx6CIymIyQ,1479
88
87
  pyosis/section/param.py,sha256=E4ZyJqyPn1xhNchb82ar6K36a_ah8R_66-FruOMlbBM,4944
89
88
  pyosis/section/rebar.py,sha256=9ibcOoMd7HYfzSaO6dMpZFwp1ugmwayOmDqIoWUijNc,8337
@@ -110,7 +109,7 @@ pyosis/transfer/out_to_python.py,sha256=69UnwkmkQiAZvpB0RLZqXlj9I0hItWgvTZRY5dWN
110
109
  pyosis/transfer/parser.py,sha256=R_aBlYJTe53hD1sX5PBv86bhj88NQwANFRN4pGYudQ8,6774
111
110
  pyosis/transfer/routes.py,sha256=fBHDt53F5YxNpttPwW_jm6bjxcW7T1P8WAiEv7Xn90E,12748
112
111
  pyosis/transfer/split.py,sha256=hpBe9D9WbjbKsovx4hM3X5RjTrruWNkuFmZt2ed0fME,1284
113
- osis_python-0.8.0.dist-info/METADATA,sha256=oyyg_e4lH3Ezfg6FFSpKiIwWOU7ii6RYwKH00akUb30,20441
114
- osis_python-0.8.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
115
- osis_python-0.8.0.dist-info/top_level.txt,sha256=6VDNySkQKwipRXcN8ayKVci4vAXi4oPyWLqFhNVcIfM,7
116
- osis_python-0.8.0.dist-info/RECORD,,
112
+ osis_python-0.8.1.dist-info/METADATA,sha256=n0GoiJjlf4be7ICALw-laiyKnWucMfB6x6tmmqVYVQk,22376
113
+ osis_python-0.8.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
114
+ osis_python-0.8.1.dist-info/top_level.txt,sha256=6VDNySkQKwipRXcN8ayKVci4vAXi4oPyWLqFhNVcIfM,7
115
+ osis_python-0.8.1.dist-info/RECORD,,
pyosis/__init__.py CHANGED
@@ -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.8.0"
10
+ __version__ = "0.8.1"
11
11
 
12
12
  from .core.engine import OSISEngine
13
13
  from .core.batch import batch, flush, batch_state, BatchError
@@ -88,7 +88,7 @@ class Boundary:
88
88
  return cls(
89
89
  no=as_no(d.get("no")),
90
90
  name=as_name(d.get("name")),
91
- boundary_type=BoundaryType(raw_type) if raw_type in [t.value for t in BoundaryType] else BoundaryType.GENERAL,
91
+ boundary_type=BoundaryType.of(raw_type),
92
92
  entity_vec=list(d.get("entityVec") or []),
93
93
  is_occupied=d.get("isOccupied"),
94
94
  is_selected=d.get("isSelected"),
pyosis/core/__init__.py CHANGED
@@ -19,8 +19,10 @@ from .enums import (
19
19
  OsisEnum,
20
20
  ElementType, BoundaryType, MaterialType, MaterialCode,
21
21
  SectionType, LoadCaseType, SplineType, TensionType,
22
+ LiveGradeType,
22
23
  element_type_name, boundary_type_name, material_type_name,
23
24
  material_code_name, section_type_name, loadcase_type_name,
25
+ spline_type_name, live_grade_name,
24
26
  DOF_NAMES, constraints_to_dict,
25
27
  )
26
28
  from .normalize import as_no, as_name
pyosis/core/enums.py CHANGED
@@ -26,6 +26,7 @@ class OsisEnum(IntEnum):
26
26
 
27
27
  - ``str(e)`` / ``e.name`` → OSIS 命令流写法(成员名)
28
28
  - ``name_of(code)`` → 编码转名字;未知编码或 Unassigned 返回 ""
29
+ - ``of(code)`` → 编码转成员;未知编码退回 Unassigned
29
30
  """
30
31
 
31
32
  def __str__(self) -> str:
@@ -34,11 +35,16 @@ class OsisEnum(IntEnum):
34
35
  @classmethod
35
36
  def name_of(cls, code, default: str = "") -> str:
36
37
  """编码 → OSIS 命令流写法;未知编码 / Unassigned 返回 default。"""
38
+ member = cls.of(code)
39
+ return default if member.name == "Unassigned" else member.name
40
+
41
+ @classmethod
42
+ def of(cls, code):
43
+ """编码 → 成员;未知编码 / None → Unassigned(所有子类都定义了它)。"""
37
44
  try:
38
- member = cls(int(code))
45
+ return cls(int(code))
39
46
  except (ValueError, TypeError):
40
- return default
41
- return default if member.name == "Unassigned" else member.name
47
+ return cls.Unassigned
42
48
 
43
49
 
44
50
  # ══════════════════════════════════════════════
@@ -219,10 +225,7 @@ class SectionType(OsisEnum):
219
225
 
220
226
 
221
227
  class LoadCaseType(OsisEnum):
222
- """荷载工况类型(PrepEnum::LoadCase)
223
-
224
- 32=温度、40=施工阶段荷载、52=温度梯度。
225
- """
228
+ """荷载工况类型(PrepEnum::LoadCase)"""
226
229
  Unassigned = 0
227
230
  USER = 1 # 用户自定义荷载
228
231
  D = 2 # 恒荷载
@@ -240,7 +243,7 @@ class LoadCaseType(OsisEnum):
240
243
  LP = 14 # 超载
241
244
  IL = 15 # 汽车冲击力
242
245
  ILP = 16 # 超载冲击力
243
- CF = 17 # 离心力
246
+ CF = 17 # 汽车离心力
244
247
  BRK = 18 # 汽车制动力
245
248
  BK = 19 # 活荷载引起的纵向内力
246
249
  PL = 20 # 人群荷载
@@ -270,34 +273,44 @@ class LoadCaseType(OsisEnum):
270
273
  LR = 44 # 屋面活荷载
271
274
  S = 45 # 雪荷载
272
275
  R = 46 # 雨荷载
273
- W1 = 47 # 风荷载
274
- W2 = 48 # 风荷载
275
- WF1 = 49 # 波浪力
276
- WF2 = 50 # 波浪力
277
- FL = 51
278
- TG = 52
279
- CFS = 53
280
- CFV = 54
281
- IF = 55
282
- CRL = 56
283
- CFD = 57
276
+ W1 = 47 # 活载风
277
+ W2 = 48 # 极限风
278
+ WF1 = 49 # W1 引起的浪
279
+ WF2 = 50 # W2 引起的浪
280
+ FL = 51 # 疲劳荷载
281
+ TG = 52 # 梯度温度
282
+ CFS = 53 # 船舶的撞击作用
283
+ CFV = 54 # 汽车撞击作用
284
+ IF = 55 # 汽车冲击力
285
+ CRL = 56 # 人群荷载
286
+ CFD = 57 # 漂流物的撞击作用
284
287
 
285
288
  UNASSIGNED = 0 # 兼容旧拼写
286
289
 
287
290
 
288
- class SplineType(IntEnum):
289
- """样条曲线类型(钢束线型定义,本地分类用,非 PrepEnum 打印名)"""
290
- Unassigned = 0 # 未分配
291
- General = 1 # 一般边界
292
- Natural = 2 # 自然边界
293
- Arc3D = 3 # 3D圆弧
294
- Arc2D = 4 # 2D圆弧
291
+ class SplineType(OsisEnum):
292
+ """样条曲线类型(PropEnum::Spline)
293
+ 0 = 未分配;名字即 spline3d 命令的类型写法。
294
+ """
295
+ Unassigned = 0
296
+ GENERAL = 1 # 一般边界
297
+ NATURAL = 2 # 自然边界
298
+ ARC3D = 3 # 3D 圆弧
299
+ ARC2D = 4 # 2D 圆弧
295
300
 
296
301
  UNASSIGNED = 0 # 兼容旧拼写
302
+ General = 1 # 兼容旧命名
303
+ Natural = 2 # 兼容旧命名
304
+ Arc3D = 3 # 兼容旧命名
305
+ Arc2D = 4 # 兼容旧命名
297
306
 
298
307
 
299
- class TensionType(IntEnum):
300
- """钢束张拉方式(钢束特性,本地分类用,非 PrepEnum 打印名)"""
308
+ class TensionType(OsisEnum):
309
+ """钢束张拉方式(LoadEnum::TensionType)
310
+
311
+ 不是命令流写法——C++ 用它区分先张/后张的类继承,print name 为空,
312
+ 名字只在 Python 侧做分类。
313
+ """
301
314
  Unassigned = 0
302
315
  Pre = 1 # 先张法
303
316
  In = 2 # 后张法(体内)
@@ -306,6 +319,35 @@ class TensionType(IntEnum):
306
319
  UNASSIGNED = 0 # 兼容旧拼写
307
320
 
308
321
 
322
+ class LiveGradeType(OsisEnum):
323
+ """活载等级(LoadEnum::LiveGrade)"""
324
+ Unassigned = 0
325
+ HIGHWAY_I = 1 # 公路-I 级(车道荷载)
326
+ HIGHWAY_II = 2 # 公路-II 级(车道荷载)
327
+ VEHICLE = 3 # 车辆荷载
328
+ CROWD = 4 # 人群荷载
329
+ FATIGUE_I = 5 # 疲劳荷载 I
330
+ FATIGUE_II = 6 # 疲劳荷载 II
331
+ FATIGUE_III = 7 # 疲劳荷载 III
332
+ UF = 8
333
+ V = 9
334
+ VG = 10
335
+ NHWCD = 11
336
+ NHWRQ = 12
337
+ OHWRQ = 13
338
+ CCD_A = 14 # 城-车道 A
339
+ CCD_B = 15 # 城-车道 B
340
+ CCL_A = 16 # 城-车辆 A
341
+ CCL_B = 17 # 城-车辆 B
342
+ CT160 = 18
343
+ CT220 = 19
344
+ CT300 = 20
345
+ CT420 = 21
346
+ CRQ = 22 # 城-人群
347
+
348
+ UNASSIGNED = 0 # 兼容旧拼写
349
+
350
+
309
351
  # ══════════════════════════════════════════════
310
352
  # 便捷函数(等价于 XxxType.name_of)
311
353
  # ══════════════════════════════════════════════
@@ -316,6 +358,8 @@ material_type_name = MaterialType.name_of
316
358
  material_code_name = MaterialCode.name_of
317
359
  section_type_name = SectionType.name_of
318
360
  loadcase_type_name = LoadCaseType.name_of
361
+ spline_type_name = SplineType.name_of
362
+ live_grade_name = LiveGradeType.name_of
319
363
 
320
364
 
321
365
  # ══════════════════════════════════════════════
@@ -343,7 +387,9 @@ __all__ = [
343
387
  "OsisEnum",
344
388
  "ElementType", "BoundaryType", "MaterialType", "MaterialCode",
345
389
  "SectionType", "LoadCaseType", "SplineType", "TensionType",
390
+ "LiveGradeType",
346
391
  "element_type_name", "boundary_type_name", "material_type_name",
347
392
  "material_code_name", "section_type_name", "loadcase_type_name",
393
+ "spline_type_name", "live_grade_name",
348
394
  "DOF_NAMES", "constraints_to_dict",
349
395
  ]
pyosis/core/normalize.py CHANGED
@@ -14,20 +14,23 @@ _SENTINEL = -1
14
14
 
15
15
 
16
16
  def as_no(value):
17
- """编号归一:None / -1 / "-1" → None,其余原样返回。"""
17
+ """编号归一:None / -1 / -1.0 / "-1" / "-1.0" → None,其余原样返回。"""
18
18
  if value is None:
19
19
  return None
20
+ if isinstance(value, bool): # bool 是 int 子类,先排掉
21
+ return value
20
22
  if isinstance(value, str):
21
23
  s = value.strip()
22
- if s in ("", "-1"):
24
+ if not s:
23
25
  return None
24
26
  try:
25
27
  value = int(s)
26
28
  except ValueError:
27
- return value
28
- if isinstance(value, bool): # bool 是 int 子类,先排掉
29
- return value
30
- if isinstance(value, int) and value == _SENTINEL:
29
+ try:
30
+ value = float(s)
31
+ except ValueError:
32
+ return value # 非数值字符串:原样返回
33
+ if isinstance(value, (int, float)) and value == _SENTINEL:
31
34
  return None
32
35
  return value
33
36
 
pyosis/element/manager.py CHANGED
@@ -107,7 +107,7 @@ class Element:
107
107
  raw_type = int(d.get("type"))
108
108
  return cls(
109
109
  no=d.get("no"),
110
- element_type=ElementType(raw_type) if raw_type in [t.value for t in ElementType] else ElementType.UNASSIGNED,
110
+ element_type=ElementType.of(raw_type),
111
111
  mat=d.get("mat"),
112
112
  node_vec=d.get("nodeVec"),
113
113
  node_i=d.get("nodeI"),
@@ -104,7 +104,7 @@ class Spline:
104
104
  ])
105
105
  return result
106
106
 
107
- spline_type = SplineType(d.get("splineType"))
107
+ spline_type = SplineType.of(d.get("splineType"))
108
108
  points_raw = d.get("points")
109
109
  points = _extract_points(points_raw, spline_type) if points_raw else None
110
110
 
pyosis/live/__init__.py CHANGED
@@ -2,4 +2,3 @@ from .grade import *
2
2
  from .analysis import *
3
3
  from .lane import *
4
4
  from .manager import live_manager, LiveManager
5
- from .vehicle import vehicle_manager, VehicleManager
pyosis/live/manager.py CHANGED
@@ -44,25 +44,21 @@ from .lane import (
44
44
  osis_lane_mod,
45
45
  )
46
46
  from ..core.normalize import as_no, as_name
47
+ from ..core.enums import LiveGradeType, live_grade_name
47
48
 
48
49
 
49
50
  # ──────────────────────────────────────────────
50
- # 活载等级 / 自定义活载类型编码(PrepEnum::LoadEnum)
51
+ # 活载等级编码(别名,取值见 core.enums)
51
52
  # ──────────────────────────────────────────────
52
53
 
53
- LIVE_GRADE_UNASSIGNED = 0
54
- LIVE_GRADE_HIGHWAY_I = 1
55
- LIVE_GRADE_HIGHWAY_II = 2
56
- LIVE_GRADE_VEHICLE = 3
57
- LIVE_GRADE_CROWD = 4
58
- LIVE_GRADE_FATIGUE_I = 5
59
- LIVE_GRADE_FATIGUE_II = 6
60
- LIVE_GRADE_FATIGUE_III = 7
61
-
62
- LIVE_TYPE_CUSTOM_UNASSIGNED = 0
63
- LIVE_TYPE_CUSTOM_VEHICLE = 1
64
- LIVE_TYPE_CUSTOM_TRAIN = 2
65
- LIVE_TYPE_CUSTOM_CROWD = 3
54
+ LIVE_GRADE_UNASSIGNED = int(LiveGradeType.Unassigned)
55
+ LIVE_GRADE_HIGHWAY_I = int(LiveGradeType.HIGHWAY_I)
56
+ LIVE_GRADE_HIGHWAY_II = int(LiveGradeType.HIGHWAY_II)
57
+ LIVE_GRADE_VEHICLE = int(LiveGradeType.VEHICLE)
58
+ LIVE_GRADE_CROWD = int(LiveGradeType.CROWD)
59
+ LIVE_GRADE_FATIGUE_I = int(LiveGradeType.FATIGUE_I)
60
+ LIVE_GRADE_FATIGUE_II = int(LiveGradeType.FATIGUE_II)
61
+ LIVE_GRADE_FATIGUE_III = int(LiveGradeType.FATIGUE_III)
66
62
 
67
63
 
68
64
  # ──────────────────────────────────────────────
@@ -73,18 +69,18 @@ LIVE_TYPE_CUSTOM_CROWD = 3
73
69
  @dataclass(frozen=True)
74
70
  class LiveGrade:
75
71
  """活载等级对象
76
-
72
+
77
73
  对应接口 GetAllLiveGradeInfo / GetGradeInfoByNames 返回的数据。
78
74
  活载等级定义了车辆荷载、人群荷载、疲劳荷载等的规范参数。
75
+ 车辆只是其中一种等级(grade == LiveGradeType.VEHICLE),没有独立的车辆实体。
79
76
  """
80
77
  no: int # 编号
81
78
  name: str # 名称
82
79
  code: int # 规范代码
83
- grade: int # 等级代码(如 HIGHWAY_I=1, HIGHWAY_II=2, VEHICLE=3)
80
+ grade: int # 等级代码(如 HIGHWAY_I=1, HIGHWAY_II=2, VEHICLE=3),取名用 grade_name
84
81
  crowd_bridge_type: int # 人群荷载桥型
85
82
  crowd_width: float # 人群横向宽度(m)
86
83
  fatigue_ii_veichle_center_dis: float # 疲劳II模型车辆中心间距(m)
87
- live_type_for_custom: int = 0 # 自定义活载类型(0 未定义 / 1 车辆 / 2 列车 / 3 人群)
88
84
  related_live_anal: list[str] = field(default_factory=list) # 关联的活载分析名称列表
89
85
  related_stages: list[int] = field(default_factory=list) # 关联的施工阶段编号列表
90
86
  custom_layout: list[list[float]] = field(default_factory=list) # 自定义布载矩阵
@@ -95,14 +91,9 @@ class LiveGrade:
95
91
  code_data_fatigueIII_4x2: list[list[float]] = field(default_factory=list) # 疲劳III模型 4x2 矩阵
96
92
 
97
93
  @property
98
- def is_vehicle(self) -> bool:
99
- """是否代表“车辆”(OSIS 里没有独立车辆实体,车辆 = 活载等级)。
100
-
101
- 判据与 C++ 侧一致:grade == VEHICLE(3),或自定义活载类型为车辆/列车。
102
- """
103
- return self.grade == LIVE_GRADE_VEHICLE or self.live_type_for_custom in (
104
- LIVE_TYPE_CUSTOM_VEHICLE, LIVE_TYPE_CUSTOM_TRAIN,
105
- )
94
+ def grade_name(self) -> str:
95
+ """活载等级名(OSIS 写法,如 "HIGHWAY_I" / "VEHICLE");未知编码返回 ""。"""
96
+ return live_grade_name(self.grade)
106
97
 
107
98
  @classmethod
108
99
  def _from_dict(cls, d: dict) -> LiveGrade:
@@ -115,7 +106,6 @@ class LiveGrade:
115
106
  crowd_bridge_type=d.get("crowdBridgeType"),
116
107
  crowd_width=d.get("crowdWidth"),
117
108
  fatigue_ii_veichle_center_dis=d.get("fatigueIIVeichleCenterDis"),
118
- live_type_for_custom=d.get("liveTypeForCustom") or 0,
119
109
  related_live_anal=d.get("relatedLiveAnal") or [],
120
110
  related_stages=d.get("relatedStages") or [],
121
111
  custom_layout=d.get("customLayout") or [],
@@ -1283,7 +1273,6 @@ class LiveManager:
1283
1273
  - ``grade``: 活载等级管理器(LiveGradeManager)
1284
1274
  - ``lane``: 车道管理器(LaneManager)
1285
1275
  - ``case``: 活载工况管理器(LiveCaseManager)
1286
- - ``vehicle``: 车辆管理器(VehicleManager,活载等级中属于车辆的视图)
1287
1276
 
1288
1277
  用法示例::
1289
1278
 
@@ -1304,12 +1293,6 @@ class LiveManager:
1304
1293
  self._grade_manager = LiveGradeManager()
1305
1294
  self._lane_manager = LaneManager()
1306
1295
  self._case_manager = LiveCaseManager()
1307
- self._vehicle_manager = VehicleManager()
1308
-
1309
- @property
1310
- def vehicle(self) -> "VehicleManager":
1311
- """车辆管理器(车辆 = 活载等级中属于车辆/列车的子集)"""
1312
- return self._vehicle_manager
1313
1296
 
1314
1297
  @property
1315
1298
  def grade(self) -> LiveGradeManager:
@@ -1381,10 +1364,6 @@ class LiveManager:
1381
1364
  return f"LiveManager()"
1382
1365
 
1383
1366
 
1384
- # vehicle.py 反向依赖本模块的 LiveGrade 与编码常量,在单例创建前导入可避免循环导入
1385
- from .vehicle import VehicleManager # noqa: E402
1386
-
1387
-
1388
1367
  # ──────────────────────────────────────────────
1389
1368
  # 全局单例
1390
1369
  # ──────────────────────────────────────────────
pyosis/load/manager.py CHANGED
@@ -962,7 +962,7 @@ class TendonProp:
962
962
  """从接口 dict 构造 TendonProp 对象(内部使用)"""
963
963
  return cls(
964
964
  name=d.get("name"),
965
- tension_type=TensionType(d.get("tensionType")),
965
+ tension_type=TensionType.of(d.get("tensionType")),
966
966
  tendon_mat_no=d.get("tendonMatNO"),
967
967
  area=d.get("area"),
968
968
  code=d.get("code"),
@@ -69,7 +69,7 @@ class Material:
69
69
  return cls(
70
70
  no=as_no(d.get("no")),
71
71
  name=as_name(d.get("name")),
72
- material_type=MaterialType(raw_type) if raw_type in [t.value for t in MaterialType] else MaterialType.UNASSIGNED ,
72
+ material_type=MaterialType.of(raw_type),
73
73
  code=d.get("code"),
74
74
  grade=d.get("grade"),
75
75
  e=d.get("e"),
pyosis/node/manager.py CHANGED
@@ -129,7 +129,7 @@ class NodeManager(BasicManager):
129
129
  return {
130
130
  d["id"]: (d.get("x", 0.0), d.get("y", 0.0), d.get("z", 0.0))
131
131
  for d in resp.get("data") or []
132
- if isinstance(d, dict) and "id" in d
132
+ if isinstance(d, dict) and d.get("id") is not None
133
133
  }
134
134
 
135
135
  # ── 增删改 ────────────────────────────────
pyosis/section/manager.py CHANGED
@@ -94,6 +94,7 @@ class Rebar:
94
94
  has_web_vertical_rebar: bool # 是否有腹板竖筋
95
95
  longitudinal_rebars: list[dict] # 纵筋
96
96
  longitudinal_rebars_count: int # 纵筋数量
97
+ section_no: int | None = None # 所属截面编号
97
98
  @staticmethod
98
99
  def empty() -> Rebar:
99
100
  """无钢筋信息时的占位对象(内部使用)"""
@@ -106,8 +107,12 @@ class Rebar:
106
107
  longitudinal_rebars_count=0,
107
108
  )
108
109
  @classmethod
109
- def _from_dict(cls, d: dict) -> Rebar:
110
- """从接口 dict 构造 Rebar 对象(内部使用)"""
110
+ def _from_dict(cls, d: dict, section_no: int | None = None) -> Rebar:
111
+ """从接口 dict 构造 Rebar 对象(内部使用)
112
+
113
+ section_no: 所属截面编号。从截面接口取值时由调用方给出;
114
+ all_longitudinal_rebar() 走轻量接口,取 JSON 自带的 "no"。
115
+ """
111
116
  lr = d.get("longitudinalRebars")
112
117
  cnt = d.get("longitudinalRebarsCount")
113
118
  return cls(
@@ -117,6 +122,7 @@ class Rebar:
117
122
  has_web_vertical_rebar=bool(d.get("hasWebVerticalRebar")),
118
123
  longitudinal_rebars=list(lr) if isinstance(lr, list) else [],
119
124
  longitudinal_rebars_count=int(cnt) if cnt is not None else 0,
125
+ section_no=section_no if section_no is not None else as_no(d.get("no")),
120
126
  )
121
127
 
122
128
  # Section 基类
@@ -164,15 +170,16 @@ class Section:
164
170
  sp = d.get("stressPoints")
165
171
  ct = d.get("contour")
166
172
  rel = d.get("relatedElement")
173
+ sec_no = as_no(d.get("no"))
167
174
  raw_rebar = d.get("rebar")
168
175
  if isinstance(raw_rebar, dict):
169
- rebar_obj = Rebar._from_dict(raw_rebar)
176
+ rebar_obj = Rebar._from_dict(raw_rebar, sec_no)
170
177
  else:
171
178
  rebar_obj = Rebar.empty()
172
179
  return cls(
173
180
  no=as_no(d.get("no")),
174
181
  name=as_name(d.get("name")),
175
- section_type=SectionType(raw_type) if raw_type in [t.value for t in SectionType] else SectionType.UNASSIGNED,
182
+ section_type=SectionType.of(raw_type),
176
183
  prop=d.get("prop"),
177
184
  offset_type_y=d.get("offsetTypeY"),
178
185
  offset_value_y=d.get("offsetValueY"),
@@ -1095,8 +1102,9 @@ class SectionManager(BasicManager):
1095
1102
  def all_longitudinal_rebar(self) -> list[Rebar]:
1096
1103
  """获取所有截面的纵向钢筋信息(走 GetAllLongitudinalRebarInfo 端点)
1097
1104
 
1098
- 按截面内部映射顺序返回,与 all() 相比数据更轻量——
1099
- 只有钢筋标志位与纵筋明细,不含截面几何/属性。
1105
+ 数据更轻量——只有钢筋标志位与纵筋明细,不含截面几何/属性。
1106
+ 每一项的 section_no 指出所属截面;服务端尚未在响应里带截面编号时
1107
+ 该字段为 None,只能按返回顺序对应截面。
1100
1108
 
1101
1109
  Returns:
1102
1110
  list[Rebar]: 各截面的钢筋信息列表
pyosis/live/vehicle.py DELETED
@@ -1,121 +0,0 @@
1
- """车辆管理器 —— OSIS 里没有独立的“车辆”实体,车辆就是活载等级。
2
-
3
- osisPREP 只有 LiveGradeInfo,没有 VehicleInfo。所以“车辆”= 活载等级中
4
- 属于车辆/列车的那部分,判据与 C++ 侧一致:
5
-
6
- grade == LiveGrade::VEHICLE(3)
7
- 或 liveTypeForCustom ∈ {VEHICLE(1), TRAIN(2)} (自定义车辆 / 列车)
8
-
9
- 数据来源两个:
10
- - /GetAllGradeInfo —— 活载等级表(主来源)
11
- - /GetAllLiveInfo —— 活载工况的 subLoadCases[].liveGrade / liveGradeEnum
12
-
13
- 用法:
14
- from pyosis.live import vehicle_manager
15
- vehicle_manager.names() # 所有车辆名
16
- vehicle_manager.all() # LiveGrade 对象列表
17
- vehicle_manager.names_in_use() # 活载工况里实际用到的车辆名
18
- """
19
-
20
- from __future__ import annotations
21
-
22
- from ..core.client import osis_client
23
- from .manager import (
24
- LiveGrade,
25
- LIVE_GRADE_VEHICLE,
26
- LIVE_TYPE_CUSTOM_VEHICLE,
27
- LIVE_TYPE_CUSTOM_TRAIN,
28
- )
29
-
30
-
31
- class VehicleManager:
32
- """车辆管理器(活载等级中属于车辆的视图)"""
33
-
34
- # ── 数据加载 ──────────────────────────────
35
-
36
- def _load_grades(self) -> list[LiveGrade]:
37
- """拉取全部活载等级(未过滤)"""
38
- resp = osis_client("GetAllGradeInfo", {})
39
- if not resp.get("success"):
40
- raise RuntimeError(f"{resp.get('error', 'GetAllGradeInfo 失败')}")
41
- return [
42
- LiveGrade._from_dict(d)
43
- for d in resp.get("data", [])
44
- if isinstance(d, dict) and "name" in d
45
- ]
46
-
47
- def all(self) -> list[LiveGrade]:
48
- """所有车辆(活载等级里属于车辆/列车的)
49
-
50
- Returns:
51
- list[LiveGrade]: 车辆活载等级列表
52
-
53
- Raises:
54
- RuntimeError: 查询失败时抛出异常
55
- """
56
- return [g for g in self._load_grades() if g.is_vehicle]
57
-
58
- def names(self) -> list[str]:
59
- """所有车辆的名称"""
60
- return [g.name for g in self.all()]
61
-
62
- def get(self, name: str | list[str]) -> LiveGrade | list[LiveGrade | None] | None:
63
- """按名称获取车辆(同样的名称语义:不存在返回 None)
64
-
65
- Args:
66
- name: 单个名称或名称列表
67
-
68
- Returns:
69
- LiveGrade / list[LiveGrade | None] / None
70
- """
71
- names = [name] if isinstance(name, str) else list(name)
72
- by_name = {g.name: g for g in self.all()}
73
- found = [by_name.get(n) for n in names]
74
- if len(found) == 1:
75
- return found[0]
76
- return found
77
-
78
- def count(self) -> int:
79
- """车辆总数"""
80
- return len(self.all())
81
-
82
- # ── 工况中实际使用 ────────────────────────
83
-
84
- def names_in_use(self) -> list[str]:
85
- """活载工况里实际引用到的车辆名(去重,保持出现顺序)。
86
-
87
- 来源 /GetAllLiveInfo 的 subLoadCases[].liveGrade / liveGradeEnum,
88
- 与活载等级表的车辆判据交叉验证,避免把人群/疲劳等级误算进来。
89
- """
90
- vehicle_names = set(self.names())
91
- resp = osis_client("GetAllLiveInfo", {})
92
- if not resp.get("success"):
93
- raise RuntimeError(f"{resp.get('error', 'GetAllLiveInfo 失败')}")
94
-
95
- out: list[str] = []
96
- seen: set[str] = set()
97
- for case in resp.get("data") or []:
98
- if not isinstance(case, dict):
99
- continue
100
- for sub in case.get("subLoadCases") or []:
101
- if not isinstance(sub, dict):
102
- continue
103
- name = sub.get("liveGrade")
104
- enum = sub.get("liveGradeEnum")
105
- if not name:
106
- continue
107
- if enum == LIVE_GRADE_VEHICLE or name in vehicle_names:
108
- if name not in seen:
109
- seen.add(name)
110
- out.append(name)
111
- return out
112
-
113
- def __repr__(self) -> str:
114
- return "VehicleManager()"
115
-
116
-
117
- # ──────────────────────────────────────────────
118
- # 全局单例
119
- # ──────────────────────────────────────────────
120
-
121
- vehicle_manager = VehicleManager()