购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_MODL_trim_sheet( tag_t sheet_body_tag, int count_bounding_objects, UF_MODL_trim_object_t * * bounding_objects, double projection_vector [ ], int point_key, int point_count, double point_coords [ ], double tolerance, int * number_gap_points, double * * gap_points) 函数说明:
修剪的片体曲线,面,或平面的集合。该曲线可以沿着表面法线或沿向量进行投影。在片体点定义哪些区域(多个)片材的要成为维持或微调丢弃。如果可以判断修剪发生故障,因为有微调之间的缝隙几何形状,则系统返回与这些空白的位置相应的返回代码。该UF_MODL_trim_object_t数据结构定义了用于修剪的对象片体。如果对象是一个曲线,则投影方法必须是定义。
函数参数:
第1个参数为输入:
sheet_body_tag代表参数变量,tag_t 为输入参数类型,片体标签减磅。
第2个参数为输入:
输入int 整数型的参数,参数的变量格式为count_bounding_objects,修剪对象的数量。
第3个参数为输入:
bounding_objects代表参数变量,UF_MODL_trim_object_t * * 为输入参数类型,指针数组持有修剪对象的数据结构。
第4个参数为输入:
输入double 双精度类型的参数,参数的变量格式为projection_vector [ ],矢量沿矢量投射曲线。
第5个参数为输入:
输入int 整数型的参数,参数的变量格式为point_key,点定义地区:0 =丢弃1 =保留
第6个参数为输入:
输入int 整数型的参数,参数的变量格式为point_count,点的数量。 (区域的数目)。
第7个参数为输入:
输入double 双精度类型的参数,参数的变量格式为point_coords [ ],在纸张上的点的数组。 (3点计数值。)
第8个参数为输入:
输入double 双精度类型的参数,参数的变量格式为tolerance,距离容忍任何近似。
第9个参数为输出:
输出int * 整数型的参数,参数的变量格式为number_gap_points,间隙点返回的点数。
第10个参数为输出:
输出double * * 双精度类型的参数,参数的变量格式为gap_points,点呈现空白位置的数组。 (3号空缺点的值)。这个数组必须通过调用UF_free释放。
UF_MODL_trim_sheet函数实例代码演示:
在本实施例的代码创建的b面,然后通过投影两曲线修剪片体。图修剪表的例子

[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_modl_error.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)
{
int knot_fixup,pole_fixup;
tag_t bcurv1,bcurv2,bsurf;
int bsurf_idata[] = {4,4,4,4};
double bsurf_uknot[] = {0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0};
double bsurf_vknot[] = {0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0};
double bsurf_poles[] = {0.0,0.0,6.0,1.0,
2.0,2.0,6.0,1.0,
5.0,1.5,6.0,1.0,
8.0,3.0,6.0,1.0,
0.0,2.0,4.0,1.0,
2.0,4.0,4.0,1.0,
5.0,3.5,4.0,1.0,
8.0,5.0,4.0,1.0,
0.0,2.0,2.0,1.0,
2.0,4.0,2.0,1.0,
5.0,3.5,2.0,1.0,
8.0,5.0,2.0,1.0,
0.0,0.0,0.0,1.0,
2.0,2.0,0.0,1.0,
5.0,1.5,0.0,1.0,
8.0,3.0,0.0,1.0} ;
int bcurv1_idata[] = {3,3} ;
double bcurv1_knots[] = {0.0,0.0,0.0,1.0,1.0,1.0};
double bcurv1_poles[] = {-0.5,-2.5,3.5,1.0,
2.5,-2.5,3.5,1.0,
2.5,-2.5,6.5,1.0};
int bcurv2_idata[] = {8,4} ;
double bcurv2_knots[] = {-0.6,-0.4,-0.2,0.0,0.2,
0.4, 0.6, 0.8,1.0,1.2,
1.4, 1.6};
double bcurv2_poles[] = {3.0,-2.5,2.0,1.0,
4.0,-2.5,1.0,1.0,
7.0,-2.5,1.0,1.0,
6.0,-2.5,3.0,1.0,
3.0,-2.5,3.0,1.0,
3.0,-2.5,2.0,1.0,
4.0,-2.5,1.0,1.0,
7.0,-2.5,1.0,1.0};
UF_MODL_trim_object_t trim_objects[2];
UF_MODL_trim_object_p_t trim_objects_p[2];
int num_gaps,return_code,discard = 0;
double proj_vector[] = {0.0,1.0,0.0};
double ptdata[] = {1.312,1.896,4.8,
4.464,3.312,2.4};
double *gap_pts,tol = 0.001;
/*
Create the b-surface.
*/
UF_CALL(UF_MODL_create_bsurf(bsurf_idata[0],
bsurf_idata[1],
bsurf_idata[2],
bsurf_idata[3],
bsurf_uknot,
bsurf_vknot,
bsurf_poles,
&bsurf,
&knot_fixup,
&pole_fixup));
/*
Create the splines.
*/
UF_CALL(UF_MODL_create_spline(bcurv1_idata[0],
bcurv1_idata[1],
bcurv1_knots,
bcurv1_poles,
&bcurv1,
&knot_fixup,
&pole_fixup));
UF_CALL(UF_MODL_create_spline(bcurv2_idata[0],
bcurv2_idata[1],
bcurv2_knots,
bcurv2_poles,
&bcurv2,
&knot_fixup,
&pole_fixup));
/*
Build the trim_object structures.
*/
trim_objects_p[0] = &trim_objects[0];
trim_objects_p[1] = &trim_objects[1];
trim_objects_p[0]->object_tag = bcurv1;
trim_objects_p[0]->curve_project_method = 2;
trim_objects_p[1]->object_tag = bcurv2;
trim_objects_p[1]->curve_project_method = 2;
/*
Trim the sheet.
*/
return_code =
UF_CALL(UF_MODL_trim_sheet(bsurf,2,trim_objects_p,
proj_vector,discard,2,ptdata,
tol,&num_gaps,&gap_pts));
if (return_code == CURVES_HAVE_GAPS) UF_free(gap_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);
}
[/quote]