NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_modl.h> UF_initialize(); L10: //打开单对象选择对话框 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); //获得面的类型 int face_type = 0; UF_MODL_ask_face_type(tObject,&face_type); if (face_type != UF_MODL_PLANAR_FACE) { uc1601("请选择平面!", 1); goto L10;//跳转回去重新选 } //根据输入的约束创建相对的基准面 int num_refs = 1; tag_t object_tags[3] = {tObject, NULL_TAG, NULL_TAG}; int point_select[3]; int which_plane = 1; char* offset_string = "0"; int num_dplanes = 0; tag_t dplane_tag[2]; UF_MODL_create_relative_dplane(num_refs, object_tags, point_select, which_plane, NULL, NULL, offset_string, &num_dplanes, dplane_tag); } UF_terminate(); Caesar卢尚宇 2021年2月14日