购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_MODL_split_body( int num_bodies, tag_t * bodies, tag_t cutting_body, int * num_split_bodies, tag_t * * split_bodies) 函数说明:
分割的一个或多个机构与切割平面或身体面。
函数参数:
第1个参数为输入:
输入int 整数型的参数,参数的变量格式为num_bodies,要分割机构的数
第2个参数为输入:
bodies代表参数变量,tag_t * 为输入参数类型,机构被拆分
第3个参数为输入:
cutting_body代表参数变量,tag_t 为输入参数类型,切割面或片体
第4个参数为输出:
输出int * 整数型的参数,参数的变量格式为num_split_bodies,分割体的数量
第5个参数为输出:
split_bodies代表参数变量,tag_t * * 为输出参数类型,回到 *** 的身体。该数组必须通过调用UF_free释放。
UF_MODL_split_body函数实例代码演示:
说明:此文件包含以下外部函数支持体的拆分:UF_MODL_split_body
[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 = "split_body";
double plane_dir[3] = {0.0, 0.0, 1.0};
double plane_pt[3] = {2.5, 2.5, 2.5};
double origin[3] = {0.0, 0.0, 0.0};
int num_splits;
tag_t body_tag;
tag_t feat_tag;
tag_t part_tag;
tag_t dplane_tag;
tag_t *split_bodies;
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, &body_tag)) ;
/* Create a datum plane at the center of block */
UF_CALL(UF_MODL_create_fixed_dplane(plane_pt, plane_dir, &dplane_tag));
/* split the body with the datum plane */
UF_CALL(UF_MODL_split_body( 1, &body_tag, dplane_tag, &num_splits,
&split_bodies ));
UF_free(split_bodies);
}
/*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]