购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_UI_select_by_class( char * message, UF_UI_selection_options_p_t opts, int * response, int * count, tag_p_t * object) 函数说明:
注:此功能是过时在不久的将来。 请用更换功能UF_UI_select_with_class对话框选择多个对象。
函数参数:
第1个参数为输入:
输入char * 字符类型的参数,参数的变量格式为message,显示提示线的消息。
第2个参数为输入:
opts代表参数变量,UF_UI_selection_options_p_t 为输入参数类型,选择选项。
第3个参数为输出:
输出int * 整数型的参数,参数的变量格式为response,回应:1 =2返回=取消3= OK
第4个参数为输出:
输出int * 整数型的参数,参数的变量格式为count,对象计数:0 =无对象选定
第5个参数为输出:
object代表参数变量,tag_p_t * 为输出参数类型,对象选定的对象标识符。 NULL,如果没有对象选中。免费使用,以释放内存。
UF_UI_select_by_class函数实例代码演示:
下面的示例要求和公开的一部分。示例代码程序演示了如何通过类来使用多个选择。该选择类被屏蔽为线,圆,圆锥曲线,样条曲线和点。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_object_types.h>
#include <uf_disp.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
if (irc)
{
char messg[133];
printf("%s, line %d: %s\n", file, line, call);
(UF_get_fail_message(irc, messg)) ?
printf(" returned a %d\n", irc) :
printf(" returned error %d: %s\n", irc, messg);
}
return(irc);
}
static void do_ugopen_api(void)
{
int irc = 0;
char *message = "Select Objects";
UF_UI_selection_options_t opts;
UF_UI_mask_t mask[5] = {{UF_line_type, 0, 0},
{UF_circle_type, 0, 0},
{UF_conic_type, UF_all_subtype, 0},
{UF_spline_type, 0, 0},
{UF_point_type, 0, 0}};
int response, count;
tag_p_t objects;
int i;
int off = 0;
opts.other_options = 0;
opts.reserved = NULL;
opts.num_mask_triples = 5;
opts.scope = UF_UI_SEL_SCOPE_WORK_PART_AND_OCC;
opts.mask_triples = &mask[0];
/* set selection scope to be work part & occurrence */
irc = UF_UI_select_by_class(
message,&opts,&response,&count,&objects );
/* if no error, print information about selected objects */
if(!irc)
{
printf("response= %d, object count= %d\n",response,count);
/* fall through only if objects selected */
if (objects != NULL)
{
for (i=0; i < count; i++)
{
printf("object tag= %d\n", objects[i]);
/* unhighlight selected objects */
UF_DISP_set_highlight(objects[i],off);
}
}
}
UF_free(objects);
}
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int param_len)
{
if (!UF_CALL(UF_initialize()))
{
do_ugopen_api();
UF_CALL(UF_terminate());
}
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
[/quote]