购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:
UF_MODL_ask_2dtrim_bsurf
(
tag_t face,
int opts [ 4 ],
double tolerance,
UF_MODL_bsurface_p_t bsurf,
int * loop_count,
int * * edge_count,
int * * edge_sense,
tag_t * * edge_bcurves
)
函数说明:
返回与输入脸或身体相关联的B面的数据(具有单个面)标记。在这种结构的基础数据应该是通过调用UF_MODL_free_bsurf_data释放。注:此功能支持所有类型的脸
函数参数:
第1个参数为输入:
face代表参数变量,tag_t 为输入参数类型,面部或身体(有单面)标签被询问道。对于所有类型的脸
第2个参数为输入:
输入int 整数型的参数,参数的变量格式为opts [ 4 ],转换选项[0] - 立方度(N/ A)[1] - 非理性的(N/ A)[2] - 非周期(1 - 是,0否)[3] - 标准化参数(1 - 是的,0-没有)
第3个参数为输入:
输入double 双精度类型的参数,参数的变量格式为tolerance,转换和SP-曲线公差
第4个参数为输出:
bsurf代表参数变量,UF_MODL_bsurface_p_t 为输出参数类型,返回B-表面信息。用户应分配一个UF_MODL_bsurface_t结构,并通过在一个指针于这种结构。这个程序将填补这一结构与动态分配的数据。这必须通过调用UF_MODL_free_bsurf_data释放。
第5个参数为输出:
输出int * 整数型的参数,参数的变量格式为loop_count,微调循环数
第6个参数为输出:
输出int * * 整数型的参数,参数的变量格式为edge_count,阵列中的每个环边缘CNT
第7个参数为输出:
输出int * * 整数型的参数,参数的变量格式为edge_sense,阵列的每个品种的边缘感
第8个参数为输出:
edge_bcurves代表参数变量,tag_t * * 为输出参数类型,阵列二维修剪曲线ID
UF_MODL_ask_2dtrim_bsurf函数实例代码演示:
说明:此文件包含以下外部函数支持bsurface功能:
UF_MODL_ask_bsurfUF_MODL_create_bsurfUF_MODL_edit_bsurf
#include <stdio.h>
#include <stdlib.h>
#include <uf.h>
#include <uf_part.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)
{
char *prtnam = "create_bsurf";
/* Points for B-surface */
double points[16][3] = { 3.5, 2.5, 0.0,
4.0, 2.6, 0.2,
4.5, 2.6, 0.2,
5.0, 2.5, 0.0,
3.3, 3.0, 0.2,
4.1, 3.2, 0.3,
4.5, 3.2, 0.3,
5.0, 3.0, 0.2,
3.0, 3.5, 0.2,
3.8, 3.6, 0.3,
4.5, 3.6, 0.3,
5.0, 3.5, 0.2,
2.6, 4.0, 0.0,
3.3, 4.0, 0.2,
4.5, 4.0, 0.2,
5.0, 4.0, 0.0 };
int create_mode = 1;
int u_closed_status = 0;
int v_closed_status = 0;
int u_degree = 3;
int v_degree = 3;
int num_rows = 4;
int pts_per_row[4] = {4, 4, 4, 4};
int ii, jj, kk, indx;
tag_t part_tag;
tag_t bsurf_obj_id = NULL_TAG;
UF_MODL_bsurf_row_info_t *pts_info_per_row; /* pts info for each row */
UF_MODL_bsurface_t bsurf;
/* Open a new part */
UF_CALL( UF_PART_new(prtnam, METRIC, &part_tag) );
pts_info_per_row = ( UF_MODL_bsurf_row_info_t *)malloc( num_rows *
sizeof(UF_MODL_bsurf_row_info_t) );
/* allocate and load point and other information for each row of points */
indx = 0;
for (ii=0; ii<num_rows; ii++)
{
pts_info_per_row[ii].num_points = pts_per_row[ii]; /* can vary */
pts_info_per_row[ii].points = (double *)malloc( pts_per_row[ii] * 3 *
sizeof(double) );
pts_info_per_row[ii].weight = (double *)malloc( pts_per_row[ii] *
sizeof(double) );
/* load up point and weight info */
for (jj=0, kk = 0; kk<pts_per_row[ii]; kk++, jj+=3, indx++)
{
pts_info_per_row[ii].points[jj] = points[indx][0];
pts_info_per_row[ii].points[jj+1] = points[indx][1];
pts_info_per_row[ii].points[jj+2] = points[indx][2];
pts_info_per_row[ii].weight[kk] = 1.0;
}
}
/* create B-surface */
UF_CALL(UF_MODL_create_bsurf_thru_pts( create_mode, u_closed_status,
v_closed_status, u_degree,
v_degree, num_rows, pts_info_per_row,
&bsurf_obj_id));
if ( bsurf_obj_id == NULL_TAG )
printf("*** ERROR CREATING B-SURFACE ***\n");
/* free allocated memory */
for (ii=0; ii<num_rows; ii++)
{
free(pts_info_per_row[ii].points);
free(pts_info_per_row[ii].weight);
}
free(pts_info_per_row);
/* ask the B-surface information */
UF_CALL(UF_MODL_ask_bsurf( bsurf_obj_id, &bsurf ));
/* validate the surface */
if ( (bsurf.order_u != u_degree+1) || (bsurf.order_v != v_degree+1) )
printf("*** ERROR ASKING B-SURFACE ***\n");
UF_CALL(UF_MODL_free_bsurf_data(&bsurf));
}
/*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);
}