本人正在学习nx二次开发,关于生成刀轨问题的研究。近日来遇到不小问题,生成圆弧刀轨代码执行后没反应。已确保环境变量正确,对于直线刀轨能运行成功。请各位有能之士不吝赐教。
下面是编写的圆弧刀轨代码
extern void udop(char* param, int* status, int parm_len)
{
char op_name[UF_OPER_OPNAME_LEN];
UF_UDOP_id_t udop_id;
UF_UDOP_purpose_t purpose;
UF_OPER_id_t oper_id;
UF_PATH_id_t path_id;
UF_CAM_exit_id_t exit_id = (UF_CAM_exit_id_t)param;
UF_initialize();
UF_UDOP_ask_udop(exit_id, &udop_id);
UF_UDOP_ask_oper(udop_id, &oper_id);
UF_UDOP_ask_purpose(udop_id, &purpose);
UF_OPER_ask_name(oper_id, op_name);
UF_OPER_ask_path(oper_id, &path_id);
if (purpose == UF_UDOP_GENERATE)
{
UF_PATH_circular_motion_t cir_motion, * cir_motion_ptr = &cir_motion;
cir_motion_ptr->feed_unit = UF_PATH_FEED_UNIT_PER_MINUTE;
cir_motion_ptr->type = UF_PATH_MOTION_TYPE_CUT;
double tool_axis[3] = { 0.0,0.0,1.0 };
UF_VEC3_copy(tool_axis, cir_motion_ptr->start_tool_axis);
UF_VEC3_copy(tool_axis, cir_motion_ptr->end_tool_axis);
UF_VEC3_copy(tool_axis, cir_motion_ptr->arc_axis);
cir_motion_ptr->tolerance = 0.002;
cir_motion_ptr->feed_value =5.0;
cir_motion_ptr->type = UF_PATH_MOTION_TYPE_CUT;
double point1[3] = { 0.0,0.0,0.0 };
double point2[3] = { 10.0,0.0,10.0 };
UF_VEC3_copy(point1, cir_motion_ptr->start);
UF_VEC3_copy(point2, cir_motion_ptr->arc_center);
UF_VEC3_copy(point2, cir_motion_ptr->end);
UF_PATH_create_circular_motion(path_id, cir_motion_ptr);
UF_PATH_cutcom_t cutcom_data;
cutcom_data.cutcom_mode = UF_PATH_CUTCOM_ON;
cutcom_data.plane_type = UF_PATH_PLANE_TYPE_XY;
cutcom_data.cutcom_on_status = UF_PATH_CUTCOM_ON_BEFORE_ENGAGE;
cutcom_data.cutcom_off_status = UF_PATH_CUTCOM_OFF_AFTER_RETRACT;
cutcom_data.adjust_register = 2;
cutcom_data.full_cutcom_output = TRUE;
cutcom_data.adjust_flag = TRUE;
UF_PATH_create_cutcom(path_id, &cutcom_data, NULL);
UF_PATH_end_tool_path(path_id);
}
UF_terminate();
}