feat: 完善 STEP 一级参数化编辑识别与关系式建模

This commit is contained in:
2026-08-14 18:42:39 +08:00
parent 70b59c1de6
commit a633b5a338
26 changed files with 4676 additions and 77 deletions
+14 -1
View File
@@ -15,7 +15,10 @@ def _optional_int(value: object) -> int | None:
def _point3(value: object, operation: str) -> tuple[float, float, float]:
point = list(value) if isinstance(value, (list, tuple)) else []
if isinstance(value, str):
point = [chunk.strip() for chunk in value.strip().strip("()[]").replace(";", ",").split(",") if chunk.strip()]
else:
point = list(value) if isinstance(value, (list, tuple)) else []
if len(point) != 3:
raise ValueError(f"{operation} requires a 3D target center.")
return (float(point[0]), float(point[1]), float(point[2]))
@@ -78,6 +81,16 @@ def _execute(model: StepModel, operation: str, args: list[object]) -> str:
return model.resize_toroidal_radius(int(args[0]), float(args[1]), str(args[2]))
if operation == "resize_cylindrical_hole":
return model.resize_cylindrical_hole(int(args[0]), float(args[1]))
if operation == "edit_cylindrical_holes_by_refs":
offset = _point3(args[2], operation) if len(args) > 2 and args[2] is not None and args[2] != "" else None
diameter = None if len(args) <= 1 or args[1] in {None, ""} else float(args[1])
return model.edit_cylindrical_holes_by_refs(list(args[0]), target_diameter=diameter, offset=offset)
if operation == "resize_cylindrical_holes_by_refs":
return model.resize_cylindrical_holes_by_refs(list(args[0]), float(args[1]))
if operation == "move_cylindrical_holes_by_offset":
return model.move_cylindrical_holes_by_offset(list(args[0]), _point3(args[1], operation))
if operation == "suppress_cylindrical_holes_by_refs":
return model.suppress_cylindrical_holes_by_refs(list(args[0]))
if operation == "resize_cylindrical_owning_scale":
return model.resize_cylindrical_owning_scale(int(args[0]), float(args[1]))
if operation == "move_cylindrical_hole_axis":