OPENC函数 UF_UI_ONT UF_OPER函数(对当前程序进行操作(获取名称))(UF_UI_ONT_ask_selected_nodes、UF_OPER_ask_cutter_group等)
1 UF_initialize(); 2 //ask_selected_nodes 3 int count=0; 4 tag_t *objects=NULL; 5 //ask_name 6 char param_name[UF_OBJ_NAME_LEN+1]; 7 char cutter_name[UF_OBJ_NAME_LEN+1]; 8 char geom_name[UF_OBJ_NAME_LEN+1]; 9 char method_name[UF_OBJ_NAME_LEN+1]; 10 char programmer_name[UF_OBJ_NAME_LEN+1]; 11 char name [UF_OPER_MAX_NAME_LEN + 1]; 12 //ask_cutter_group 13 tag_t cutter_group=NULL_TAG; 14 //ask_geom_group 15 tag_t geom_group=NULL_TAG; 16 //ask_method_group 17 tag_t method_group=NULL_TAG; 18 //ask_program_group 19 tag_t programmer_group=NULL_TAG; 20 //ask_oper_type 21 int type=0; 22 //ask_status 23 UF_OPER_status_t status; 24 25 //选择节点 26 UF_UI_ONT_ask_selected_nodes(&count,&objects); 27 UF_UI_open_listing_window(); 28 for (int i=0;i<count;i++) 29 { 30 UF_OPER_ask_cutter_group(objects[i],&cutter_group); 31 UF_OPER_ask_geom_group (objects[i],&geom_group); 32 UF_OPER_ask_method_group (objects[i],&method_group); 33 UF_OPER_ask_program_group (objects[i],&programmer_group); 34 UF_OPER_ask_name_from_tag (objects[i],name);//可以用这个获取名称 不用UF_OBJ_ask_name 35 UF_OPER_ask_oper_type (objects[i],&type); 36 UF_OPER_ask_status (objects[i],&status); 37 /* 38 status.is_edited 操作已编辑 39 status.toolpath_edited 自上次以来是否编辑刀具路径(ps::我编辑了为什么值还是0) 40 status.toolpath_exists 刀具路径是否存在 41 */ 42 //获取名称 43 UF_OBJ_ask_name(objects[i],param_name);//程序 44 UF_OBJ_ask_name(programmer_group,programmer_name);//程序组 45 UF_OBJ_ask_name(cutter_group,cutter_name);//刀具 46 UF_OBJ_ask_name(geom_group,geom_name);//坐标系 47 UF_OBJ_ask_name(method_group,method_name);//方法 48 char type_msg[256],status_msg[256]; 49 sprintf_s(type_msg,"type=%d",type); 50 sprintf_s(status_msg,"is_edited=%d,open=%d,toolpath_edited=%d,toolpath_exists=%d",status.is_edited,status.open,status.toolpath_edited,status.toolpath_exists); 51 //打印 52 UF_UI_write_listing_window(param_name); 53 UF_UI_write_listing_window("\n"); 54 UF_UI_write_listing_window(name); 55 UF_UI_write_listing_window("\n"); 56 UF_UI_write_listing_window(programmer_name); 57 UF_UI_write_listing_window("\n"); 58 UF_UI_write_listing_window(cutter_name); 59 UF_UI_write_listing_window("\n"); 60 UF_UI_write_listing_window(geom_name); 61 UF_UI_write_listing_window("\n"); 62 UF_UI_write_listing_window(method_name); 63 UF_UI_write_listing_window("\n"); 64 UF_UI_write_listing_window(type_msg); 65 UF_UI_write_listing_window("\n"); 66 UF_UI_write_listing_window("\n"); 67 UF_UI_write_listing_window(status_msg); 68 UF_UI_write_listing_window("\n*****************************************\n"); 69 70 } 71 UF_free(objects); 72 UF_UI_ONT_refresh(); 73 UF_terminate();
Life's is not that binary