点击查看详细介绍

UF_LAYER_create_category() 函数的参数解释说明、函数详细用法,以及实例代码演示

misnn 7年前 651 0

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


函数结构:
UF_LAYER_create_category
(
UF_LAYER_category_info_p_t category_info,
tag_t * category
)

函数说明:
创建一个类别名称,成员层次和说明。

函数参数:
第1个参数为输入:
category_info代表参数变量,UF_LAYER_category_info_p_t 为输入参数类型,指针类信息结构

第2个参数为输出:
category代表参数变量,tag_t * 为输出参数类型,类别对象标识符

UF_LAYER_create_category函数实例代码演示:
[quote]
#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_layer.h>
#include <uf_obj.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)
{
UF_LAYER_category_info_t cat;
tag_t cat_tag;
int i;
int count;


/* Create a new category */
strcpy(cat.name, "ASM_15");
strcpy(cat.descr, "Assembly Line 15");
count = 1;
for (i = 0; i < 256; ++i)
{
if (count == 5)
{
cat.layer_mask[i] = TRUE;
count = 1;
}
else
cat.layer_mask[i] = FALSE;
count++;
}
UF_CALL(UF_LAYER_create_category(&cat, &cat_tag));
/* Edit the category */
UF_CALL(UF_LAYER_edit_category_name(cat_tag, "ASM_20"));
UF_CALL(UF_LAYER_edit_category_descr(cat_tag,
"Assembly Line 20"));
for (i = 0; i < 256; ++i)
cat.layer_mask[i] = !cat.layer_mask[i];
UF_CALL(UF_LAYER_edit_category_layer(cat_tag, cat.layer_mask));
/* Get the category information */
UF_CALL(UF_LAYER_ask_category_info(cat_tag, &cat));
printf("\nCategory name is: %s\n",cat.name);
printf("\nCategory description is %s\n",cat.descr);
for(i = 0; i < 256; i++)
{
printf("Category layer_mask[%d] = %d\n",i,cat.layer_mask[i]);
}
}
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int paramLen)
{
if (!UF_CALL(UF_initialize()))
{
do_ugopen_api();
UF_CALL(UF_terminate());
}
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}



[/quote]

0

最新回复 (0)
请登录后发表新帖