购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_UGMGR_set_clone_auto_trans( - UF_UGMGR_clone_auto_trans_f_t) 函数说明:
注册一个基于自动克隆过程中转换为使用功能进出口。如果函数值为NULL,则默认自动翻译功能注册。
函数参数:
第1个参数为输入:
UF_UGMGR_clone_auto_trans_f_t代表参数变量,- 为输入参数类型,自动翻译功能
UF_UGMGR_set_clone_auto_trans函数实例代码演示:
在下面的示例中的代码实现了一个ufsta用户出口其中注册了一个auto_translate功能;该autotranslate功能转换@DB名_本地名字,本地名@ DB// A(请注意,这不是一个对称的翻译)。
[quote]
#include <uf_ugmgr.h>
#include <stdio.h>
#include <uf_defs.h>
int translate_name(const char old_name[MAX_FSPEC_SIZE +1],
char new_name[MAX_FSPEC_SIZE + 1])
{
if (old_name[0] == '@') /* export */
{
char no[UF_UGMGR_PARTNO_SIZE+1];
char rev[UF_UGMGR_PARTREV_SIZE+1];
char ftype[UF_UGMGR_FTYPE_SIZE+1];
char fname[UF_UGMGR_FNAME_SIZE+1];
if (UF_UGMGR_decode_part_filename((char *)old_name,
no,rev,ftype,fname) != 0)
return 5;
sprintf(new_name,"%s_%s.prt",no,rev);
return 0;
}
else /* import */
{
int file_type = 2;
char simple_name[31];
if (uc4574(old_name,file_type,simple_name) != 0)
return 5;
sprintf(new_name,"@DB/%s/A",simple_name);
return 0;
}
}
/******************************************************************
***********
* ufsta is a user exit added for the User Function Custom
Application
* project. This user exit is activated when the environment
variable
* USER_STARTUP is defined. USER_STARTUP must point to the path of
the user
* function that you want to execute, and this user function
program must
* have the ufsta entry.
*
* For example: export
USER_STARTUP=/ui1/ui_v104/ufun_test/ufd_ugmgr_set_clone_auto_trans.
hpp
*
*******************************************************************
**********/
void ufsta(char *param, int *retcod, int param_len)
{
UF_initialize();
UF_UGMGR_set_clone_auto_trans(translate_name);
UF_terminate();
}
[/quote]