//铣刀D16R0.8 void CREATE_TOOL::mill_D16R08() { UF_initialize(); tag_t Tooltag = NULL_TAG; //遍历所有刀具tag UF_OBJ_cycle_by_name_and_type(UF_PART_ask_display_part(), "D16R0.8", UF_machining_tool_type, false, &Tooltag); if (Tooltag == NULL) { //创建新刀具,获取新刀具的Tag tag_t NewToolObject = null_tag; UF_CUTTER_create("mill_planar", "Mill", &NewToolObject); //设定刀具名称 UF_OBJ_set_name(NewToolObject, "D16R0.8"); //设置刀具的直径 UF_PARAM_set_double_value(NewToolObject, UF_PARAM_TL_DIAMETER, 16.0); //设置刀具的R角 UF_PARAM_set_double_value(NewToolObject, UF_PARAM_TL_COR1_RAD, 0.8); //刀具号 UF_PARAM_set_int_value(NewToolObject, UF_PARAM_TL_NUMBER, 16); //获取当前部件的UF_SETUP对象 tag_t SetupTag = NULL_TAG; UF_SETUP_ask_setup(&SetupTag); //获取刀具组的根组Tag tag_t ToolRootGroup = null_tag; UF_SETUP_ask_mct_root(SetupTag, &ToolRootGroup); //检查刀具根组是否接受新建的刀具成员 logical answer = 0; char reason[UF_NCGROUP_MAX_REASON_LEN]; int error = UF_NCGROUP_can_accept_member(ToolRootGroup, NewToolObject, &answer, reason); if (error) { uc1601("不能创建刀具", 1); } else { error = UF_NCGROUP_accept_member(ToolRootGroup, NewToolObject); if (error) { uc1601("在根组中添加新刀具失败", 1); } else { uc1601("刀具创建成功", 0); //刷新导航器 UF_UI_ONT_refresh(); } } } else { print("D16R0.8 刀具已经存在 "); } UF_terminate(); }