购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_MODL_replace_boolean_body( tag_t boolean_feature_obj_id, UF_MODL_boolean_body_e_t type, tag_t new_body) 函数说明:
取代了布尔功能的工具体和目标体。
函数参数:
第1个参数为输入:
boolean_feature_obj_id代表参数变量,tag_t 为输入参数类型,一个布尔特征的对象标识符进行修改。
第2个参数为输入:
type代表参数变量,UF_MODL_boolean_body_e_t 为输入参数类型,该类型的身体:UF_MODL_TARGET_BODY UF_MODL_TOOL_BODY
第3个参数为输入:
new_body代表参数变量,tag_t 为输入参数类型,新机构的body标签将取代无论是目标或工具的身体。
UF_MODL_replace_boolean_body函数实例代码演示:
描述该程序演示如何使用下面的UG/ Open API的程序:UF_MODL_replace_boolean_body项目描述下面的例子需要一个开放,空白部分。该代码创建一个块,锥形,和汽缸。然后,它联块和锥体。接下来,它改变的团结缸和更新工具体。
[quote]
#include <stdio.h>
#include <string.h>
#include <uf_modl.h>
#include <uf.h>
#include <uf_csys.h>
#include <uf_defs.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)
{
tag_t block, cylinder, cone, feature;
double origin[3]={0.0,0.0,0.0};
double direction[3]={0.0,0.0,1.0};
int num_of_feats;
int i;
char *edge_lens[3]={"1","1","1"};
char *diameters[2]={"1.0","2.0"};
char *height="2.0";
char *name;
uf_list_p_t uf_list;
/* Create a block, cone, and cylinder. */
UF_CALL(UF_MODL_create_block1(UF_NULLSIGN,
origin,
edge_lens,
&feature));
UF_CALL(UF_MODL_ask_feat_body(feature,
&block));
UF_CALL(UF_MODL_create_cone1(UF_NULLSIGN,
origin,
height,
diameters,
direction,
&feature));
UF_CALL(UF_MODL_ask_feat_body(feature,
&cone));
UF_CALL(UF_MODL_create_cyl1(UF_NULLSIGN,
origin,
height,
diameters[0],
direction,
&feature));
UF_CALL(UF_MODL_ask_feat_body(feature,
&cylinder));
/* Unite the block and cone */
UF_CALL(UF_MODL_operations(block,
cone,
UF_UNITE));
/* Find the boolean feature (META) */
UF_CALL(UF_MODL_ask_body_feats(block,
&uf_list));
UF_MODL_ask_list_count(uf_list,
&num_of_feats);
for (i = 0; i < num_of_feats; i++)
{
UF_MODL_ask_list_item ( uf_list,i,&feature);
UF_MODL_ask_feat_name(feature,&name);
if (strncmp(name, "META", 4) == 0)
{
UF_free(name);
break;
}
UF_free(name);
}
UF_MODL_delete_list(&uf_list);
/* Change the tool body from the cone to the cylinder. */
if(UF_CALL(UF_MODL_replace_boolean_body(feature,
UF_MODL_TOOL_BODY,
cylinder)))
{
/* error check */
}
/* Trigger update */
if(UF_CALL(UF_MODL_update()))
{
/* error check */
}
}
/*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]