购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_CURVE_create_silhouette( tag_t solid, tag_t view, int* count, tag_t* * curves) 函数说明:
返回直线和圆弧标识符数组近似于曲线和边缘。公差参数决定的最大曲线或边缘与其近似弧段之间的距离。
函数参数:
第1个参数为输入:
solid代表参数变量,tag_t 为输入参数类型,耐力板或身体摆脱轮廓曲线
第2个参数为输入:
view代表参数变量,tag_t 为输入参数类型,查看生成的曲线
第3个参数为输出:
输出int* 整数型的参数,参数的变量格式为count,伯爵创建曲线数组中返回曲线。
第4个参数为输出:
curves代表参数变量,tag_t* * 为输出参数类型,曲线的数组。你是负责释放分配给该数组的内存。完成后免费使用,以释放内存。
UF_CURVE_create_silhouette函数实例代码演示:
下面的示例创建一个圆锥体和一个4视图布局。 轮廓为圆锥曲线在每个视图创建。
[quote]
#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_layout.h>
#include <uf_view.h>
#include <uf_assem.h>
#include <uf_curve.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 int example1
(
void
);
/*ARGSUSED*/
extern void ufusr(char *param, int *return_value, int paramLen)
{
if (! UF_CALL(UF_initialize()))
{
*return_value = example1();
UF_CALL(UF_terminate());
}
}
/*--------------------------------------------------------------*/
static int example1(void)
{
tag_t part_tag;
double origin_point[3];
double direction[3];
double scale_value;
char * height = "10";
char * diam[] = {"5", "2"};
char view_name[40]="\0";
tag_t cone_feature_tag;
tag_t cone_tag;
tag_t *curves;
tag_t view_tag;
int count;
typedef const char vname[31];
static vname view_names[4];
strcpy((char *)view_names[0],"TOP");
strcpy((char *)view_names[1],"FRONT");
strcpy((char *)view_names[2],"TFR-TRI");
strcpy((char *)view_names[3],"TFR-ISO");
/*
First create a part in which we will initially create a
cone.
*/
UF_CALL(UF_PART_new( "uf_silhouette_test_part", UF_PART_ENGLISH
, &part_tag
));
origin_point[0] = 0.0;
origin_point[1] = 0.0;
origin_point[2] = 0.0;
direction[0] = 0.1;
direction[1] = 0.2;
direction[2] = 0.3;
UF_CALL(UF_MODL_create_cone1( UF_NULLSIGN,
origin_point,
height,
diam,
direction,
&cone_feature_tag ));
UF_CALL(UF_MODL_ask_feat_body( cone_feature_tag, &cone_tag ));
/*
Create a 4 view layout
*/
scale_value = 1.0;
UF_CALL(uc6460("FourView",4,view_names,2, scale_value));
/* Get the views in the current layout */
for(uc6473("",view_name);strlen(view_name)!=0;uc6473("",view
_name))
{
UF_CALL(UF_VIEW_ask_tag_of_view_name(view_name, &view_tag));
UF_CALL(UF_CURVE_create_silhouette( cone_tag, view_tag,
&count, &curves))
;
UF_free(curves);
}
UF_CALL(UF_PART_save());
return 0;
}
[/quote]