osis-python 0.7.4__py3-none-any.whl → 0.7.5__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.7.4
3
+ Version: 0.7.5
4
4
  Summary: A Python client library for Osis APDL
5
5
  Author-email: "CCCC Highway Consultant Co. Ltd." <support@osisbim.com>
6
6
  License-Expression: MIT
@@ -255,9 +255,10 @@ engine.prop.coord.create_three_point(
255
255
  p3x=0, p3y=1, p3z=0,
256
256
  )
257
257
 
258
- # Creep and shrinkage(no, name, avg_humidity, birth_time, type_coeff, shrink_birth)
258
+ # Creep and shrinkage(no, name, code, fcuk, avg_humidity,
259
+ # component_approximate_size, type_coeff, birth_by_shrinking, fly_ash_ratio)
259
260
  engine.prop.creep_shrink.create(no=1, name="Creep1", avg_humidity=70.0,
260
- birth_time=7, type_coeff=5.0, shrink_birth=3)
261
+ type_coeff=5.0, birth_by_shrinking=3)
261
262
 
262
263
  # Damping (Rayleigh 自定义系数)
263
264
  engine.prop.damping.create_rayleigh_custom(name="Damping1", alpha=0.05, beta=0.005)
@@ -1,5 +1,5 @@
1
- osis_python-0.7.4.dist-info/licenses/LICENSE,sha256=T4mkSYliXdU9mYe-NfHkqg6GPhzoYaIQO_a630UzpS4,1088
2
- pyosis/__init__.py,sha256=8qi838xbdeE0GHBZUqQMs--vhiCMs-rn1J6GqA_xMuA,440
1
+ osis_python-0.7.5.dist-info/licenses/LICENSE,sha256=T4mkSYliXdU9mYe-NfHkqg6GPhzoYaIQO_a630UzpS4,1088
2
+ pyosis/__init__.py,sha256=fO35LAwXFLKagoQ9zSbK1hfIydGGkAcGsEkAMj__GeA,440
3
3
  pyosis/boundary/__init__.py,sha256=W5LfF-jugWa-YI8pnfELZaz0pXLa-D8TiGnBn12HGGQ,102
4
4
  pyosis/boundary/interface.py,sha256=obqQUVFuQK9I7S8IaBZ2VBYfyXgNVBS0PQa9LzRlaAc,8990
5
5
  pyosis/boundary/manager.py,sha256=AAGdkp0sLV85enT9TQT9iqvWzjJyLzjiw0rC-tajSrI,39576
@@ -63,9 +63,9 @@ pyosis/project/manager.py,sha256=II6NxEig5KJYzuPu3_70KadQ0HYu2TfbW338hZ23dEk,409
63
63
  pyosis/property/__init__.py,sha256=xGdJItBRic3rd-6i5vyjGfA3KY-e9-WuOquIEnjPP_4,191
64
64
  pyosis/property/component_thickness.py,sha256=fH9jpt2V6w2lSL2jDb1cuk5wylfhvnznxZXObafxe44,794
65
65
  pyosis/property/coordinate.py,sha256=xFfuzXCzBWqYsDxHifpYCYgC_to9kC4LKD2yTX2CtvM,2668
66
- pyosis/property/creep_shrink.py,sha256=VsBYrMb8LjCWAx8AG7XeiYlww1HaK43gmayG7fcSL10,1469
66
+ pyosis/property/creep_shrink.py,sha256=5k85N_jSfGrqOwryzIy8Yg0oR4qmgyg8VlT-7uf0nzs,2291
67
67
  pyosis/property/damping.py,sha256=pasnvd1zua1skO-3lcLydFYT3phIZKqC-28DZn5jsGA,3225
68
- pyosis/property/manager.py,sha256=BQRI0dTzPiaMjsUnzgjolponJpas7FLMhM9qDE1ULvw,31135
68
+ pyosis/property/manager.py,sha256=7wHj0PC38hC42i0S36JDAeU8TUrjIQF0cubRgNUNpAI,33234
69
69
  pyosis/property/pu_curve.py,sha256=E3oUfe7ERYKX6q9v1U-HnNP1LRbWobNYB8dUC26s8aQ,1534
