NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_ui_ont.h> #include <uf_oper.h> #include <uf_obj.h> UF_initialize(); //获取当前加工导航器选中的对象数量和TAG int count = 0; tag_t* objects = NULL_TAG; UF_UI_ONT_ask_selected_nodes(&count, &objects); UF_UI_open_listing_window(); for (int i = 0; i < count; i++) { //查询指定操作所在的刀具组tag tag_t toolGroup = NULL_TAG; UF_OPER_ask_cutter_group(objects[i], &toolGroup); //查询指定操作所在的几何组tag tag_t geomGroup = NULL_TAG; UF_OPER_ask_geom_group(objects[i], &geomGroup); //查询操作所在的程序顺序组tag tag_t programGroup = NULL_TAG; UF_OPER_ask_program_group(objects[i], &programGroup); //查询指定操作所在的加工方法组tag tag_t methodGroup = NULL_TAG; UF_OPER_ask_method_group(objects[i], &methodGroup); //获取名字 char toolGroupName[256]; UF_OBJ_ask_name(toolGroup, toolGroupName); char geomGroupName[256]; UF_OBJ_ask_name(geomGroup, geomGroupName); char programGroupName[256]; UF_OBJ_ask_name(programGroup, programGroupName); char methodGroupName[256]; UF_OBJ_ask_name(methodGroup, methodGroupName); //打印 char msg[256]; sprintf_s(msg, "当前选择操作的刀具组%s,几何组%s,程序组%s,加工方法组%s", toolGroupName, geomGroupName, programGroupName, methodGroupName); UF_UI_write_listing_window(msg); } //释放 UF_free(objects); UF_terminate(); Caesar卢尚宇 2020年5月21日