点击查看详细介绍

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

misnn 9年前 1347 0

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


函数结构:
UF_PART_export_with_options
(
const char * part_name,
int num_objects,
tag_t object_array [ ],
UF_PART_export_options_p_t options
)

函数说明:
导出指定的对象的指定部分。的对象是复制到目标部分。在任何其他可转让对象这给定的依赖对象,还出口。需要注意的是,如果没有显示部导出操作失败。注:对象事件和部分事件不导出。如果一个对象依赖于另一个对象,它是不可导出,然后该对象不导出并警告值UF_PART_warn_objects_not_copied返回。然而,操作继续,和其他要求出口对象仍然出口。这种情况可能会在两种情况下出现的。1.起草对象不导出其相关的几何形状不出口。如果特征参数被删除2.原点不能出口。如果出现任何其他错误,操作没有成功,而相应的错误代码返回。选项参数控制此操作的行为:参照上表

函数参数:
第1个参数为输入:
输入const char * 字符类型的参数,参数的变量格式为part_name,部分名称的出口对象。

第2个参数为输入:
输入int 整数型的参数,参数的变量格式为num_objects,要导出对象数组中的对象的数量。

第3个参数为输入:
object_array [ ]代表参数变量,tag_t 为输入参数类型,要导出的对象。

第4个参数为输入:
options代表参数变量,UF_PART_export_options_p_t 为输入参数类型,指向struct包含选项来控制对象如何导出。

UF_PART_export_with_options函数实例代码演示:
在下面的例子中的代码创建大小的立方体1.0×3.2×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)
{
UF_PART_export_options_t export_options;
double corner_pt[3] = {0.0, 0.0, 0.0};
char *edge_lens[3] = {"1.0", "3.2", "1.5"};
tag_t feature;
tag_t block;

/* Create a block feature from which we can obtain a
solid for export purposes.
*/
UF_CALL(UF_MODL_create_block1(UF_NULLSIGN, corner_pt,
edge_lens, &feature));
/* Get the body tag of the feature because UF_feature_type
is not transferable but UF_solid_type is.
*/
UF_CALL(UF_MODL_ask_feat_body(feature, &block));
/* Fill out the structure to specify how the object is to be
exported. See the header file for descriptions of these
fields.
*/
export_options.new_part = TRUE;
export_options.params_mode = UF_PART_maintain_params;
export_options.expression_mode = UF_PART_copy_exp_deeply;
UF_CALL(UF_PART_export_with_options("exported_block", 1,
&block, &export_options));
}
/*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]

0

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