点击查看详细介绍

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

misnn 6年前 2577 0

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


函数结构:
UF_CURVE_create_arc
(
UF_CURVE_arc_p_t arc_coords,
tag_t * arc
)

函数说明:
创建圆弧。您输入矩阵标签,开始和结束的角度弧度,圆弧中心的坐标,并通过填写半径在arc_coords数据结构由UF_CURVE_arc_p_t指向。电弧被从起始角度到结束角度逆时针绘制 如下所示。如果开始和结束角度之间的差的绝对值大于二PI(加上系统公差)该函数返回一个错误。如果启动角大于终止角更大,也将返回一个错误。

函数参数:
第1个参数为输入:
arc_coords代表参数变量,UF_CURVE_arc_p_t 为输入参数类型,指针弧数据结构

第2个参数为输出:
arc代表参数变量,tag_t * 为输出参数类型,新弧的对象标识符

UF_CURVE_create_arc函数实例代码演示:
下面的例子在0度创建启动一个圆,在270度结束。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_part.h>
#include <uf_curve.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)
{
char *part_name = "curve";
tag_t part, arc_id, wcs_tag;
UF_CURVE_arc_t arc_coords;

/* Fill out the data structure */
arc_coords.start_angle = 0.0;
arc_coords.end_angle = 270.0 * DEGRA;
arc_coords.arc_center[0] = 0.0;
arc_coords.arc_center[1] = 0.0;
arc_coords.arc_center[2] = 1.0;
arc_coords.radius = 2.0;

UF_CALL(UF_PART_new(part_name, UF_PART_ENGLISH, &part));
UF_CALL(UF_CSYS_ask_wcs(&wcs_tag));
UF_CALL(UF_CSYS_ask_matrix_of_object(wcs_tag,
&arc_coords.matrix_tag));
UF_CALL(UF_CURVE_create_arc(&arc_coords,&arc_id));

}
/*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]

0

最新回复 (0)
请登录后发表新帖