购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_OBJ_ask_cre_mod_versions( tag_t object, int * creation_version, int * lastmod_version) 函数说明:
返回所给定对象的创建部分的版本和它的最后的版本进行修改。版本号返回从1到部件的最高版本号,除非有错误,在这种情况下,版本号被设置为0。UF_PART_<&XXXX GT;其中涉及部分保存历史例程可以用于获得关于一个部分的版本的信息。
函数参数:
第1个参数为输入:
object代表参数变量,tag_t 为输入参数类型,对象标识符
第2个参数为输出:
输出int * 整数型的参数,参数的变量格式为creation_version,创建对象版本
第3个参数为输出:
输出int * 整数型的参数,参数的变量格式为lastmod_version,对象的最后一次修改的版本
UF_OBJ_ask_cre_mod_versions函数实例代码演示:
过在当前的固态物体下面的例子中的周期工作对他们的类型,子类型,制作部和打印信息版本,以及最后一次修改的版本号。
[quote]
#include <stdio.h>
#include <uf_assem.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_part.h>
#include <uf_obj.h>
#include <uf_object_types.h>
static char title0[] =
"\nSolid Object Report For Part: %s\n";
static char title1[] =
"Object ID Type Subtype Creation Version Modified Version";
static char title2[] =
"--------- ---- ------- ---------------- ----------------";
static char format[] =
"%9d %4d %7d %8d %8d\n";
static int print_line( char *buf )
{
printf("%s", buf );
return 0;
}
#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 line_buff[MAX_LINE_SIZE+1];
char part_fspec[MAX_FSPEC_SIZE+1];
int cre_vers, mod_vers;
int type, rtype, subtype;
tag_t object;
tag_t part;
/* Get the tag of the work part */
part = UF_ASSEM_ask_work_part();
type = UF_solid_type;
if ( part != NULL_TAG )
{
/* Get the part name of the work part. */
UF_PART_ask_part_name( part, part_fspec );
sprintf( line_buff, title0, part_fspec );
print_line( line_buff );
sprintf( line_buff, "\n" );
print_line( line_buff );
sprintf( line_buff, "\n%s\n%s\n", title1, title2 );
print_line( line_buff );
object = NULL_TAG;
/* Begin cycling for solid type by passing in a NULL_TAG. */
UF_OBJ_cycle_objs_in_part(part, type, &object);
while ( object != NULL_TAG )
{
/* Get the type and subtype. */
UF_OBJ_ask_type_and_subtype( object, &rtype, &subtype );
/* Get the creation and modification versions. */
UF_OBJ_ask_cre_mod_versions( object,&cre_vers,&mod_vers);
/* Print a report. */
sprintf( line_buff, format, object, rtype, subtype,
cre_vers, mod_vers );
print_line( line_buff );
/* Continue cycling until object is a NULL_TAG. */
UF_OBJ_cycle_objs_in_part(part, type, &object);
}
}
}
/*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);
}
[/quote]