点击查看详细介绍

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

misnn 9年前 1067 0

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


函数结构:
UF_ASSEM_restore_load_options
(
const char * load_options_file
)

函数说明:
恢复负载选项记录在指定的加载选项文件。该文件应在标准load_options.def格式文件中,虽然没有要求将文件命名“load_options.def”。如果NULL代替指定文件的传递,这个功能恢复如果它存在于当前目录中的`load_options.def'文件。如果传递的文件不包含一套完整的加载选项设置,被指定的那些被改变,其他的是保持不变。

函数参数:
第1个参数为输入:
输入const char * 字符类型的参数,参数的变量格式为load_options_file,应还原的加载项文件。

UF_ASSEM_restore_load_options函数实例代码演示:
下面的示例打开现有的装配部分,然后创建一个包含所有组件都几个组件集装配的水平。然后,函数施加到每个成员该组中的一个。
[quote]
#include <stdlib.h>
#include <stdio.h>
#include <uf_assem.h>
#include <uf.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_ASSEM_options_t assy_options;
char *default_ref_sets[2], **result;
char *facet_ref_set = "FACET", *empty_ref_set = "Empty
";
int n_default_ref_sets, status;
/* First restore the load_options from the a central file. */
status =
UF_ASSEM_restore_load_options("/central/load_options.def");
if (status != 0)
{
printf("UF_ASSEM_restore_load_options() returned %d\n",status);
return;
}
/*
Now turn on the `Apply to All Levels' setting for default
reference sets.
*/
UF_ASSEM_ask_assem_options(&assy_options);
assy_options.apply_to_all_levels =
UF_ASSEM_do_apply_to_all_levels;
UF_ASSEM_set_assem_options(&assy_options);
/*
Set the default reference sets to look for facets first. The
result of
this call should be to have a reference set list of:
FACET
Empty Part
As Saved
Entire Part
since the `As Saved' and `Entire Part' is added
automatically at the end.
*/
default_ref_sets[0] = facet_ref_set;
default_ref_sets[1] = empty_ref_set;
status = UF_ASSEM_set_default_ref_sets(2, default_ref_sets);
if (status != 0)
{
printf("UF_ASSEM_set_default_ref_sets() returned %d\n",status);
return;
}
/*
Now just output the resulting reference sets just to confirm
they are
correctly set. Remember to free the returned memory.
*/
status = UF_ASSEM_ask_default_ref_sets(&n_default_ref_sets,
&result);
if (status == 0)
{
int i;
for (i=0; i<n_default_ref_sets; i++)
{
printf("Default ref set %d now set to %s\n", i, result[i]);
UF_free(result[i]);
}
}
else
{
printf("UF_ASSEM_ask_default_ref_sets() returned %d\n",status);
}
UF_free(result);
}
/*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)
请登录后发表新帖