70
70
  pyosis/quick_building/__init__.py,sha256=QiWapgiZk6pkAdiznKI0bVIc16UcFOIALQuLhupLkqw,48
71
71
  pyosis/quick_building/interface.py,sha256=xdQrORabxmnlhi537pspFokQBaXSmnZMIxA_kxSo_cE,13951
@@ -98,13 +98,13 @@ pyosis/thickness/__init__.py,sha256=YGYmUPc9TvAlw4eFuEjxaG7HjvwLQJelU_Mx2M6RhW0,
98
98
  pyosis/thickness/interface.py,sha256=o9fwAnPtincBvNB7KZ-Cw67V4mSvoMYgcuLqD_FMLs0,1311
99
99
  pyosis/thickness/manager.py,sha256=JfKNKQnAaqEVnFyr3UwCj9cl4qhHYT_9Pp7HVBYNx6M,5048
100
100
  pyosis/transfer/__init__.py,sha256=OZVxVnjhDGe4fHC6pjtOaKPzAKuoDp3-XkNFzDWepsE,623
101
- pyosis/transfer/generator.py,sha256=hDM2je_3t18_S9mimYi1yB7XD2YKVm98cERLLnx_RFQ,3750
101
+ pyosis/transfer/generator.py,sha256=sVcmOfXp9_Xx0_Rk_BrSgIdK5CL47m6sBeIWCC-22XU,3869
102
102
  pyosis/transfer/matrix.py,sha256=sHw9X34-PUeY1EdoNklgK0LUHwbBPnhkhk0R9ME0XG0,3378
103
- pyosis/transfer/out_to_python.py,sha256=oaD5xX2lvMTriQe4LIW43xKYw1kh__W45vQzsLDZ1S0,15223
103
+ pyosis/transfer/out_to_python.py,sha256=wiU58lQvdfugxebizO91wPwFWVk8x1Q7LgKyScFNqZA,15706
104
104
  pyosis/transfer/parser.py,sha256=R_aBlYJTe53hD1sX5PBv86bhj88NQwANFRN4pGYudQ8,6774
105
- pyosis/transfer/routes.py,sha256=EvJ88cgtulYShvgoDfaDkkxVn3fhYgL0CffmJEtk2sY,9649
105
+ pyosis/transfer/routes.py,sha256=l1EdTAWeyvhkQSbK3jMKwn2SeXJHF9Lf2AdEDV6X0l4,10798
106
106
  pyosis/transfer/split.py,sha256=hpBe9D9WbjbKsovx4hM3X5RjTrruWNkuFmZt2ed0fME,1284
107
- osis_python-0.7.4.dist-info/METADATA,sha256=E7utN9rzJfEKH-lgpIGuz1r6puAeLaF_Mjd2aNYtoIY,20117
108
- osis_python-0.7.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
109
- osis_python-0.7.4.dist-info/top_level.txt,sha256=6VDNySkQKwipRXcN8ayKVci4vAXi4oPyWLqFhNVcIfM,7
110
- osis_python-0.7.4.dist-info/RECORD,,
107
+ osis_python-0.7.5.dist-info/METADATA,sha256=u0ZbbySda6s0zZ2X4IKvJhK2mo6FfASB5QYfJ5HER-o,20180
108
+ osis_python-0.7.5.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
109
+ osis_python-0.7.5.dist-info/top_level.txt,sha256=6VDNySkQKwipRXcN8ayKVci4vAXi4oPyWLqFhNVcIfM,7
110
+ osis_python-0.7.5.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.7.4"
10
+ __version__ = "0.7.5"
11
11
 
12
12
  from .core.engine import OSISEngine
13
13
  from .core.batch import batch, flush, batch_state, BatchError
@@ -6,17 +6,35 @@ pyosis.property.creep_shrink 的 Docstring
6
6
  from ..core import REGISTRY
7
7
 
8
8
  @REGISTRY.register("CrpShrk")
