购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:
UF_MODL_ask_curve_points
(
tag_t curve_id,
double ctol,
double atol,
double stol,
int * numpts,
double * * pts
)
函数说明:
返回基于输入的3D点坐标(x,Y,Z)的阵列曲线,弦公差,角度公差和步宽容。和弦是相邻坐标之间的直线。该公差控制的输出提供独立的值坐标位于曲线上。弦公差(CTOL)是从弦之间的曲线的最大允许距离弦的端部。角公差(蒂)是最大和切线弦之间的角向允许的总和在弦的端部的曲线。步长(STOL)是最大允许的弦长。这个程序不创建点对象的抓地力和互动方法做的。如果curve_id是一个事件,则返回的点是相对于的发生,而不是原型。
函数参数:
第1个参数为输入:
curve_id代表参数变量,tag_t 为输入参数类型,待确定的曲线上的点是标识符。
第2个参数为输入:
输入double 双精度类型的参数,参数的变量格式为ctol,弦公差。 0 =不使用弦宽容。
第3个参数为输入:
输入double 双精度类型的参数,参数的变量格式为atol,弧度0 =角度公差不使用角度公差。
第4个参数为输入:
输入double 双精度类型的参数,参数的变量格式为stol,最大步长。 0 =不使用
第5个参数为输出:
输出int * 整数型的参数,参数的变量格式为numpts,点阵列中的点数。
第6个参数为输出:
输出double * * 双精度类型的参数,参数的变量格式为pts,指向包含3D点的阵列。返回的数组是尺寸PTS[量numPts3]的一维数组。分配的数组必须与UF_free释放。
UF_MODL_ask_curve_points函数实例代码演示:
下面的示例使用一个半圆作为输入曲线。该CTOL和垂直起降参数被选择,以便这五坐标(位于0,对电弧45,90,135,和180度)被输出。
#include <uf.h>
#include <uf_modl.h>
#include <uf_curve.h>
#include <uf_csys.h>
#include <uf_obj.h>
#include <stdio.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)
{
double ctol = 0.07612046748871;
double atol = 0.0;
double stol = 0.76536686473018;
double *pts; int numpts, i;
tag_t arc, wcs_tag;
UF_CURVE_arc_t arc_coords;
UF_CALL(UF_CSYS_ask_wcs(&wcs_tag));
UF_CALL(UF_CSYS_ask_matrix_of_object(wcs_tag,
&arc_coords.matrix_tag));
arc_coords.start_angle = 0.0;
arc_coords.end_angle = PI;
arc_coords.arc_center[0] = 0.0;
arc_coords.arc_center[1] = 0.0;
arc_coords.arc_center[2] = 0.0;
arc_coords.radius = 1.0;
UF_CALL(UF_CURVE_create_arc(&arc_coords, &arc));
if(UF_CALL(UF_MODL_ask_curve_points(arc,ctol,atol,stol,
&numpts, &pts)))
{
/* Print the error message from UF_CALL macro */
}
else
{
printf("The number of points are: %d\n",numpts);
for(i = 0; i < 3 * numpts; i++)
printf("The points are: %f\n",pts[i]);
}
UF_free(pts);
}
/*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);
}