// This function is trying to print all of the current coordinate system coordinate system name static void geom_list_name (tag_t group_tag) { // ask_member_list int COUNT = 0 ; tag_t * List = NULL; // ask_name char name [UF_OBJ_NAME_LEN + . 1 ]; / / ask_type_and_subtype int type = 0 ; int subtype = 0 ; UF_NCGROUP_ask_member_list (group_tag, & COUNT, & List); UF_UI_open_listing_window (); for ( int I = 0; I <COUNT; I ++ ) { UF_OBJ_ask_type_and_subtype (List [I], & type, & subtype); IF (type == UF_machining_geometry_grp_type && subtype == UF_mill_orient_subtype) { UF_OBJ_ask_name (List [I], name); strcat_s (name, " \ n- " ); UF_UI_write_listing_window (name); UF_UI_write_listing_window ( " \ n- " ); } } } // this function is to print all the program name of the current program group attempted static void programmer_list_name (tag_t group_tag) { //ask_member_list int count=0; tag_t *list=NULL; //ask_name char name[UF_OBJ_NAME_LEN+1]; //ask_type_and_subtype int type=0; int subtype=0; UF_NCGROUP_ask_member_list(group_tag,&count,&list); UF_UI_open_listing_window(); for (int i=0;i<count;i++) { UF_OBJ_ask_type_and_subtype(list[i],&type,&subtype); IF (type == == UF_machining_task_type && subtype UF_mach_order_task_subtype) { UF_OBJ_ask_name (List [I], name); strcat_s (name, " \ n- " ); UF_UI_write_listing_window (name); UF_UI_write_listing_window ( " \ n- " ); } } } // this function is the name of the current is to print all the tools of the tool attempts to static void machine_list_name (tag_t group_tag) { // ask_member_list int COUNT = 0 ; tag_t * List =NULL; //ask_name char name[UF_OBJ_NAME_LEN+1]; //ask_type_and_subtype int type=0; int subtype=0; UF_NCGROUP_ask_member_list(group_tag,&count,&list); UF_UI_open_listing_window(); for (int i=0;i<count;i++) { UF_OBJ_ask_type_and_subtype(list[i],&type,&subtype); if (type==UF_machining_tool_type && subtype==UF_mach_tool_subtype) { UF_OBJ_ask_name (List [I], name); strcat_s (name, " \ n- " ); UF_UI_write_listing_window (name); UF_UI_write_listing_window ( " \ n- " ); } } } // This function is to print all the processes currently attempted method Title static void method_list_name (tag_t group_tag) { // ask_member_list int COUNT = 0 ; tag_t * List = NULL; // ask_name char name [UF_OBJ_NAME_LEN + . 1 ]; //ask_type_and_subtype int type=0; int subtype=0; UF_NCGROUP_ask_member_list(group_tag,&count,&list); UF_UI_open_listing_window(); for (int i=0;i<count;i++) { UF_OBJ_ask_type_and_subtype(list[i],&type,&subtype); if (type==UF_machining_mthd_type && subtype==UF_mach_mill_mthd_subtype) { UF_OBJ_ask_name(list[i],name); strcat_s(name,"\n"); UF_UI_write_listing_window(name); UF_UI_write_listing_window("\n"); } } } extern DllExport void ufsta( char *param, int *returnCode, int rlen ) { /* Initialize the API environment */ if( UF_CALL(UF_initialize()) ) { /* Failed to initialize */ return; } /* TODO: Add your application code here */ UF_initialize(); //根 tag_t setup_tag=NULL_TAG; tag_t geom_group=NULL_TAG; tag_t mct_group=NULL_TAG; tag_t mthd_group=NULL_TAG; tag_t program_group=NULL_TAG; UF_SETUP_ask_setup (&setup_tag); //几何试图 UF_SETUP_ask_geom_root (setup_tag,&geom_group); //机床试图 UF_SETUP_ask_mct_root (setup_tag,&mct_group); //方法试图 UF_SETUP_ask_mthd_root (setup_tag,&mthd_group); //程序试图 UF_SETUP_ask_program_root (setup_tag,&program_group); //打印 geom_list_name(geom_group); programmer_list_name(program_group); machine_list_name(mct_group); method_list_name(mthd_group); UF_terminate(); /* Terminate the API environment */ UF_CALL(UF_terminate()); }
This switched https://www.cnblogs.com/zzyfym/p/12108176.html