738934416e
- 扩展 CDSL engine 的 shell、sweep、loft、reference plane、pattern 等运行时能力, 支持新的实体结果模式、双向拉伸、曲线扫掠、镜像/圆周阵列及相关 selector 解析。 - 完善 Build123d 适配层的拓扑快照、Compound/ShapeList 兼容处理和旋转曲面识别, 兼容 Python 3.12 / 当前 Build123d 缺少 axis_of_rotation 的合法曲面场景。 - 扩展 CDSL schema、profile schema、capability analysis、semantic validation 和 sketch solver,使新增建模操作能够被校验、执行并保留可诊断的部分结果。 - 完善 CADFS FeatureScript lowering: 支持 shell、sweep、surface/实体 loft、圆周阵列副本、镜像副本、删除阵列实例、 新 body 操作、更多拉伸终止条件和 reference plane 变体。 - 补齐椭圆、B-spline、环形区域、imprint、SWEPT_FACE、CAP_FACE、OFFSET_FACE 等 草图和拓扑引用的转换逻辑,改善后续特征的工作平面、轴线和 profile 定位精度。 - 改进 selector binding:支持 pattern 前缀复合 B-rep 快照、交集顶点引用、 多面 match_mode=all、圆柱轴线/半径和面积下限等稳定匹配条件。 - 修复 MID_PLANE 法向统一后交线方向未同步的问题,恢复 00287955 基准面的正确位置; 修复 00542223 sweep 路径反转后的切线契约和 00423838 的拓扑面数不稳定测试假设。 - 修正 CADFS 比较模块 import 路径,补充重建报告、批量重建脚本、目标文档和 README。 - 新增并扩展 engine、lowering、parser、selector binding、reports、integration 和 Onshape pipeline 回归测试,覆盖代表性 CADFS 特征链及运行时兼容性。
53 lines
2.1 KiB
Python
53 lines
2.1 KiB
Python
from __future__ import annotations
|
|
|
|
from dataclasses import asdict, dataclass, field
|
|
from typing import Any
|
|
from .featurescript_parser import symbolic_string
|
|
from .ir import Call
|
|
|
|
|
|
@dataclass
|
|
class QueryInfo:
|
|
kind: str | None = None
|
|
owner_feature: str | None = None
|
|
topology_type: str | None = None
|
|
source_sketch: str | None = None
|
|
source_entity: str | None = None
|
|
is_start: bool | None = None
|
|
calls: list[str] = field(default_factory=list)
|
|
|
|
def as_dict(self) -> dict[str, Any]: return asdict(self)
|
|
|
|
|
|
def walk_calls(value: Any):
|
|
if isinstance(value, Call):
|
|
yield value
|
|
for arg in value.args: yield from walk_calls(arg)
|
|
elif isinstance(value, list):
|
|
for item in value: yield from walk_calls(item)
|
|
elif isinstance(value, dict):
|
|
for item in value.values(): yield from walk_calls(item)
|
|
|
|
|
|
def parse_query(value: Any) -> QueryInfo:
|
|
info = QueryInfo()
|
|
for call in walk_calls(value):
|
|
info.calls.append(call.name)
|
|
if call.name in {"makeQuery", "qCreatedBy"} and call.args:
|
|
owner = symbolic_string(call.args[0])
|
|
if "F" in owner:
|
|
tail = owner[owner.find("F"):].split(".", 1)[0]
|
|
info.owner_feature = tail
|
|
if call.name == "makeQuery" and len(call.args) > 2:
|
|
info.topology_type = str(call.args[1]); info.kind = str(call.args[2]).lower()
|
|
definition = next((arg for arg in call.args if isinstance(arg, dict)), {})
|
|
if isinstance(definition.get("isStart"), str): info.is_start = definition["isStart"].lower() == "true"
|
|
elif "isStart" in definition: info.is_start = bool(definition["isStart"])
|
|
if call.name in {"sQuery", "sketchEntityQuery"} and len(call.args) >= 3:
|
|
sketch = symbolic_string(call.args[0]); info.source_sketch = sketch.split(".", 1)[0]
|
|
if info.topology_type is None: info.kind = str(call.args[1]).lower()
|
|
info.source_entity = str(call.args[2])
|
|
if call.name == "qSketchRegion" and call.args:
|
|
info.source_sketch = symbolic_string(call.args[0]); info.kind = "face"
|
|
return info
|