购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_CURVE_create_combine_curves( tag_t first_curve_tag, UF_CURVE_combine_curves_direction_p_t first_dir, tag_t second_curve_tag, UF_CURVE_combine_curves_direction_p_t second_dir, const char * curve_aprox_tol, tag_t * combine_curve_feature) 函数说明:
通过两条曲线沿指定相结合的创建参数曲线(S)方向向量。当“正常曲线的平面”被指定为投影型,曲线必须是平面的。一个错误就会如果给予以上是不正确的。
函数参数:
第1个参数为输入:
first_curve_tag代表参数变量,tag_t 为输入参数类型,要预计合并第一曲线标签
第2个参数为输入:
first_dir代表参数变量,UF_CURVE_combine_curves_direction_p_t 为输入参数类型,指针的第一条曲线投影方向信息
第3个参数为输入:
second_curve_tag代表参数变量,tag_t 为输入参数类型,要预计二相结合曲线标签
第4个参数为输入:
second_dir代表参数变量,UF_CURVE_combine_curves_direction_p_t 为输入参数类型,指针为第二条曲线投影方向信息
第5个参数为输入:
输入const char * 字符类型的参数,参数的变量格式为curve_aprox_tol,包含了曲线逼近公差(距离公差)的字符串值。
第6个参数为输出:
combine_curve_feature代表参数变量,tag_t * 为输出参数类型,对于合并曲线要素对象的标签。
UF_CURVE_create_combine_curves函数实例代码演示:
下面的例子中生成的一些几何形状,并显示了一个示例用于创建组合曲线。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_curve.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)
{
UF_CURVE_combine_curves_direction_t first_dir;
UF_CURVE_combine_curves_direction_t second_dir;
UF_CURVE_combine_curves_direction_t ask_first_dir;
UF_CURVE_combine_curves_direction_t ask_second_dir;
UF_CURVE_line_t line_coords;
uf_list_p_t curve_list;
double first_vect[3] = {0.,0.,1.};
double second_vect[3] = {0.,-1.,0.};
double curve_tol;
tag_t line1;
tag_t line2;
tag_t line3;
tag_t feature_tag;
tag_t ask_line1;
tag_t ask_line2;
char crv_aprox_tol[133];
char *ask_tol;
/* Ask system distance tolerance */
UF_MODL_ask_distance_tolerance(&curve_tol);
sprintf(crv_aprox_tol, "%.15g", curve_tol);
/* Create geometry */
line_coords.start_point[0] = 0.0;
line_coords.start_point[1] = 0.0;
line_coords.start_point[2] = 0.0;
line_coords.end_point[0] = 0.0;
line_coords.end_point[1] = 2.0;
line_coords.end_point[2] = 0.0;
UF_CALL(UF_CURVE_create_line(&line_coords, &line1));
line_coords.start_point[0] = -2.0;
line_coords.start_point[1] = 3.0;
line_coords.start_point[2] = 4.0;
line_coords.end_point[0] = 4.0;
line_coords.end_point[1] = 3.0;
line_coords.end_point[2] = 4.0;
UF_CALL(UF_CURVE_create_line(&line_coords, &line2));
line_coords.start_point[0] = 0.0;
line_coords.start_point[1] = 0.0;
line_coords.start_point[2] = 0.0;
line_coords.end_point[0] = 2.0;
line_coords.end_point[1] = 2.0;
line_coords.end_point[2] = 0.0;
UF_CALL(UF_CURVE_create_line(&line_coords, &line3));
/* Initialize the projection information */
first_dir.direction_type = UF_CURVE_ALONG_FIXED_VECTOR;
first_dir.direction_struct.vector[0] = first_vect[0];
first_dir.direction_struct.vector[1] = first_vect[1];
first_dir.direction_struct.vector[2] = first_vect[2];
second_dir.direction_type = UF_CURVE_ALONG_FIXED_VECTOR;
second_dir.direction_struct.vector[0] = second_vect[0];
second_dir.direction_struct.vector[1] = second_vect[1];
second_dir.direction_struct.vector[2] = second_vect[2];
/* Create the combined curve */
UF_CALL(UF_CURVE_create_combine_curves(line1, &first_dir, line2,
&second_dir,
crv_aprox_tol,
&feature_tag));
/* Ask the input parameters for the combined feature just created
*/
UF_CALL(UF_CURVE_ask_combine_curves(feature_tag, &ask_line1,
&ask_first_dir, &ask_line2,
&ask_second_dir, &ask_tol,
&curve_list));
UF_MODL_delete_list(&curve_list);
/* Edit the combined curve feature just created, by replacing one
of the input curves */
UF_CALL(UF_CURVE_edit_combine_curves(feature_tag, line3,
&ask_first_dir, ask_line2,
&ask_second_dir, ask_tol));
UF_free(ask_tol);
}
/*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]