购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_PART_export( const char * part_name, int num_objects, tag_t object_array [ ]) 函数说明:
导出指定的对象的指定部分。的对象是复制到目标部分。调用此函数等同于调用带有下列选项UF_PART_export_with_options:new_part=真params_mode= UF_PART_maintain_paramsexpression_mode= UF_PART_copy_exp_deeply见UF_PART_export_with_options有关行为的详细信息此函数的和为返回值的描述。
函数参数:
第1个参数为输入:
输入const char * 字符类型的参数,参数的变量格式为part_name,部分名称的出口对象。
第2个参数为输入:
输入int 整数型的参数,参数的变量格式为num_objects,要导出对象数组中的对象的数量。
第3个参数为输入:
object_array [ ]代表参数变量,tag_t 为输入参数类型,要导出的对象。
UF_PART_export函数实例代码演示:
在下面的例子中的代码创建2立方体尺寸1.0×3.2的X-1.5,然后导出这些到一个新的组成部分。这个例子必须运行与积极的工作的一部分。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_defs.h>
#include <uf_part.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)
{
double corner_pts[][3] = { {5.0, 2.0, 0.0},
{0.0, 0.0, 0.0} };
char *edge_lens[] = {"1.0", "3.2", "1.5"};
tag_t features[2];
tag_t blocks[2];
int i;
for (i = 0; i < 2; i++)
{
if (UF_CALL(UF_MODL_create_block1(UF_NULLSIGN, corner_pts[i],
edge_lens, &features[i])))
{
return;
}
/* The previous block creation routines created features. We
need to obtain the body tags for UF_PART_export.
*/
if (UF_CALL(UF_MODL_ask_feat_body(features[i], &blocks[i])))
{
return;
}
}
UF_CALL(UF_PART_export("exported_blocks", 2, blocks));
}
/*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]