feat: 完善一级关系参数化建模与参数导出

This commit is contained in:
2026-08-11 18:28:16 +08:00
parent 6cb99a1273
commit 19364d81b5
20 changed files with 917 additions and 167 deletions
@@ -272,6 +272,34 @@ def _verify_user_priority_scan_order(root: Path) -> None:
)
def _verify_candidate_scan_cache(root: Path) -> None:
path = root / "candidate_cache.step"
_write_through_hole_model(path)
model = StepModel.load(path)
first = model.editable_feature_candidates(limit=16, detailed=False, max_scan_faces=120, max_scan_edges=120)
_assert(first, "editable candidate cache probe returned no candidates")
cache = getattr(model, "_editable_feature_candidates_cache", {})
_assert(cache, "editable candidate scan should populate the model-level cache")
first[0]["operation_key"] = "mutated-by-caller"
second = model.editable_feature_candidates(limit=16, detailed=False, max_scan_faces=120, max_scan_edges=120)
_assert(
second[0].get("operation_key") != "mutated-by-caller",
"editable candidate cache should return defensive copies",
)
cylinders = model.cylindrical_feature_candidates(limit=12, include_end_info=True, max_scan_faces=120)
_assert(cylinders, "cylindrical candidate cache probe returned no candidates")
cylinder_cache = getattr(model, "_cylindrical_feature_candidates_cache", {})
_assert(cylinder_cache, "cylindrical candidate scan should populate the model-level cache")
cylinders[0]["feature_guess"] = "mutated-by-caller"
second_cylinders = model.cylindrical_feature_candidates(limit=12, include_end_info=True, max_scan_faces=120)
_assert(
second_cylinders[0].get("feature_guess") != "mutated-by-caller",
"cylindrical candidate cache should return defensive copies",
)
def _verify_ellipse_edge_scan_entries(root: Path) -> None:
path = root / "ellipse_edge_scan.step"
_write_ellipse_face_model(path)
@@ -405,6 +433,7 @@ def main() -> int:
_verify_boss_summary(root)
_verify_torus_summary(root)
_verify_user_priority_scan_order(root)
_verify_candidate_scan_cache(root)
_verify_ellipse_edge_scan_entries(root)
_verify_complex_slot_guard(root)
_verify_mixed_radius_fillet_chain_guard(root)