UG自带的例子,好好看看
void ufusr(char *param, int *retcod, int param_len)
{
int irc = 0;
char *message = "Select Object";
UF_UI_selection_options_t opts;
UF_UI_mask_t mask;
int response;
tag_t object, view;
double cursor[3];
char error[133];
int unhighlight=0;
UF_initialize();
opts.other_options = 0;
opts.reserved = NULL;
opts.num_mask_triples = 1;
opts.mask_triples = [$mask]
/* set up selectable type, subtype, solid type */
opts.mask_triples->object_type = UF_solid_type;
opts.mask_triples->object_subtype = 0;
opts.mask_triples->solid_type = UF_UI_SEL_FEATURE_BODY;
/* set selection scope to be work part */
opts.scope = UF_UI_SEL_SCOPE_WORK_PART;
irc = UF_UI_select_single(message,&opts,&response,
[$object,cursor,&view)]
/* if no error, print information about selected object */
if (!irc)
{
printf("response= %d, object tag= %d, view tag= %d, cursor
position= %f %f %f\n", response, object, view, cursor[0],
cursor[1],cursor[2]);
/* unhighlight selected object */
FTN(uf1640)([$object,&unhighlight)]
}
else /* else get error message */
{
UF_get_fail_message(irc,error);
printf("ERROR: %s\n",error);
}
UF_terminate();
} |