NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_ui_ont.h> #include <uf_camgeom.h> static int select_filter_proc_fn(tag_t object, int type[3], void* user_data, UF_UI_selection_p_t select) { if (object == NULL) { return UF_UI_SEL_REJECT; } else { return UF_UI_SEL_ACCEPT; } } static int init_proc(UF_UI_selection_p_t select, void* user_data) { int num_triples = 1;//可选类型的数量 UF_UI_mask_t mask_triples[] = {UF_solid_type, UF_solid_body_subtype, UF_UI_SEL_FEATURE_BODY};//可选对象类型 UF_UI_set_sel_mask(select, UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, num_triples, mask_triples); if ((UF_UI_set_sel_procs(select, select_filter_proc_fn, NULL, user_data)) == 0) { return UF_UI_SEL_SUCCESS; } else { return UF_UI_SEL_FAILURE; } } UF_initialize(); //获取当前加工导航器选中的对象数量和TAG int count = 0; tag_t* objects = NULL_TAG; UF_UI_ONT_ask_selected_nodes(&count, &objects); for (int i = 0; i < count; i++) { //单对象选择对话框 char sCue[] = "单对象选择对话框"; char sTitle[] = "单对象选择对话框"; int iScope = UF_UI_SEL_SCOPE_NO_CHANGE; int iResponse; tag_t partTag = NULL_TAG; tag_t tView = NULL_TAG; double adCursor[3]; UF_UI_select_with_single_dialog(sCue, sTitle, iScope, init_proc, NULL, &iResponse, &partTag, adCursor, &tView); //单对象选择对话框 char sCue1[] = "单对象选择对话框"; char sTitle1[] = "单对象选择对话框"; int iScope1 = UF_UI_SEL_SCOPE_NO_CHANGE; int iResponse1; tag_t blankTag = NULL_TAG; tag_t tView1 = NULL_TAG; double adCursor1[3]; UF_UI_select_with_single_dialog(sCue1, sTitle1, iScope1, init_proc, NULL, &iResponse1, &blankTag, adCursor1, &tView1); //附加几何实体列表到对象 //UF_CAM_part工件 //UF_CAM_blank毛坯 //UF_CAM_check检查体 //UF_CAM_trim修剪体 //UF_CAM_cut_area切削区域 //UF_CAM_wall //UF_CAM_drive //设置工件 tag_t part_list[1] = {partTag}; UF_CAMGEOM_append_items(objects[0], UF_CAM_part, 1, part_list, NULL); //设置毛坯 tag_t blank_list[1] = {blankTag}; UF_CAMGEOM_append_items(objects[0], UF_CAM_blank, 1, blank_list, NULL); } //释放 UF_free(objects); UF_terminate(); Caesar卢尚宇 2020年5月22日