点击查看详细介绍

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

misnn 9年前 1405 0

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


函数结构:
UF_CURVE_ask_curve_struct
(
tag_t curve_id,
UF_CURVE_struct_p_t * curve_struct
)

函数说明:
获取对应于指定曲线ID结构的指针。注意:此例程是在不久被永久撤销未来。使用例程UF_EVAL模块来代替。获取对应于指定曲线ID结构的指针。

函数参数:
第1个参数为输入:
curve_id代表参数变量,tag_t 为输入参数类型,曲线的对象标识符

第2个参数为输出:
curve_struct代表参数变量,UF_CURVE_struct_p_t * 为输出参数类型,指向指针类型CURVE_struct_p_t的。这个例程分配的结构和在数据填充。此参数必须通过调用UF_CURVE_free_curve_struct释放。

UF_CURVE_ask_curve_struct函数实例代码演示:
下面的示例创建一个行并检查对输入值的数据。
[quote]
#include <stdio.h>
#include <uf_part.h>
#include <uf_defs.h>
#include <uf.h>
#include <uf_curve.h>
#include <uf_ui.h>
#include <uf_object_types.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 prtnam[]={"temp"};
char buffer[UF_UI_MAX_STRING_LEN];
int english = 2;
int curve_type;
double *curve_data;
tag_t id;
tag_t part_tag;
UF_CURVE_struct_p_t curve;

UF_CURVE_line_t line;
line.start_point[0] = 1.0;
line.start_point[1] = 1.0;
line.start_point[2] = 1.0;
line.end_point[0] = 2.0;
line.end_point[1] = 0.0;
line.end_point[2] = 1.0;

UF_CALL(UF_PART_new(prtnam,english,&part_tag));
UF_CALL(UF_CURVE_create_line(&line, &id));
UF_CALL(UF_CURVE_ask_curve_struct(id,&curve));
UF_CALL(UF_CURVE_ask_curve_struct_data(curve,
&curve_type,
&curve_data));
if(curve_type == UF_line_type)
{
UF_CALL(UF_UI_open_listing_window());
sprintf(buffer,"\nStart Parameter, t0 = %f\n", curve_data[0]);
UF_CALL(UF_UI_write_listing_window(buffer));
sprintf(buffer,"The scale value, tscale = %f\n",
curve_data[1]);
UF_CALL(UF_UI_write_listing_window(buffer));
sprintf(buffer,"The periodicity is: %f\n", curve_data[2]);
UF_CALL(UF_UI_write_listing_window(buffer));
sprintf(buffer, "The first point (x,y,z) is: %f, %f, %f\n",
curve_data[3], curve_data[4], curve_data[5]);
UF_CALL(UF_UI_write_listing_window(buffer));
sprintf(buffer,"The second point (x,y,z) is: %f, %f, %f\n",
curve_data[6],curve_data[7],curve_data[8]);
UF_CALL(UF_UI_write_listing_window(buffer));

}
UF_CALL(UF_CURVE_free_curve_struct(curve));
UF_free(curve_data);
}
/*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)
请登录后发表新帖