feat: 推进一级关系参数化编辑与参数导出

This commit is contained in:
2026-08-13 17:50:20 +08:00
parent 19364d81b5
commit 7d814d2939
21 changed files with 2075 additions and 231 deletions
+21 -2
View File
@@ -1138,6 +1138,12 @@ class FeatureMixin:
"slot_blockers": blocker,
}
topology_fields = self._cylindrical_feature_first_level_plan_fields(face_id)
feature_angular_span = (
_float_or_none(feature.get("same_domain_angular_span"))
or _float_or_none(feature.get("angular_span"))
or _float_or_none(info.get("same_domain_angular_span"))
or _float_or_none(info.get("angular_span"))
)
axis_range = self._cylindrical_axis_range(
face_id,
BRepAdaptor_Surface(self.faces[face_id]),
@@ -1146,6 +1152,10 @@ class FeatureMixin:
scoped_info = dict(info)
scoped_info["height_estimate"] = axis_range["span"]
scoped_info["v_range"] = (axis_range["v_min"], axis_range["v_max"])
if feature_angular_span is not None:
scoped_info["angular_span"] = feature_angular_span
scoped_info["same_domain_angular_span"] = feature_angular_span
scoped_info["is_full_cylinder"] = feature_angular_span >= math.tau * 0.92
scoped_info.update(self._cylinder_end_opening_info(face_id, BRepAdaptor_Surface(self.faces[face_id]), axis_range))
readiness = _cylinder_resize_readiness(scoped_info, new_diameter)
readiness = self._apply_cylindrical_first_level_guard_to_readiness(
@@ -1190,7 +1200,6 @@ class FeatureMixin:
"feature_bottom_note": feature.get("feature_bottom_note"),
"feature_guess": info.get("feature_guess"),
"confidence": info.get("confidence"),
"angular_span": info.get("angular_span"),
"height_estimate": scoped_info.get("height_estimate"),
"same_domain_face_ids": axis_range["same_domain_face_ids"],
"same_domain_face_count": axis_range["same_domain_face_count"],
@@ -1204,6 +1213,9 @@ class FeatureMixin:
**topology_fields,
**cutter_plan,
**fill_plan,
"angular_span": scoped_info.get("angular_span"),
"same_domain_angular_span": scoped_info.get("same_domain_angular_span"),
"is_full_cylinder": scoped_info.get("is_full_cylinder", feature.get("is_full_cylinder")),
}
def cylindrical_axis_move_plan(
@@ -2639,7 +2651,9 @@ class FeatureMixin:
"radius": info.get("radius"),
"axis": info.get("axis"),
"axis_point": info.get("axis_point"),
"angular_span": info.get("angular_span"),
"angular_span": scoped_info.get("angular_span"),
"same_domain_angular_span": scoped_info.get("same_domain_angular_span"),
"is_full_cylinder": scoped_info.get("is_full_cylinder", feature.get("is_full_cylinder")),
"height_estimate": scoped_info.get("height_estimate"),
"feature_type": feature.get("feature_type"),
"feature_guess": info.get("feature_guess"),
@@ -3331,6 +3345,7 @@ class FeatureMixin:
candidates: list[tuple[float, tuple[float, float, float], dict[str, object]]] = []
diagonal = _shape_diagonal(self.shape)
tolerance = min(max(diagonal * 1e-7, 1e-6), 1e-3)
plane_axis = surf.Plane().Axis().Direction()
for adjacent_id in adjacent_face_ids:
if adjacent_id < 0 or adjacent_id >= len(self.faces):
continue
@@ -3346,6 +3361,9 @@ class FeatureMixin:
axis = cylinder.Axis()
axis_point = axis.Location()
axis_dir = axis.Direction()
plane_axis_alignment = abs(_direction_dot(plane_axis, axis_dir))
if plane_axis_alignment < 0.92:
continue
try:
axis_range = self._cylindrical_axis_range(adjacent_id, side_surf)
except Exception:
@@ -3377,6 +3395,7 @@ class FeatureMixin:
{
"cap_axis_face_id": adjacent_id,
"cap_axis_end": end_label,
"cap_plane_axis_alignment": plane_axis_alignment,
"cap_axis_parameter": cap_parameter,
"cap_axis_start_parameter": v_min,
"cap_axis_end_parameter": v_max,