NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_ui_ont.h> #include <uf_setup.h> #include <uf_ncgroup.h> UF_initialize(); tag_t setup_tag=NULL_TAG; UF_SETUP_ask_setup(&setup_tag); //获得根组 tag_t programRootgroup=NULL_TAG; UF_SETUP_ask_program_root(setup_tag, &programRootgroup); //获取当前加工导航器选中的对象数量和TAG int count = 0; tag_t* objects = NULL_TAG; UF_UI_ONT_ask_selected_nodes(&count, &objects); for (int i = 0; i < count; i++) { tag_t operTag = objects[i]; tag_t objTag=NULL_TAG; UF_NCGROUP_ask_object_of_name(programRootgroup, "PROGRAM_COPY_1", &objTag); UF_NCGROUP_accept_member(objTag, operTag); } //释放 UF_free(objects); UF_terminate(); Caesar卢尚宇 2020年5月30日