购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:
UF_MODL_ask_exps_of_feature
(
tag_t feature,
int * number_of_exps,
tag_t * * exps
)
函数说明:
获取相关的功能提供的所有表达式。
函数参数:
第1个参数为输入:
feature代表参数变量,tag_t 为输入参数类型,功能查询
第2个参数为输出:
输出int * 整数型的参数,参数的变量格式为number_of_exps,返回表达式的数量
第3个参数为输出:
exps代表参数变量,tag_t * * 为输出参数类型,与功能表达的阵列。该数组必须通过调用UF_free释放。
UF_MODL_ask_exps_of_feature函数实例代码演示:
#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_ui.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)
{
char *block_len[3] = {"1","2","3"};
char *string;
char buf[100];
double block_orig[3] = {0.0,0.0,0.0};
tag_t blk_obj;
tag_t *exps;
int number_of_exps=0,i; UF_UI_open_listing_window();
/* Create a block we can query */
UF_CALL(UF_MODL_create_block1(UF_NULLSIGN,
block_orig,
block_len,
&blk_obj));
if(!UF_CALL(UF_MODL_ask_exps_of_feature(blk_obj,
&number_of_exps,
&exps)))
{
sprintf(buf,"number_of_exps=%d\n",number_of_exps);
UF_UI_write_listing_window(buf);
UF_UI_write_listing_window("Asking expression strings\n");
for(i=0;i<number_of_exps;i++)
{
UF_CALL(UF_MODL_ask_exp_tag_string(exps[i],&string));
sprintf(buf,"Expression %d: %s\n",i,string);
UF_UI_write_listing_window(buf);
UF_free(string);
}
UF_free(exps);
}
}
/*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);
}