9
- def osis_creep_shrink(nNO: int=1, strName: str="收缩徐变1", dAvgHumidity: float=70.0, nBirthTime: int=7, dTypeCoeff: float=5.0, nBirthByShrinking: int=3):
9
+ def osis_creep_shrink(
10
+ nNO: int = 1,
11
+ strName: str = "收缩徐变1",
12
+ strCode: str = "JTG3362_2018",
13
+ dFcuk: float = 5.0e7,
14
+ dAvgHumidity: float = 70.0,
15
+ dComponentApproximateSize: float = 1.0,
16
+ dTypeCoeff: float = 5.0,
17
+ nBirthByShrinking: int = 3,
18
+ dFlyAshRatio: float = 0.0,
19
+ ):
10
20
  """
11
21
  创建或修改收缩徐变特性
12
22
 
23
+ 命令流:CrpShrk, Index, Name, Code, Fcuk, AVG.Humidity,
24
+ ComponentApproximateSize, Type.Coeff, BirthByShrinking, FlyAshRatio
25
+ 参数按此顺序组装,共 9 个,缺一不可(软件侧会校验参数个数)。
26
+
13
27
  Args:
14
- nNO (int): 收缩徐变特性编号
15
- strName (str): 特性名称
16
- dAvgHumidity (float): 年平均湿度(百分比)
17
- nBirthTime (int): 混凝土龄期(天)
18
- dTypeCoeff (float): 水泥种类系数
19
- nBirthByShrinking (int): 收缩开始时的混凝土龄期(天数)
28
+ nNO (int): 收缩徐变特性编号(Index)
29
+ strName (str): 名称(Name)
30
+ strCode (str): 规范(Code),目前只支持 JTG3362_2018
31
+ dFcuk (float): 28天龄期的混凝土强度(Fcuk),按工程当前压力单位填写,
32
+ 默认单位 Pa 下 5.0e7 即 50MPa,合法区间 1MPa~200MPa
33
+ dAvgHumidity (float): 周围环境的相对湿度,百分比,取值 40~99
34
+ dComponentApproximateSize (float): 构件大致尺寸(m),必须大于 0
35
+ dTypeCoeff (float): 水泥种类系数(Type.Coeff)
36
+ nBirthByShrinking (int): 收缩开始时的混凝土龄期,天数(BirthByShrinking)
37
+ dFlyAshRatio (float): 粉煤灰添加量,百分比,取值 0~50
20
38
 
21
39
  Returns:
22
40
  tuple (bool, str): 是否成功,失败原因
@@ -3,7 +3,7 @@
3
3
  用法:
4
4
  >>> from pyosis.property import property_manager
5
5
  >>> property_manager.coord.create_three_point(1, 0, 0, 0, 10, 0, 0, 0, 10, 0)
6
- >>> property_manager.creep_shrink.create(1, "CS1", 70.0, 7, 5.0, 3)
6
+ >>> property_manager.creep_shrink.create(1, "CS1", "JTG3362_2018", 5.0e7, 70.0, 1.0, 5.0, 3)
7
7
  >>> property_manager.damping.create_modal("Damp1", 0.05)
8
8
  >>> property_manager.pu_curve.create(1, "PU1", 0, 3, 0.0, 0.01, 0.02, 0.0, 100.0, 150.0)
9
9
  """
@@ -295,24 +295,39 @@ class CoordinateManager(BasicManager):
295
295
  class CreepShrink:
296
296
  """收缩徐变对象"""
297
297
  avg_humidity: float
298
- birth_by_shrinking: int
299
- birth_time: int
298
+ birth_by_shrinking: int # 收缩起始龄期(天),接口字段 birthByShrinking
299
+ birth_time: int # 只读遗留字段,当前命令流已不再写入
300
+ code: str # 规范,仅 JTG3362_2018
301
+ component_approximate_size: float # 构件大致尺寸(m)
302
+ fcuk: float # 28天龄期混凝土强度,工程当前压力单位
303
+ fly_ash_ratio: float # 粉煤灰添加量(%)
300
304
  name: str
301
305
  no: int
302
- shrink_birth: int
303
306
  related_material: list[int]
