OPENC函数 UF_SETUP UF_NCGROUP(获取CAM模块中 程序 机床 几何 加工方法的所有名称)(UF_SETUP_ask_geom_root UF_SETUP_ask_program_root)
1 //此函数的功能是打印当前坐标系试图的所有坐标系名称 2 static void geom_list_name(tag_t group_tag) 3 { 4 //ask_member_list 5 int count=0; 6 tag_t *list=NULL; 7 //ask_name 8 char name[UF_OBJ_NAME_LEN+1]; 9 //ask_type_and_subtype 10 int type=0; 11 int subtype=0; 12 UF_NCGROUP_ask_member_list(group_tag,&count,&list); 13 UF_UI_open_listing_window(); 14 for (int i=0;i<count;i++) 15 { 16 UF_OBJ_ask_type_and_subtype(list[i],&type,&subtype); 17 if (type==UF_machining_geometry_grp_type && subtype==UF_mill_orient_subtype) 18 { 19 UF_OBJ_ask_name(list[i],name); 20 strcat_s(name,"\n"); 21 UF_UI_write_listing_window(name); 22 UF_UI_write_listing_window("\n"); 23 } 24 } 25 } 26 //此函数的功能是打印当前程序试图的所有程序组名称 27 static void programmer_list_name(tag_t group_tag) 28 { 29 //ask_member_list 30 int count=0; 31 tag_t *list=NULL; 32 //ask_name 33 char name[UF_OBJ_NAME_LEN+1]; 34 //ask_type_and_subtype 35 int type=0; 36 int subtype=0; 37 UF_NCGROUP_ask_member_list(group_tag,&count,&list); 38 UF_UI_open_listing_window(); 39 for (int i=0;i<count;i++) 40 { 41 UF_OBJ_ask_type_and_subtype(list[i],&type,&subtype); 42 if (type==UF_machining_task_type && subtype==UF_mach_order_task_subtype) 43 { 44 UF_OBJ_ask_name(list[i],name); 45 strcat_s(name,"\n"); 46 UF_UI_write_listing_window(name); 47 UF_UI_write_listing_window("\n"); 48 } 49 } 50 } 51 //此函数的功能是打印当前刀具试图的所有刀具名称 52 static void machine_list_name(tag_t group_tag) 53 { 54 //ask_member_list 55 int count=0; 56 tag_t *list=NULL; 57 //ask_name 58 char name[UF_OBJ_NAME_LEN+1]; 59 //ask_type_and_subtype 60 int type=0; 61 int subtype=0; 62 UF_NCGROUP_ask_member_list(group_tag,&count,&list); 63 UF_UI_open_listing_window(); 64 for (int i=0;i<count;i++) 65 { 66 UF_OBJ_ask_type_and_subtype(list[i],&type,&subtype); 67 if (type==UF_machining_tool_type && subtype==UF_mach_tool_subtype) 68 { 69 UF_OBJ_ask_name(list[i],name); 70 strcat_s(name,"\n"); 71 UF_UI_write_listing_window(name); 72 UF_UI_write_listing_window("\n"); 73 } 74 } 75 } 76 //此函数的功能是打印当前方法试图的所有工艺名称 77 static void method_list_name(tag_t group_tag) 78 { 79 //ask_member_list 80 int count=0; 81 tag_t *list=NULL; 82 //ask_name 83 char name[UF_OBJ_NAME_LEN+1]; 84 //ask_type_and_subtype 85 int type=0; 86 int subtype=0; 87 UF_NCGROUP_ask_member_list(group_tag,&count,&list); 88 UF_UI_open_listing_window(); 89 for (int i=0;i<count;i++) 90 { 91 UF_OBJ_ask_type_and_subtype(list[i],&type,&subtype); 92 if (type==UF_machining_mthd_type && subtype==UF_mach_mill_mthd_subtype) 93 { 94 UF_OBJ_ask_name(list[i],name); 95 strcat_s(name,"\n"); 96 UF_UI_write_listing_window(name); 97 UF_UI_write_listing_window("\n"); 98 } 99 } 100 } 101 extern DllExport void ufsta( char *param, int *returnCode, int rlen ) 102 { 103 /* Initialize the API environment */ 104 if( UF_CALL(UF_initialize()) ) 105 { 106 /* Failed to initialize */ 107 return; 108 } 109 110 /* TODO: Add your application code here */ 111 UF_initialize(); 112 //根 113 tag_t setup_tag=NULL_TAG; 114 tag_t geom_group=NULL_TAG; 115 tag_t mct_group=NULL_TAG; 116 tag_t mthd_group=NULL_TAG; 117 tag_t program_group=NULL_TAG; 118 UF_SETUP_ask_setup (&setup_tag); 119 //几何试图 120 UF_SETUP_ask_geom_root (setup_tag,&geom_group); 121 //机床试图 122 UF_SETUP_ask_mct_root (setup_tag,&mct_group); 123 //方法试图 124 UF_SETUP_ask_mthd_root (setup_tag,&mthd_group); 125 //程序试图 126 UF_SETUP_ask_program_root (setup_tag,&program_group); 127 //打印 128 geom_list_name(geom_group); 129 programmer_list_name(program_group); 130 machine_list_name(mct_group); 131 method_list_name(mthd_group); 132 133 UF_terminate(); 134 /* Terminate the API environment */ 135 UF_CALL(UF_terminate()); 136 }
Life's is not that binary