点击查看详细介绍

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

misnn 9年前 1373 0

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


函数结构:
UF_MODL_check_interference
(
tag_t target,
int num_tools,
tag_t * tools,
int * results
)

函数说明:
检查针对单一目标身上的干扰每个指定的工具体。干扰状态返回每个工具的身体。对象可以作为干扰检查的一部分来创建。这些对象是标记为删除,但以确保内存被释放,避免内存溢出,UF_MODL_update应该调用UF_MODL_check_interference下被调用。

函数参数:
第1个参数为输入:
target代表参数变量,tag_t 为输入参数类型,目标身上针对其推理检查

第2个参数为输入:
输入int 整数型的参数,参数的变量格式为num_tools,在工具阵列指定工具体的数量

第3个参数为输入:
tools代表参数变量,tag_t * 为输入参数类型,刀具机构,其与目标干扰询问。尺寸为num_tools

第4个参数为输出:
输出int * 整数型的参数,参数的变量格式为results,每个工具的身体干扰状态。来电者是负责与num_tools数组大小分配它。 =1 - >有干扰=2 - >无干扰=3 - >感人,这是重合面

UF_MODL_check_interference函数实例代码演示:
说明:此文件包含以下外部函数支持检查干扰:UF_MODL_check_interference
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_part.h>
#include <uf_defs.h>
#include <uf_modl.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)
{

char *edge_length[3] = {"5.0", "5.0", "5.0"};
char *prtnam = "check_interference";
char *dia = "3.0";
char *height = "10.0";

double cyl_dir[3] = {0.0, 0.0, 1.0};

double origin[3] = {0.0, 0.0, 0.0};

int num_tools;
int results[2];

tag_t target;
tag_t tools[2];
tag_t feat_tag;
tag_t part_tag;

UF_FEATURE_SIGN create = UF_NULLSIGN;

/* Open a new part */
UF_CALL( UF_PART_new(prtnam, METRIC, &part_tag) );

/* Create a block of dimensions 5, 5, 5 */
UF_CALL(UF_MODL_create_block1(create, origin, edge_length, &feat_tag));
UF_CALL(UF_MODL_ask_feat_body(feat_tag, &target)) ;

/* Create a cylinder */
UF_CALL(UF_MODL_create_cyl1(create, origin, height, dia, cyl_dir, &feat_tag));
UF_CALL(UF_MODL_ask_feat_body(feat_tag, &tools[0]));

/* Create another cylinder not intersecting block */
origin[0] = 10.0;
origin[1] = 0.0;
origin[2] = 0.0;
UF_CALL(UF_MODL_create_cyl1(create, origin, height, dia, cyl_dir, &feat_tag));
UF_CALL(UF_MODL_ask_feat_body(feat_tag, &tools[1]));

/* check interference of the tool bodies against the target */
num_tools = 2;
UF_CALL(UF_MODL_check_interference( target, num_tools, tools, results ));

if (results[0] != 1 || results[1] != 2)
printf("*** ERROR from UF_MODL_check_interference ***\n");

}

/*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)
请登录后发表新帖