点击查看详细介绍

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

misnn 7年前 894 0

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


函数结构:
UF_OBJ_is_transferable
(
tag_t object_id,
logical * is_transferable
)

函数说明:
确定给定标记NX对象是否是可转移或没有。可以使用可能导出转移对象UF_PART_export或UF_PART_export_with_options,或转移到一个使用UF_ASSEM_create_component_part新组件。虽然特定的对象可能会返回作为是转让的,有不保证该类型的对象都将被传送。 对于例如,如果一个转移类型的对象,取决于一个目的这是不可转让的,那么原来的对象不会被传输。

函数参数:
第1个参数为输入:
object_id代表参数变量,tag_t 为输入参数类型,对象的对象标识查询

第2个参数为输出:
is_transferable代表参数变量,logical * 为输出参数类型,TRUE =这个对象是转让FALSE =这个对象是不可转让

UF_OBJ_is_transferable函数实例代码演示:
在下面的示例代码出口第一1024转让从工作部分到另一部分遇到的物体。这个例子必须以积极的工作一部分运行。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_part.h>
#include <uf_obj.h>
#include <uf_assem.h>
#define MAX_NUM_OBJECTS 1024
#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)
{
tag_t object;
tag_t work_part = UF_ASSEM_ask_work_part();
tag_t object_array[MAX_NUM_OBJECTS];
int num_objects = 0;

for (object = UF_OBJ_cycle_all(work_part, NULL_TAG);
object != NULL_TAG && num_objects < MAX_NUM_OBJECTS;
object = UF_OBJ_cycle_all(work_part, object))
{
/* Part occurrences cannot be exported because the export
operation is fundamentally a geometry operation, not an
assembly operation.
Non-alive objects cannot be exported because they only exist
for internal use of the system, usually because an alive object
depends on it. Non-alive objects are normally only modified by
the system as a side effect of the user modifying an alive
object.
*/
if (UF_OBJ_ask_status(object) == UF_OBJ_ALIVE)
{
logical is_transferable;
int type;
int subtype;

if (UF_CALL(UF_OBJ_ask_type_and_subtype(object, &type,
&subtype)))
{
return;
}

/* Transferable types are those object types found in
uf_object_types.h that are candidates for file export.
Transferable types include geometry, drafting objects,
groups, etc. Note that if a transferable type depends on
an object that is not transferable, then the original
object cannot be transferred (exported).
*/

if (UF_CALL(UF_OBJ_is_type_transferable(type,
&is_transferable)))
{
return;
}
if (is_transferable)
{
object_array[num_objects] = object;
num_objects++;
}
}
}
if (num_objects > 0)
{
UF_PART_export_options_t export_options;
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_objects",
num_objects,
object_array,
&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)
请登录后发表新帖