购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_CURVE_create_fillet( int type, tag_t curve_objs [ 3 ], double center [ 3 ], double radius, int trim_opts [ 3 ], int arc_opts [ 3 ], tag_t * fillet_obj) 函数说明:
创建指定曲线之间圆角。该曲线可以是任何点,线,弧,二次曲线或样条曲线的组合。两曲线圆角是在产生的电弧从该第一曲线逆时针方向第二。形成圆角相切两条曲线。逆时针方向确定基于当前的看法取向,而不是绝对或WCS坐标系统。注:指定输入曲线是否是要的能力修剪提供。如果一个“样条曲线型”曲线被标记为修整,限定点和相关联的尺寸将删除。如果修整曲线具有等于零的长度,并且没有到曲线缔连接,曲线将被删除。注:中心点坐标(2曲线圆角)会沿WCS的Z轴伸出,向施工面圆角如果必要的。有没有那么此选项的文档已被删除3曲线圆角。
函数参数:
第1个参数为输入:
输入int 整数型的参数,参数的变量格式为type,类型圆角的要被创建:UF_CURVE_2_CURVE=创建2曲线圆角
第2个参数为输入:
curve_objs [ 3 ]代表参数变量,tag_t 为输入参数类型,它们之间的圆角是要创建的曲线的对象标识符。第一曲线[1] =[2] =未在2曲线圆角使用第二曲线的标识符[0] =标识符
第3个参数为输入:
输入double 双精度类型的参数,参数的变量格式为center [ 3 ],近似圆角中心表示为绝对坐标
第4个参数为输入:
输入double 双精度类型的参数,参数的变量格式为radius,圆角的半径
第5个参数为输入:
输入int 整数型的参数,参数的变量格式为trim_opts [ 3 ],修剪选项2曲线圆角:[0] = TRUE - >修剪第一条曲线FALSE - >不修剪第一条曲线[1] = TRUE - >修剪第二曲线FALSE - >不修剪第二条曲线
第6个参数为输入:
输入int 整数型的参数,参数的变量格式为arc_opts [ 3 ],不曾用过
第7个参数为输出:
fillet_obj代表参数变量,tag_t * 为输出参数类型,关联于新创建的圆角NULL_TAG对象标识符=圆角无法创建
UF_CURVE_create_fillet函数实例代码演示:
在下面的例子中,正在之间创建了两个2曲线鱼片新创建的线。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_curve.h>
#include <uf_modl.h>
#include <uf_part.h>
#include <uf_csys.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 center[3], radius;
int units = UF_PART_ENGLISH;
int trim_opts[3],arc_opts[3]={FALSE,FALSE,FALSE};
char *part_name = "fillet";
UF_CURVE_line_t line_coords1 = {1.2,0.2,0.0,-0.5,2.5,0.0},
line_coords2 = {3.2,2.25,0.0,2.5,3.5,0.0};
UF_CURVE_arc_t arc_coords1 = {NULL_TAG,238*DEGRA,357*DEGRA,
0.22,4.3,0.0,2.0},
arc_coords2 = {NULL_TAG,82*DEGRA,175*DEGRA,
3.0,0.43,0.0,2.0};
tag_t part,line1,line2,arc1,arc2,curve_objs[3];
tag_t fillet_obj1,fillet_obj2, wcs_tag, matrix_tag;
UF_CALL(UF_PART_new(part_name,units,&part));
/* create 2 lines */
UF_CALL(UF_CURVE_create_line(&line_coords1,&line1));
UF_CALL(UF_CURVE_create_line(&line_coords2,&line2));
/* create 2 arcs */
UF_CALL(UF_CSYS_ask_wcs(&wcs_tag));
UF_CALL(UF_CSYS_ask_matrix_of_object(wcs_tag,&matrix_tag));
arc_coords1.matrix_tag=matrix_tag;
arc_coords2.matrix_tag=matrix_tag;
UF_CALL(UF_CURVE_create_arc(&arc_coords1,&arc1));
UF_CALL(UF_CURVE_create_arc(&arc_coords2,&arc2));
/*create fillet between "arc1" and "line1"*/
curve_objs[0] = arc1;
curve_objs[1] = line1;
center[0] = 0.0;
center[1] = 2.1;
center[2] = 0.0;
radius = .25;
trim_opts[0] = TRUE; /*trim first curve*/
trim_opts[1] = TRUE; /*trim second curve*/
UF_CALL(UF_CURVE_create_fillet(UF_CURVE_2_CURVE,
curve_objs,
center,
radius,
trim_opts,
arc_opts,
&fillet_obj1));
/*create fillet between "line1" and "arc2"*/
curve_objs[0] = line1;
curve_objs[1] = arc2;
center[0] = 0.8;
center[1] = 1.0;
center[2] = 0.0;
radius = .25;
trim_opts[0] = TRUE; /*trim first curve*/
trim_opts[1] = TRUE; /*trim second curve*/
UF_CALL(UF_CURVE_create_fillet(UF_CURVE_2_CURVE,
curve_objs,
center,
radius,
trim_opts,
arc_opts,
&fillet_obj2));
}
/*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]