307
+ shrink_birth: int # 同 birth_by_shrinking 的旧名,读到的是同一个值
304
308
  type_coeff: float
305
309
  @classmethod
306
310
  def _from_dict(cls, d: dict) -> CreepShrink:
307
- """从接口 dict 构造 CreepShrink 对象(内部使用)"""
311
+ """从接口 dict 构造 CreepShrink 对象(内部使用)
312
+
313
+ 收缩起始龄期的接口字段名是 birthByShrinking;旧的 shrinkBirth 读出来
314
+ 恒为 None,因此 birth_by_shrinking 与 shrink_birth 两个属性都取该字段。
315
+ """
316
+ birth = d.get("birthByShrinking")
317
+ if birth is None:
318
+ birth = d.get("shrinkBirth")
308
319
  return cls(
309
320
  avg_humidity=d.get("avgHumidity"),
310
- birth_by_shrinking=d.get("birthByShrinking"),
321
+ birth_by_shrinking=birth,
311
322
  birth_time=d.get("birthTime"),
323
+ code=d.get("code"),
324
+ component_approximate_size=d.get("componentApproximateSize"),
325
+ fcuk=d.get("fcuk"),
326
+ fly_ash_ratio=d.get("flyAshRatio"),
312
327
  name=d.get("name"),
313
328
  no=d.get("no"),
314
- shrink_birth=d.get("shrinkBirth"),
315
329
  related_material=list(d.get("relatedMaterial") or []),
330
+ shrink_birth=birth,
316
331
  type_coeff = d.get("typeCoeff"),
317
332
  )
318
333
 
@@ -373,20 +388,33 @@ class CreepShrinkManager(BasicManager):
373
388
  self,
374
389
  no: int = 1,
375
390
  name: str = "收缩徐变1",
391
+ code: str = "JTG3362_2018",
392
+ fcuk: float = 5.0e7,
376
393
  avg_humidity: float = 70.0,
377
- birth_time: int = 7,
394
+ component_approximate_size: float = 1.0,
378
395
  type_coeff: float = 5.0,
379
- shrink_birth: int = 3,
396
+ birth_by_shrinking: int = 3,
397
+ fly_ash_ratio: float = 0.0,
398
+ shrink_birth: int | None = None,
380
399
  ) -> CreepShrink:
381
400
  '''创建或修改收缩徐变特性
382
401
 
402
+ 形参顺序与命令流字段顺序一致:
403
+ CrpShrk, Index, Name, Code, Fcuk, AVG.Humidity,
404
+ ComponentApproximateSize, Type.Coeff, BirthByShrinking, FlyAshRatio
405
+
383
406
  Args:
384
407
  no (int): 收缩徐变特性编号
385
408
  name (str): 特性名称
386
- avg_humidity (float): 年平均湿度(百分比)
387
- birth_time (int): 混凝土龄期(天)
409
+ code (str): 规范,目前只支持 JTG3362_2018
410
+ fcuk (float): 28天龄期的混凝土强度,按工程当前压力单位填写,
411
+ 默认单位 Pa 下 5.0e7 即 50MPa,合法区间 1MPa~200MPa
412
+ avg_humidity (float): 周围环境的相对湿度(百分比),40~99
413
+ component_approximate_size (float): 构件大致尺寸(m),大于 0
388
414
  type_coeff (float): 水泥种类系数
389
- shrink_birth (int): 收缩开始时的混凝土龄期(天数)
415
+ birth_by_shrinking (int): 收缩开始时的混凝土龄期(天数)
416
+ fly_ash_ratio (float): 粉煤灰添加量(百分比),0~50
417
+ shrink_birth (int|None): birth_by_shrinking 的旧写法,传了就覆盖上面的值
390
418
 
391
419
  Returns:
392
420
  创建的 CreepShrink 对象
@@ -394,8 +422,18 @@ class CreepShrinkManager(BasicManager):
394
422
  Raises:
395
423
  RuntimeError: 创建失败时抛出
396
424
  '''
