点击查看详细介绍

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

misnn 7年前 847 0

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


函数结构:
UF_UGMGR_reg_new_part_no
(
UF_UGMGR_new_part_no_fn_t new_part_no_fn
)

函数说明:
注册用户的,用于产生一个新的零件号码的方法。所提供的回调响应“指定”按钮,在新的对话的一部分执行在NX经理。如果使用NULL,则程序将未注册。在注册的回调,到UF_UI_lock_ug_access通话之前是必要的调用任何交互式API函数。还 - 这不是必要调用UF_initialize回调。如果调用,则会引发错误。注:此例程,如果登记,将被优先打电话到现有团队中心工程用户出口程序。

函数参数:
第1个参数为输入:
new_part_no_fn代表参数变量,UF_UGMGR_new_part_no_fn_t 为输入参数类型,指向用户提供的开放注册回调

UF_UGMGR_reg_new_part_no函数实例代码演示:
下面是一个用户程序的一个例子,写为一个用户出口在Unigraphics的启动要执行,检查当前指针指向注册程序并注册一个新的。
[quote]
#include <uf.h>
#include <uf_exit.h>
#include <uf_ugmgr.h>
#include <string.h>
#include <stdio.h>
static int my_new_partno_func
(
UF_UGMGR_new_part_no_p_t appl_data
)
{
int ifail = 0;
const char* old_item = appl_data->old_item;
const char* item_type = appl_data->item_type;
char partno[132], *ptr = partno;
/*
Just return for now...
*/
strcpy(appl_data->new_id, "");
strcpy(appl_data->new_name, "");
strcpy(appl_data->new_description, "");
appl_data->part_number_modifiable = TRUE;
appl_data->part_name_modifiable = TRUE;
appl_data->part_description_modifiable = TRUE;
appl_data->ifail = ifail;
partno[0] = '\0';
if (old_item != NULL) strcpy(ptr, old_item);
if (item_type != NULL) strcat(ptr, item_type);
appl_data->ifail = ifail;
return ifail;
}
/***************************************************************/
extern void ufsta(char *name, int *rtcode, int rtlen)
{
int irc = 0, argc = 1;
const char* argv[] = {"new_partno"};
UF_UGMGR_new_part_no_fn_t old_one;
/**************************beginning of executable*******************/
printf("\nstarting partno v1.0\n");
/*********************************************/
irc=UF_UGMGR_initialize(argc, argv);/* get licence*/
if (irc != 0)
{
printf("Unable to get a UG/Open API/ugmanager license!\n");
return;
}
printf("got UG/Open API license!\n");
/*********************************************/
/*
Make sure we do not have one already.
*/
irc = UF_UGMGR_ask_new_part_no(&old_one);
if (old_one != NULL)
{
printf("Already registered partno method! &%p\n", old_one);
return;
}
/*
Try and register the routine as supplied.
*/
irc = UF_UGMGR_reg_new_part_no(my_new_partno_func);
if (irc != 0)
{
printf("Unable to register partno method!\n");
return;
}
printf("Setting routines all finished, bye bye\n");
UF_UGMGR_terminate();
return;
}


[/quote]

0

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