first commit
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .models import LessonStep, StandardAnswer
|
||||
|
||||
|
||||
SKILL_LABELS = {
|
||||
"create_new_part": "新建零件",
|
||||
"create_front_plane_sketch": "在前视基准面创建草图",
|
||||
"create_top_plane_sketch": "在上视基准面创建草图",
|
||||
"create_right_plane_sketch": "在右视基准面创建草图",
|
||||
"draw_circle_diameter_mm": "绘制圆",
|
||||
"draw_line_mm": "绘制直线",
|
||||
"extrude_boss_mm": "凸台拉伸",
|
||||
"extrude_cut_mm": "切除拉伸",
|
||||
"create_revolve_boss_mm": "旋转凸台",
|
||||
"create_revolve_cut_mm": "旋转切除",
|
||||
"shell_remove_face_at_point_mm": "抽壳",
|
||||
"loft_boss_from_profiles": "放样凸台",
|
||||
"loft_cut_from_profiles": "放样切除",
|
||||
"swept_boss_circular_profile_mm": "扫描凸台",
|
||||
"swept_cut_circular_profile_mm": "扫描切除",
|
||||
"fillet_edges_radius_mm": "圆角",
|
||||
"chamfer_edges_angle_distance_mm": "倒角",
|
||||
"hole_wizard_threaded_mm": "异形孔向导",
|
||||
"linear_pattern_feature_mm": "线性阵列",
|
||||
"circular_pattern_feature": "圆周阵列",
|
||||
"mirror_feature_about_plane": "镜像",
|
||||
}
|
||||
|
||||
|
||||
def build_lesson_steps(standard: StandardAnswer) -> list[LessonStep]:
|
||||
result: list[LessonStep] = []
|
||||
for index, step in enumerate(standard.steps, 1):
|
||||
title = SKILL_LABELS.get(step.skill, step.name or step.skill)
|
||||
result.append(
|
||||
LessonStep(
|
||||
step_id=f"lesson-{index:03d}",
|
||||
order=index,
|
||||
title=title,
|
||||
voice_text=voice_text_for(step.skill, title, step.arguments),
|
||||
expected_skill=step.skill,
|
||||
expected_arguments=step.arguments,
|
||||
source_feature=step.source_feature,
|
||||
check_policy={
|
||||
"match": "skill_and_core_arguments",
|
||||
"method_required": True,
|
||||
"geometry_is_secondary": True,
|
||||
},
|
||||
)
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
def voice_text_for(skill: str, title: str, args: dict[str, object]) -> str:
|
||||
if skill.endswith("_sketch") or "sketch" in skill:
|
||||
return f"请在 SolidWorks 中执行:{title}。注意选择正确的基准面或参考面。"
|
||||
if skill == "extrude_boss_mm":
|
||||
return f"请点击特征中的凸台拉伸,深度设置为 {args.get('depth_mm', '标准答案要求值')} 毫米。"
|
||||
if skill == "extrude_cut_mm":
|
||||
return f"请点击特征中的切除拉伸,深度或终止条件按照标准答案设置。不要用抽壳或删除面替代。"
|
||||
if skill == "shell_remove_face_at_point_mm":
|
||||
return f"请点击特征中的抽壳,壁厚设置为 {args.get('thickness_mm', '标准答案要求值')} 毫米,并选择需要移除的开口面。"
|
||||
if "loft" in skill:
|
||||
return "请使用放样命令,按标准答案依次选择轮廓草图。不要用拉伸或扫描替代。"
|
||||
if "swept" in skill:
|
||||
return "请使用扫描命令,选择正确的轮廓和路径。不要用放样或拉伸替代。"
|
||||
return f"请在 SolidWorks 中完成:{title}。完成后系统会读取特征树并判断方法与参数是否正确。"
|
||||
|
||||
Reference in New Issue
Block a user