425
+ if shrink_birth is not None:
426
+ birth_by_shrinking = shrink_birth
397
427
  ok, err = osis_creep_shrink(
398
- no, name, avg_humidity, birth_time, type_coeff, shrink_birth,
428
+ nNO=no,
429
+ strName=name,
430
+ strCode=code,
431
+ dFcuk=fcuk,
432
+ dAvgHumidity=avg_humidity,
433
+ dComponentApproximateSize=component_approximate_size,
434
+ dTypeCoeff=type_coeff,
435
+ nBirthByShrinking=birth_by_shrinking,
436
+ dFlyAshRatio=fly_ash_ratio,
399
437
  )
400
438
  if not ok:
401
439
  raise RuntimeError(f"创建收缩徐变特性 {no} 失败: {err}")
@@ -61,6 +61,9 @@ def _render_route(cmd: ParsedCommand) -> str:
61
61
  fields = cmd.fields[1:]
62
62
 
63
63
  if isinstance(route, str):
64
+ fixer = REST_FIXERS.get(_route_key(cmd.name))
65
+ if fixer is not None:
66
+ fields = fixer(fields)
64
67
  formatted = [_format_value(v) for v in fields]
65
68
  if not formatted:
66
69
  return f"{route}()"
@@ -20,6 +20,16 @@ from collections import defaultdict
20
20
  from pathlib import Path
21
21
  from typing import Iterable
22
22
 
23
+ # 以脚本方式直接运行(python src/pyosis/transfer/out_to_python.py)时,
24
+ # sys.path[0] 是本文件所在目录,`pyosis` 会被 site-packages 里 pip 装的那份
25
+ # 旧副本先解析掉,本仓库的改动一律不生效。这里把本仓库的 src 顶到最前。
26
+ _SRC_ROOT = Path(__file__).resolve().parents[2]
27
+ if (_SRC_ROOT / "pyosis" / "__init__.py").is_file():
28
+ _src = str(_SRC_ROOT)
29
+ if _src in sys.path:
30
+ sys.path.remove(_src)
31
+ sys.path.insert(0, _src)
32
+
23
33
  from pyosis.transfer.generator import generate_lines
24
34
  from pyosis.transfer.parser import (
25
35
  BLANK_RE,
pyosis/transfer/routes.py CHANGED
@@ -46,9 +46,36 @@ def _fix_section_part(rest: list[str]) -> list[str]:
46
46
  return rest
47
47
 
48
48
 
49
+ def _fix_creep_shrk(rest: list[str]) -> list[str]:
50
+ """CrpShrk 旧命令流 → 新 9 字段序(同软件侧 UpdatePreviousCommand 的升级逻辑)
51
+
52
+ 新: Index, Name, Code, Fcuk, AVG.Humidity, ComponentApproximateSize,
53
+ Type.Coeff, BirthByShrinking, FlyAshRatio
54
+ 早期5.01: Index, Name, Humidity, Birth, Type.Coeff, BirthByShrinking,
55
+ FlyAshRatio, ComponentApproximateSize (8 字段)
56
+ 4.9.6: Index, Name, Humidity, Birth, Type.Coeff, BirthByShrinking (6 字段)
57
+
58
+ 旧格式的 Birth(加载龄期)在新命令流里已取消,直接丢弃;
59
+ Code/Fcuk/尺寸/粉煤灰补齐为软件升级时写入的默认值。
60
+ """
61
+ n = len(rest)
62
+ if n == 9:
63
+ return rest
64
+ if n == 6:
65
+ index, name, humidity, _birth, type_coeff, shrink_age = rest
66
+ fly_ash, size = "0", "1"
67
+ elif n == 8:
68
+ index, name, humidity, _birth, type_coeff, shrink_age, fly_ash, size = rest
69
+ else:
70
+ return rest
71
+ return [index, name, "JTG3362_2018", "50000000", humidity, size,
72
+ type_coeff, shrink_age, fly_ash]
73
+
74
+
49
75
  REST_FIXERS = {
50
76
  "SectionMesh": _fix_section_mesh,
51
77
  "SectionPart": _fix_section_part,
78
+ "CrpShrk": _fix_creep_shrk,
52
79
  }
53
80
 
54
81
  ROUTES = {