NX9+VS2012
#include <uf.h>
#include <uf_ui.h>
#include <uf_obj.h>
static int init_proc(UF_UI_selection_p_t select, void* user_data)
{
int errorCode = 0;
int num_triples = 1;
UF_UI_mask_t mask_triples[1] = { {UF_solid_type, 0, 0}//定义选择面类型
};
errorCode = UF_UI_set_sel_mask(select,
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
num_triples,
mask_triples);
if (errorCode == 0)
{
return UF_UI_SEL_SUCCESS;
}
else
{
return UF_UI_SEL_FAILURE;
}
}
void MyClass::do_it()
{
// TODO: add your code here
UF_initialize();
char sCue[] = "请选择";
char sTitle[] = "选择";
int iScope = UF_UI_SEL_SCOPE_WORK_PART;
int iResponse = 0;
tag_t tObject = NULL_TAG;
double adCursor[3];
tag_t tView = NULL_TAG;
UF_UI_select_with_single_dialog(sCue, sTitle, iScope, init_proc, NULL, &iResponse, &tObject, adCursor, &tView);
if (iResponse == UF_UI_OK || iResponse == UF_UI_OBJECT_SELECTED || iResponse == UF_UI_OBJECT_SELECTED_BY_NAME)
{
//取消高亮
UF_DISP_set_highlight(tObject, 0);
//将对象移动到不可见图层
UF_OBJ_set_layer_allow_hidden(tObject, 257);
}
UF_terminate();
}
Caesar卢尚宇
2021年3月8日