osis-python 0.9.0__tar.gz → 0.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {osis_python-0.9.0/src/osis_python.egg-info → osis_python-0.9.2}/PKG-INFO +3 -4
- {osis_python-0.9.0 → osis_python-0.9.2}/README.md +2 -3
- {osis_python-0.9.0 → osis_python-0.9.2/src/osis_python.egg-info}/PKG-INFO +3 -4
- {osis_python-0.9.0 → osis_python-0.9.2}/src/osis_python.egg-info/SOURCES.txt +1 -2
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/__init__.py +1 -1
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/control/manager.py +2 -3
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/live/manager.py +35 -20
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/property/manager.py +0 -4
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/result/routes.py +2 -2
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/composite.py +2 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/manager.py +32 -13
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/stage/define.py +6 -3
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/stage/manager.py +9 -3
- osis_python-0.9.2/src/pyosis/transfer/generator.py +131 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/transfer/out_to_python.py +3 -44
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/transfer/parser.py +2 -50
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/transfer/routes.py +20 -130
- {osis_python-0.9.0 → osis_python-0.9.2}/tests/test_manager_field_layout.py +39 -2
- osis_python-0.9.2/tests/test_transfer.py +170 -0
- osis_python-0.9.0/src/pyosis/transfer/generator.py +0 -172
- osis_python-0.9.0/src/pyosis/transfer/introspect.py +0 -149
- osis_python-0.9.0/tests/test_transfer_fixups.py +0 -193
- {osis_python-0.9.0 → osis_python-0.9.2}/LICENSE +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/pyproject.toml +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/setup.cfg +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/osis_python.egg-info/dependency_links.txt +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/osis_python.egg-info/requires.txt +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/osis_python.egg-info/top_level.txt +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/boundary/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/boundary/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/boundary/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/control/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/control/control.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/control/io.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/control/nonlinear.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/all_func.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/apdl_sync.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/basic_manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/batch.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/client.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/command.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/engine.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/enums.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/exceptions.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/normalize.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/references.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/sdk.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/solver.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/core/sync_apdl_cli.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/display/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/display/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/display/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/dynamic/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/dynamic/load_to_mass.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/dynamic/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/dynamic/modal.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/dynamic/seismic.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/element/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/element/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/element/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/general/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/general/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/geometry/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/geometry/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/geometry/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/live/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/live/analysis.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/live/grade.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/live/lane.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/load/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/load/environmental.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/load/loadcase.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/load/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/load/static.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/load/tendon.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/material/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/material/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/material/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/node/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/node/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/node/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/post/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/post/combine.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/post/design_check.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/post/display.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/post/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/project/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/project/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/project/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/property/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/property/component_thickness.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/property/coordinate.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/property/creep_shrink.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/property/damping.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/property/pu_curve.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/property/strength_prog.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/quick_building/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/quick_building/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/result/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/result/check.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/result/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/common.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/numeric.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/param.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/rebar.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/rib.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/shaped_steel.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/section/steel.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/settlement/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/settlement/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/settlement/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/stability/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/stability/buckling.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/stability/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/stage/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/stage/overall.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/thickness/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/thickness/interface.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/thickness/manager.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/transfer/__init__.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/transfer/matrix.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/src/pyosis/transfer/split.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/tests/test_batch.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/tests/test_delete_occupied.py +0 -0
- {osis_python-0.9.0 → osis_python-0.9.2}/tests/test_project_manager.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: osis-python
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
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
|
|
@@ -252,8 +252,7 @@ shape = engine.tendon.shape.create_arc3d(
|
|
|
252
252
|
|
|
253
253
|
# 活载:等级 -> 车道 -> 工况
|
|
254
254
|
engine.live.grade.create_highway("公路I级", code="JTGD60_2015", live_load_type="HIGHWAY_I")
|
|
255
|
-
engine.live.lane.create_ve("车道",
|
|
256
|
-
ref=0, ref_elems="主梁单元", offset_y=0.0, offset_z=0.0)
|
|
255
|
+
engine.live.lane.create_ve("车道", 19.1, 1.8, 1, 0, "主梁单元", 0.0, 0.0)
|
|
257
256
|
lc = engine.live.case.create("车道荷载包络", code="JTGD60_2015", sub_cmb_type=1)
|
|
258
257
|
lc.create_sub("车道荷载工况1", "公路I级", scalar=0.75, calc_mu=True,
|
|
259
258
|
bridge_type="CUSTOM", mu_params=[6.586960], lane_names=["车道"])
|
|
@@ -498,7 +497,7 @@ engine.control.set_calc_shear(True)
|
|
|
498
497
|
engine.control.set_calc_relaxation(True)
|
|
499
498
|
engine.control.set_mod_loc_coor(False)
|
|
500
499
|
engine.control.set_inc_tendon(True)
|
|
501
|
-
engine.control.set_nonlinear(geom=False
|
|
500
|
+
engine.control.set_nonlinear(geom=False)
|
|
502
501
|
|
|
503
502
|
# 截面
|
|
504
503
|
engine.section.create_circle(no=1, name="圆形截面1", d=0.219, tw=0.012)
|
|
@@ -221,8 +221,7 @@ shape = engine.tendon.shape.create_arc3d(
|
|
|
221
221
|
|
|
222
222
|
# 活载:等级 -> 车道 -> 工况
|
|
223
223
|
engine.live.grade.create_highway("公路I级", code="JTGD60_2015", live_load_type="HIGHWAY_I")
|
|
224
|
-
engine.live.lane.create_ve("车道",
|
|
225
|
-
ref=0, ref_elems="主梁单元", offset_y=0.0, offset_z=0.0)
|
|
224
|
+
engine.live.lane.create_ve("车道", 19.1, 1.8, 1, 0, "主梁单元", 0.0, 0.0)
|
|
226
225
|
lc = engine.live.case.create("车道荷载包络", code="JTGD60_2015", sub_cmb_type=1)
|
|
227
226
|
lc.create_sub("车道荷载工况1", "公路I级", scalar=0.75, calc_mu=True,
|
|
228
227
|
bridge_type="CUSTOM", mu_params=[6.586960], lane_names=["车道"])
|
|
@@ -467,7 +466,7 @@ engine.control.set_calc_shear(True)
|
|
|
467
466
|
engine.control.set_calc_relaxation(True)
|
|
468
467
|
engine.control.set_mod_loc_coor(False)
|
|
469
468
|
engine.control.set_inc_tendon(True)
|
|
470
|
-
engine.control.set_nonlinear(geom=False
|
|
469
|
+
engine.control.set_nonlinear(geom=False)
|
|
471
470
|
|
|
472
471
|
# 截面
|
|
473
472
|
engine.section.create_circle(no=1, name="圆形截面1", d=0.219, tw=0.012)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: osis-python
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
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
|
|
@@ -252,8 +252,7 @@ shape = engine.tendon.shape.create_arc3d(
|
|
|
252
252
|
|
|
253
253
|
# 活载:等级 -> 车道 -> 工况
|
|
254
254
|
engine.live.grade.create_highway("公路I级", code="JTGD60_2015", live_load_type="HIGHWAY_I")
|
|
255
|
-
engine.live.lane.create_ve("车道",
|
|
256
|
-
ref=0, ref_elems="主梁单元", offset_y=0.0, offset_z=0.0)
|
|
255
|
+
engine.live.lane.create_ve("车道", 19.1, 1.8, 1, 0, "主梁单元", 0.0, 0.0)
|
|
257
256
|
lc = engine.live.case.create("车道荷载包络", code="JTGD60_2015", sub_cmb_type=1)
|
|
258
257
|
lc.create_sub("车道荷载工况1", "公路I级", scalar=0.75, calc_mu=True,
|
|
259
258
|
bridge_type="CUSTOM", mu_params=[6.586960], lane_names=["车道"])
|
|
@@ -498,7 +497,7 @@ engine.control.set_calc_shear(True)
|
|
|
498
497
|
engine.control.set_calc_relaxation(True)
|
|
499
498
|
engine.control.set_mod_loc_coor(False)
|
|
500
499
|
engine.control.set_inc_tendon(True)
|
|
501
|
-
engine.control.set_nonlinear(geom=False
|
|
500
|
+
engine.control.set_nonlinear(geom=False)
|
|
502
501
|
|
|
503
502
|
# 截面
|
|
504
503
|
engine.section.create_circle(no=1, name="圆形截面1", d=0.219, tw=0.012)
|
|
@@ -110,7 +110,6 @@ src/pyosis/thickness/interface.py
|
|
|
110
110
|
src/pyosis/thickness/manager.py
|
|
111
111
|
src/pyosis/transfer/__init__.py
|
|
112
112
|
src/pyosis/transfer/generator.py
|
|
113
|
-
src/pyosis/transfer/introspect.py
|
|
114
113
|
src/pyosis/transfer/matrix.py
|
|
115
114
|
src/pyosis/transfer/out_to_python.py
|
|
116
115
|
src/pyosis/transfer/parser.py
|
|
@@ -120,4 +119,4 @@ tests/test_batch.py
|
|
|
120
119
|
tests/test_delete_occupied.py
|
|
121
120
|
tests/test_manager_field_layout.py
|
|
122
121
|
tests/test_project_manager.py
|
|
123
|
-
tests/
|
|
122
|
+
tests/test_transfer.py
|
|
@@ -7,7 +7,7 @@ A library for extending OSIS functionality.
|
|
|
7
7
|
A library that allows users to use CAE with great flexibility.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
-
__version__ = "0.9.
|
|
10
|
+
__version__ = "0.9.2"
|
|
11
11
|
|
|
12
12
|
from .core.engine import OSISEngine
|
|
13
13
|
from .core.batch import batch, flush, batch_state, BatchError
|
|
@@ -288,14 +288,13 @@ class ControlManager:
|
|
|
288
288
|
|
|
289
289
|
# ── 非线性分析 ──────────────────────────────
|
|
290
290
|
|
|
291
|
-
def set_nonlinear(self, geom: Literal[0,1] = 0
|
|
291
|
+
def set_nonlinear(self, geom: Literal[0,1] = 0) -> None:
|
|
292
292
|
'''设置非线性分析控制开关
|
|
293
293
|
|
|
294
|
-
|
|
294
|
+
非线性连接单元由软件在转换时强制考虑。
|
|
295
295
|
|
|
296
296
|
Args:
|
|
297
297
|
geom (int): 是否打开几何非线性(大位移大转角),1=开,0=关
|
|
298
|
-
link (int): 已废弃,仅为兼容旧调用保留
|
|
299
298
|
|
|
300
299
|
Returns:
|
|
301
300
|
None
|
|
@@ -1089,8 +1089,8 @@ class LaneManager(BasicManager):
|
|
|
1089
1089
|
RuntimeError: 创建失败
|
|
1090
1090
|
|
|
1091
1091
|
Examples:
|
|
1092
|
-
>>> live_manager.lane.create("车道1", "VE",
|
|
1093
|
-
>>> live_manager.lane.create("重车道", "TCB",
|
|
1092
|
+
>>> live_manager.lane.create("车道1", "VE", 30.0, 1.8, 1, 0, "主梁", 2.5, 0.0)
|
|
1093
|
+
>>> live_manager.lane.create("重车道", "TCB", "横梁", 30.0, 1.8, 0, 0, "主梁", 0.0, 0.0)
|
|
1094
1094
|
"""
|
|
1095
1095
|
_creator = {
|
|
1096
1096
|
"VE": self.create_ve,
|
|
@@ -1110,14 +1110,13 @@ class LaneManager(BasicManager):
|
|
|
1110
1110
|
wheel: float = 0,
|
|
1111
1111
|
orientation: Literal[-1, 0, 1] = 0,
|
|
1112
1112
|
ref: Literal[0, 1] = 0,
|
|
1113
|
-
|
|
1114
|
-
offset_y: float = 0.0,
|
|
1115
|
-
offset_z: float = 0.0,
|
|
1116
|
-
spline_name: str | None = None,
|
|
1113
|
+
*params: Any,
|
|
1117
1114
|
) -> Lane:
|
|
1118
1115
|
"""创建车道(车道单元法 VE)
|
|
1119
1116
|
|
|
1120
1117
|
适用于主梁为梁单元的桥梁结构,车辆沿纵向路径移动。
|
|
1118
|
+
位置参数与命令流严格对应:
|
|
1119
|
+
InflAlgo, Name, type, length, wheel, vehOri, ref, par1, par2, par3
|
|
1121
1120
|
|
|
1122
1121
|
Args:
|
|
1123
1122
|
name: 车道名称
|
|
@@ -1130,10 +1129,12 @@ class LaneManager(BasicManager):
|
|
|
1130
1129
|
ref: 车道参照方式
|
|
1131
1130
|
- 0: 参照单元组(默认)
|
|
1132
1131
|
- 1: 参照样条曲线
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1132
|
+
*params: 与命令流 par1..par3 一一对应的尾部字段
|
|
1133
|
+
- ref=0: (ref_elems, offset_y, offset_z)
|
|
1134
|
+
ref_elems 为参照纵梁单元组名称,offset_y/offset_z 为局部
|
|
1135
|
+
坐标系下的 Y/Z 偏移量(m)
|
|
1136
|
+
- ref=1: (ref_elems, spline_name)
|
|
1137
|
+
ref_elems 为参照纵梁单元组名称,spline_name 为样条曲线名称
|
|
1137
1138
|
|
|
1138
1139
|
Returns:
|
|
1139
1140
|
创建的 Lane 对象
|
|
@@ -1142,11 +1143,19 @@ class LaneManager(BasicManager):
|
|
|
1142
1143
|
RuntimeError: 参数校验失败或创建失败时抛出
|
|
1143
1144
|
"""
|
|
1144
1145
|
if ref == 0:
|
|
1146
|
+
if len(params) != 3:
|
|
1147
|
+
raise RuntimeError(
|
|
1148
|
+
"ref=0 时尾部参数应为 (ref_elems, offset_y, offset_z)"
|
|
1149
|
+
)
|
|
1150
|
+
ref_elems, offset_y, offset_z = params
|
|
1145
1151
|
if not ref_elems:
|
|
1146
1152
|
raise RuntimeError(f"参照单元组名称 ref_elems 不能为空")
|
|
1147
1153
|
param = [ref_elems, offset_y, offset_z]
|
|
1148
1154
|
else:
|
|
1149
1155
|
# 命令流 eRef=1:ESel, SplineName
|
|
1156
|
+
if len(params) != 2:
|
|
1157
|
+
raise RuntimeError("ref=1 时尾部参数应为 (ref_elems, spline_name)")
|
|
1158
|
+
ref_elems, spline_name = params
|
|
1150
1159
|
if not ref_elems:
|
|
1151
1160
|
raise RuntimeError(f"参照纵梁单元组名称 ref_elems 不能为空")
|
|
1152
1161
|
if not spline_name:
|
|
@@ -1166,14 +1175,13 @@ class LaneManager(BasicManager):
|
|
|
1166
1175
|
wheel: float = 0,
|
|
1167
1176
|
orientation: Literal[-1, 0, 1] = 0,
|
|
1168
1177
|
ref: Literal[0, 1] = 0,
|
|
1169
|
-
|
|
1170
|
-
offset_y: float = 0.0,
|
|
1171
|
-
offset_z: float = 0.0,
|
|
1172
|
-
spline_name: str | None = None,
|
|
1178
|
+
*params: Any,
|
|
1173
1179
|
) -> Lane:
|
|
1174
1180
|
"""创建车道(横向联系梁法 TCB)
|
|
1175
1181
|
|
|
1176
1182
|
适用于由主梁+横梁组成的空间传力结构,荷载先分配给横梁再传递至主梁。
|
|
1183
|
+
位置参数与命令流严格对应:
|
|
1184
|
+
InflAlgo, Name, type, ESel, length, wheel, vehOri, ref, par1, par2, par3, par4
|
|
1177
1185
|
|
|
1178
1186
|
Args:
|
|
1179
1187
|
name: 车道名称
|
|
@@ -1187,10 +1195,9 @@ class LaneManager(BasicManager):
|
|
|
1187
1195
|
ref: 车道参照方式
|
|
1188
1196
|
- 0: 参照单元组(默认)
|
|
1189
1197
|
- 1: 参照样条曲线
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
spline_name: 样条曲线名称(ref=1 时必填)
|
|
1198
|
+
*params: 与命令流 par1..par4 一一对应的尾部字段
|
|
1199
|
+
- ref=0: (ref_elems, offset_y, offset_z)
|
|
1200
|
+
- ref=1: (ref_elems, spline_name)
|
|
1194
1201
|
|
|
1195
1202
|
Returns:
|
|
1196
1203
|
创建的 Lane 对象
|
|
@@ -1199,11 +1206,19 @@ class LaneManager(BasicManager):
|
|
|
1199
1206
|
RuntimeError: 参数校验失败或创建失败时抛出
|
|
1200
1207
|
"""
|
|
1201
1208
|
if ref == 0:
|
|
1209
|
+
if len(params) != 3:
|
|
1210
|
+
raise RuntimeError(
|
|
1211
|
+
"ref=0 时尾部参数应为 (ref_elems, offset_y, offset_z)"
|
|
1212
|
+
)
|
|
1213
|
+
ref_elems, offset_y, offset_z = params
|
|
1202
1214
|
if not ref_elems:
|
|
1203
1215
|
raise RuntimeError(f"参照单元组名称 ref_elems 不能为空")
|
|
1204
1216
|
param = [ref_elems, offset_y, offset_z]
|
|
1205
1217
|
else:
|
|
1206
1218
|
# 命令流 eRef=1:RefESel, SplineName
|
|
1219
|
+
if len(params) != 2:
|
|
1220
|
+
raise RuntimeError("ref=1 时尾部参数应为 (ref_elems, spline_name)")
|
|
1221
|
+
ref_elems, spline_name = params
|
|
1207
1222
|
if not ref_elems:
|
|
1208
1223
|
raise RuntimeError(f"参照纵梁单元组名称 ref_elems 不能为空")
|
|
1209
1224
|
if not spline_name:
|
|
@@ -1480,7 +1495,7 @@ class LiveManager:
|
|
|
1480
1495
|
>>> grade = live_manager.grade.create_highway("简支空心板移动荷载",code="JTGD60_2015",live_load_type="HIGHWAY_I")
|
|
1481
1496
|
>>>
|
|
1482
1497
|
>>> # 创建车道(VE 车道单元法)
|
|
1483
|
-
>>> lane = live_manager.lane.create_ve(
|
|
1498
|
+
>>> lane = live_manager.lane.create_ve("车道1", 30.0, 1.80, 1, 0, "主梁单元", 2.5, 0.0)
|
|
1484
1499
|
>>>
|
|
1485
1500
|
>>> # 创建活载工况并添加子工况
|
|
1486
1501
|
>>> live_case = live_manager.case.create("活载工况1", "JTGD60_2015", 1)
|
|
@@ -1514,7 +1529,7 @@ class LiveManager:
|
|
|
1514
1529
|
|
|
1515
1530
|
用法::
|
|
1516
1531
|
|
|
1517
|
-
>>> live_manager.lane.create_ve("车道1", 30.0,
|
|
1532
|
+
>>> live_manager.lane.create_ve("车道1", 30.0, 0, 0, 0, "主梁", 0.0, 0.0)
|
|
1518
1533
|
>>> live_manager.lane.all()
|
|
1519
1534
|
>>> live_manager.lane.get("车道1")
|
|
1520
1535
|
"""
|
|
@@ -399,7 +399,6 @@ class CreepShrinkManager(BasicManager):
|
|
|
399
399
|
type_coeff: float = 5.0,
|
|
400
400
|
birth_by_shrinking: int = 3,
|
|
401
401
|
fly_ash_ratio: float = 0.0,
|
|
402
|
-
shrink_birth: int | None = None,
|
|
403
402
|
) -> CreepShrink:
|
|
404
403
|
'''创建或修改收缩徐变特性
|
|
405
404
|
|
|
@@ -418,7 +417,6 @@ class CreepShrinkManager(BasicManager):
|
|
|
418
417
|
type_coeff (float): 水泥种类系数
|
|
419
418
|
birth_by_shrinking (int): 收缩开始时的混凝土龄期(天数)
|
|
420
419
|
fly_ash_ratio (float): 粉煤灰添加量(百分比),0~50
|
|
421
|
-
shrink_birth (int|None): birth_by_shrinking 的旧写法,传了就覆盖上面的值
|
|
422
420
|
|
|
423
421
|
Returns:
|
|
424
422
|
创建的 CreepShrink 对象
|
|
@@ -426,8 +424,6 @@ class CreepShrinkManager(BasicManager):
|
|
|
426
424
|
Raises:
|
|
427
425
|
RuntimeError: 创建失败时抛出
|
|
428
426
|
'''
|
|
429
|
-
if shrink_birth is not None:
|
|
430
|
-
birth_by_shrinking = shrink_birth
|
|
431
427
|
ok, err = osis_creep_shrink(
|
|
432
428
|
nNO=no,
|
|
433
429
|
strName=name,
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
Python 重装,不用重编 DLL。认不出来的表头会告警,必需的列缺失会直接报错,不会
|
|
29
29
|
静默给出一张少列的表。
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
``yilEnumType::UnitType`` 的枚举值,仅作诊断,本模块不用。
|
|
31
|
+
数值由 OSIS 引擎统一按标准单位返回:力 N、力矩 N·m、应力 Pa,与模型的显示单位
|
|
32
|
+
设置无关。unit 是 ``yilEnumType::UnitType`` 的枚举值,仅作诊断,本模块不用。
|
|
33
33
|
|
|
34
34
|
source 是诊断信息而非稳定契约:同一次调用可能因结果文件是否落盘而在 file/memory
|
|
35
35
|
之间翻转,也可能缺失,不要用业务逻辑依赖它。
|
|
@@ -252,6 +252,7 @@ def osis_section_part_polygon(
|
|
|
252
252
|
PartDensity: float,
|
|
253
253
|
PartGeoType: Literal["Polygon"],
|
|
254
254
|
ContourMatrix: str,
|
|
255
|
+
ContourWidth: str,
|
|
255
256
|
):
|
|
256
257
|
"""定义或修改自定义组合截面的面域Part信息。
|
|
257
258
|
Args:
|
|
@@ -263,6 +264,7 @@ def osis_section_part_polygon(
|
|
|
263
264
|
PartDensity:分部重度
|
|
264
265
|
PartGeoType:分部几何类型,=Polygon为面域
|
|
265
266
|
ContourMatrix:轮廓点矩阵,大小为n*3,n为点的个数,第一列为点所在的轮廓线编号,第二列为点的x坐标,第三列为点的y坐标
|
|
267
|
+
ContourWidth:轮廓线宽度矩阵,大小为n*1,n为轮廓线数量
|
|
266
268
|
Returns:
|
|
267
269
|
tuple (bool, str): 返回一个元组,包含:
|
|
268
270
|
- bool: 操作是否成功
|
|
@@ -331,18 +331,20 @@ class Section:
|
|
|
331
331
|
|
|
332
332
|
def set_mesh(
|
|
333
333
|
self,
|
|
334
|
+
part_id: int = 1,
|
|
334
335
|
mesh_method: Literal[0, 1] = 0,
|
|
335
336
|
mesh_size: float = 0.0,
|
|
336
|
-
part_id: int = 1,
|
|
337
337
|
) -> None:
|
|
338
338
|
'''设置截面网格(适用于混凝土截面、模板组合截面与自定义组合截面)。
|
|
339
339
|
|
|
340
|
+
形参顺序与命令流 SectionMesh, Index, PartID, MeshMethod, MeshSize 一致。
|
|
341
|
+
|
|
340
342
|
Args:
|
|
343
|
+
part_id (int): 分部编号,混凝土截面输入 1,模板组合截面输入 2
|
|
341
344
|
mesh_method (int): 网格划分方式
|
|
342
345
|
* 0 = 自动划分
|
|
343
346
|
* 1 = 手动划分
|
|
344
347
|
mesh_size (float): 网格划分尺寸,在 mesh_method=1 时起作用
|
|
345
|
-
part_id (int): 分部编号,混凝土截面输入 1,模板组合截面输入 2
|
|
346
348
|
|
|
347
349
|
Raises:
|
|
348
350
|
RuntimeError: 设置失败时抛出
|
|
@@ -437,24 +439,41 @@ class Section:
|
|
|
437
439
|
|
|
438
440
|
def add_part(
|
|
439
441
|
self,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
+
part_index: int,
|
|
443
|
+
part_mat_type: Literal["Concrete", "Steel"],
|
|
444
|
+
part_e: float,
|
|
445
|
+
part_mu: float,
|
|
446
|
+
part_density: float,
|
|
447
|
+
part_geo_type: Literal["Polygon", "Line"],
|
|
448
|
+
*matrices: str,
|
|
442
449
|
) -> None:
|
|
443
|
-
"""添加或修改组合截面 Part
|
|
450
|
+
"""添加或修改组合截面 Part(按几何类型分发)
|
|
451
|
+
|
|
452
|
+
形参顺序与命令流
|
|
453
|
+
SectionPart, SecIndex, PartIndex, PartMatType, PartE, PartMu,
|
|
454
|
+
PartDensity, PartGeoType, Matrices... 一致。
|
|
444
455
|
|
|
445
456
|
Args:
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
*
|
|
449
|
-
|
|
457
|
+
part_index: Part 编号
|
|
458
|
+
part_mat_type: 分部材料类型
|
|
459
|
+
* Concrete = 混凝土,可布置钢筋
|
|
460
|
+
* Steel = 钢,不可布置钢筋
|
|
461
|
+
part_e: 分部弹性模量
|
|
462
|
+
part_mu: 分部泊松比
|
|
463
|
+
part_density: 分部重度
|
|
464
|
+
part_geo_type: 分部几何类型(大小写不敏感)
|
|
465
|
+
* Polygon = 面域(后面 2 个矩阵:ContourMatrix, ContourWidth)
|
|
466
|
+
* Line = 线域(后面 3 个矩阵:PointMatrix, LineMatrix, WidthMatrix)
|
|
467
|
+
matrices: 几何矩阵,数量由 part_geo_type 决定
|
|
450
468
|
"""
|
|
451
|
-
key = str(
|
|
469
|
+
key = str(part_geo_type).upper()
|
|
470
|
+
head = (part_index, part_mat_type, part_e, part_mu, part_density)
|
|
452
471
|
if key == "POLYGON":
|
|
453
|
-
self.add_composite_part_polygon(*
|
|
472
|
+
self.add_composite_part_polygon(*head, *matrices)
|
|
454
473
|
elif key == "LINE":
|
|
455
|
-
self.add_composite_part_line(*
|
|
474
|
+
self.add_composite_part_line(*head, *matrices)
|
|
456
475
|
else:
|
|
457
|
-
raise ValueError(f"未知 Part 类型: {
|
|
476
|
+
raise ValueError(f"未知 Part 类型: {part_geo_type!r},支持 POLYGON/LINE")
|
|
458
477
|
|
|
459
478
|
# ── 组合截面材料 ──────────────────────────
|
|
460
479
|
|
|
@@ -35,7 +35,7 @@ def osis_stage_element(nIndex: int, eOP: Literal[1, 0], eType: Literal[1, 0], st
|
|
|
35
35
|
pass
|
|
36
36
|
|
|
37
37
|
@REGISTRY.register("StgBd")
|
|
38
|
-
def osis_stage_boundary(nIndex: int, eOP: Literal[1, 0], eType: Literal[1, 0], strGroupName: str):
|
|
38
|
+
def osis_stage_boundary(nIndex: int, eOP: Literal[1, 0], eType: Literal[1, 0], strGroupName: str, nPos: int = None):
|
|
39
39
|
"""通过边界组激活/钝化边界
|
|
40
40
|
|
|
41
41
|
Args:
|
|
@@ -43,11 +43,14 @@ def osis_stage_boundary(nIndex: int, eOP: Literal[1, 0], eType: Literal[1, 0], s
|
|
|
43
43
|
eOP (int): 操作
|
|
44
44
|
* 1 = 添加
|
|
45
45
|
* 0 = 移除
|
|
46
|
-
eType (int):
|
|
46
|
+
eType (int):
|
|
47
47
|
* 1 = 激活
|
|
48
48
|
* 0 = 钝化
|
|
49
49
|
strGroupName (str): 待操作的边界组名称
|
|
50
|
-
|
|
50
|
+
nPos (int): 变形位置,可缺省(None)
|
|
51
|
+
* 1 = 变形前(默认)
|
|
52
|
+
* 0 = 变形后
|
|
53
|
+
|
|
51
54
|
Returns:
|
|
52
55
|
tuple (bool, str): 返回一个元组,包含:
|
|
53
56
|
- bool: 操作是否成功
|
|
@@ -264,10 +264,13 @@ class Stage:
|
|
|
264
264
|
self,
|
|
265
265
|
op: Literal[1, 0],
|
|
266
266
|
type: Literal[1, 0],
|
|
267
|
-
group_name: str
|
|
267
|
+
group_name: str,
|
|
268
|
+
pos: int | None = None,
|
|
268
269
|
) -> None:
|
|
269
270
|
"""通过边界组激活/钝化边界
|
|
270
271
|
|
|
272
|
+
形参顺序与命令流 StgBd, Index, OP, type, grp, pos 一致。
|
|
273
|
+
|
|
271
274
|
Args:
|
|
272
275
|
op (int): 操作
|
|
273
276
|
* 1 = 添加
|
|
@@ -276,11 +279,14 @@ class Stage:
|
|
|
276
279
|
* 1 = 激活
|
|
277
280
|
* 0 = 钝化
|
|
278
281
|
group_name (str): 待操作的边界组名称
|
|
279
|
-
|
|
282
|
+
pos (int|None): 变形位置,缺省时不下发
|
|
283
|
+
* 1 = 变形前(默认)
|
|
284
|
+
* 0 = 变形后
|
|
285
|
+
|
|
280
286
|
Raises:
|
|
281
287
|
RuntimeError: 操作失败时抛出异常
|
|
282
288
|
"""
|
|
283
|
-
ok, err = osis_stage_boundary(self.no, op, type, group_name)
|
|
289
|
+
ok, err = osis_stage_boundary(self.no, op, type, group_name, pos)
|
|
284
290
|
if not ok:
|
|
285
291
|
raise RuntimeError(f"阶段 {self.no} 定义边界组 {group_name} 失败: {err}")
|
|
286
292
|
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""命令流 → pyosis 代码生成器.
|
|
2
|
+
|
|
3
|
+
只有三类映射(详见 routes.py 的模块说明):
|
|
4
|
+
- direct: engine.method(f0, f1, ...)
|
|
5
|
+
- chain: engine.get(fk).method(其余字段原序)
|
|
6
|
+
- list: 前 n_head 个字段按位置传,其余聚合成一个 list
|
|
7
|
+
|
|
8
|
+
生成的调用一律使用位置实参: 第 N 个实参对应命令流第 N 个字段。
|
|
9
|
+
矩阵 *dim / 赋值由 MatrixAccumulator 合并为 engine.matrix(...)。
|
|
10
|
+
未注册命令 → engine.run("原始命令流")。
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from typing import List
|
|
16
|
+
|
|
17
|
+
from .matrix import MatrixAccumulator
|
|
18
|
+
from .parser import ParsedCommand
|
|
19
|
+
from .routes import CMD_ALIASES, ROUTES
|
|
20
|
+
|
|
21
|
+
_ROUTE_ALIASES = {
|
|
22
|
+
"clear": "Clear",
|
|
23
|
+
"clc": "Clc",
|
|
24
|
+
# 5.0 文档/命令流里这些命令以全小写或不同大小写出现
|
|
25
|
+
"combine": "Combine",
|
|
26
|
+
"post": "Post",
|
|
27
|
+
"combinesolve": "CombineSolve",
|
|
28
|
+
"check": "Check",
|
|
29
|
+
"checksolve": "CheckSolve",
|
|
30
|
+
"cdpc": "CdPC",
|
|
31
|
+
}
|
|
32
|
+
_SKIP_COMMANDS = frozenset({"CalcSecProp"})
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _format_value(raw: str) -> str:
|
|
36
|
+
s = raw.strip()
|
|
37
|
+
if s == "":
|
|
38
|
+
return '""'
|
|
39
|
+
try:
|
|
40
|
+
f = float(s)
|
|
41
|
+
if f == int(f) and "e" not in s.lower() and "." not in s and "E" not in s:
|
|
42
|
+
return str(int(f))
|
|
43
|
+
return repr(f)
|
|
44
|
+
except ValueError:
|
|
45
|
+
pass
|
|
46
|
+
if s.startswith('"') and s.endswith('"'):
|
|
47
|
+
return s
|
|
48
|
+
if s.startswith("'") and s.endswith("'"):
|
|
49
|
+
return f'"{s[1:-1]}"'
|
|
50
|
+
escaped = s.replace('"', '\\"')
|
|
51
|
+
return f'"{escaped}"'
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _route_key(name: str) -> str:
|
|
55
|
+
canonical = _ROUTE_ALIASES.get(name.lower(), name)
|
|
56
|
+
return CMD_ALIASES.get(canonical, canonical)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _fallback_run(cmd: ParsedCommand) -> str:
|
|
60
|
+
"""未注册命令(或字段不足)的兜底:用 engine.run("...") 包裹原始命令流。"""
|
|
61
|
+
raw = cmd.source.replace("\\", "\\\\").replace('"', '\\"')
|
|
62
|
+
return f'engine.run("{raw}")'
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _join_args(fields: list[str]) -> str:
|
|
66
|
+
return ", ".join(_format_value(v) for v in fields)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _render_route(cmd: ParsedCommand) -> str:
|
|
70
|
+
"""按 ROUTES 生成单行 Python 调用,无任何 per-command 特殊分支。"""
|
|
71
|
+
route = ROUTES.get(_route_key(cmd.name))
|
|
72
|
+
if route is None:
|
|
73
|
+
return _fallback_run(cmd)
|
|
74
|
+
|
|
75
|
+
fields = cmd.fields[1:]
|
|
76
|
+
|
|
77
|
+
if isinstance(route, str):
|
|
78
|
+
return f"{route}({_join_args(fields)})"
|
|
79
|
+
|
|
80
|
+
if route[0] == "chain":
|
|
81
|
+
_, get_path, method_name, key_index = route
|
|
82
|
+
if key_index >= len(fields):
|
|
83
|
+
return _fallback_run(cmd)
|
|
84
|
+
key_field = _format_value(fields[key_index])
|
|
85
|
+
rest = fields[:key_index] + fields[key_index + 1:]
|
|
86
|
+
return f"{get_path}({key_field}).{method_name}({_join_args(rest)})"
|
|
87
|
+
|
|
88
|
+
if route[0] == "list":
|
|
89
|
+
_, target, n_head = route
|
|
90
|
+
head, tail = fields[:n_head], fields[n_head:]
|
|
91
|
+
tail_lit = "[" + _join_args(tail) + "]"
|
|
92
|
+
head_args = _join_args(head)
|
|
93
|
+
return f"{target}({head_args}, {tail_lit})" if head_args else f"{target}({tail_lit})"
|
|
94
|
+
|
|
95
|
+
return _fallback_run(cmd)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def generate_lines(commands: List[ParsedCommand]) -> List[str]:
|
|
99
|
+
"""生成 Python 调用行;矩阵命令合并为 engine.matrix(...)。"""
|
|
100
|
+
lines: List[str] = []
|
|
101
|
+
accumulator = MatrixAccumulator()
|
|
102
|
+
|
|
103
|
+
for cmd in commands:
|
|
104
|
+
if cmd.name in _SKIP_COMMANDS:
|
|
105
|
+
continue
|
|
106
|
+
if cmd.kind == "matrix_dim":
|
|
107
|
+
flushed = accumulator.flush()
|
|
108
|
+
if flushed:
|
|
109
|
+
lines.append(flushed)
|
|
110
|
+
accumulator.on_dim(cmd.fields)
|
|
111
|
+
continue
|
|
112
|
+
|
|
113
|
+
if cmd.kind == "matrix_assign":
|
|
114
|
+
accumulator.on_assign(cmd.matrix_name, cmd.matrix_indices, cmd.matrix_value)
|
|
115
|
+
continue
|
|
116
|
+
|
|
117
|
+
flushed = accumulator.flush()
|
|
118
|
+
if flushed:
|
|
119
|
+
lines.append(flushed)
|
|
120
|
+
|
|
121
|
+
lines.append(_render_route(cmd))
|
|
122
|
+
|
|
123
|
+
flushed = accumulator.flush()
|
|
124
|
+
if flushed:
|
|
125
|
+
lines.append(flushed)
|
|
126
|
+
|
|
127
|
+
return lines
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def generate(commands: List[ParsedCommand]) -> str:
|
|
131
|
+
return "\n".join(generate_lines(commands)) + "\n"
|
|
@@ -304,41 +304,8 @@ def _insert_method_doc_comments(lines: list[str]) -> list[str]:
|
|
|
304
304
|
return out
|
|
305
305
|
|
|
306
306
|
|
|
307
|
-
# ──
|
|
307
|
+
# ── 写入 prep 模块 ──────────────────────────────────────────────
|
|
308
308
|
|
|
309
|
-
def _strip_quotes(raw: str) -> str:
|
|
310
|
-
return raw.strip().strip("\"'")
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
def _scan_creep_grades(commands: Iterable[ParsedCommand]) -> dict[str, set[str]]:
|
|
314
|
-
"""预扫描 Material 命令,建立 {收缩徐变编号: {混凝土等级, ...}}。
|
|
315
|
-
|
|
316
|
-
命令流: Material,No,Name,CONC,Code,Grade,CrepShrk[,Dmp]
|
|
317
|
-
.out 中 PROPERTY(CrpShrk) 段在 MATERIAL 段之前,前向引用必须先扫全量。
|
|
318
|
-
"""
|
|
319
|
-
grades: dict[str, set[str]] = {}
|
|
320
|
-
for cmd in commands:
|
|
321
|
-
if _route_key(cmd.name) != "Material":
|
|
322
|
-
continue
|
|
323
|
-
f = cmd.fields
|
|
324
|
-
for i in range(1, len(f)):
|
|
325
|
-
if _strip_quotes(f[i]).upper() != "CONC":
|
|
326
|
-
continue
|
|
327
|
-
grade = _strip_quotes(f[i + 2]) if i + 2 < len(f) else ""
|
|
328
|
-
creep = _strip_quotes(f[i + 3]) if i + 3 < len(f) else ""
|
|
329
|
-
if grade and creep:
|
|
330
|
-
grades.setdefault(creep, set()).add(grade)
|
|
331
|
-
break
|
|
332
|
-
return grades
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
def _route_key(name: str) -> str:
|
|
336
|
-
"""与 generator._route_key 一致的命令名归一(此处避免循环导入,本地实现)。"""
|
|
337
|
-
from pyosis.transfer.routes import CMD_ALIASES
|
|
338
|
-
return CMD_ALIASES.get(name, name)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
# 写入 prep 模块
|
|
342
309
|
def _write_prep_module(prep_dir: Path, module: str, lines: list[str]) -> Path:
|
|
343
310
|
"""写入 prep 模块;lines 为空时写 pass stub。
|
|
344
311
|
|
|
@@ -439,25 +406,17 @@ def write_prep_outputs(out_path: Path, prep_dir: Path) -> tuple[int, list[Path]]
|
|
|
439
406
|
text = _read_out_text(out_path)
|
|
440
407
|
preamble, by_module = _split_by_module(text)
|
|
441
408
|
|
|
442
|
-
# 跨命令下文:先扫全量命令拿到 CONC 材料等级 → 收缩徐变编号 的引用关系,
|
|
443
|
-
# _fix_creep_shrk 升级旧 CrpShrk 时据此推断 fcuk(而不是写死 50MPa)。
|
|
444
|
-
# engine 只用于方法签名内省(生成关键字实参),不产生连接。
|
|
445
|
-
all_cmds: list[ParsedCommand] = list(preamble)
|
|
446
|
-
for cmds in by_module.values():
|
|
447
|
-
all_cmds.extend(cmds)
|
|
448
|
-
ctx: dict = {"engine": _get_engine(), "creep_grades": _scan_creep_grades(all_cmds)}
|
|
449
|
-
|
|
450
409
|
code_line_count = 0
|
|
451
410
|
prep_paths: list[Path] = []
|
|
452
411
|
|
|
453
412
|
for module in MODULE_ORDER:
|
|
454
413
|
cmds = by_module.get(module, [])
|
|
455
|
-
lines = generate_lines(cmds
|
|
414
|
+
lines = generate_lines(cmds) if cmds else []
|
|
456
415
|
code_line_count += len(lines)
|
|
457
416
|
prep_paths.append(_write_prep_module(prep_dir, module, lines))
|
|
458
417
|
|
|
459
418
|
# 前言(典型 clear/clc)放到 main.py 顶部;无前言时为空列表
|
|
460
|
-
preamble_lines = generate_lines(preamble
|
|
419
|
+
preamble_lines = generate_lines(preamble) if preamble else []
|
|
461
420
|
|
|
462
421
|
(prep_dir / "_0_engine.py").write_text(
|
|
463
422
|
'"""模块级单例 OSISEngine,供同包内其他 prep 模块 import 使用。\n\n'
|