购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_FACET_find_edge_in_facet( tag_t model, int facet_id, double vertex_1 [ 3 ], double vertex_2 [ 3 ], int * sense, int * edge_id) 函数说明:
如果一个指定的边缘出现在特定的方面确定。
函数参数:
第1个参数为输入:
model代表参数变量,tag_t 为输入参数类型,该模型
第2个参数为输入:
输入int 整数型的参数,参数的变量格式为facet_id,小面的ID。
第3个参数为输入:
输入double 双精度类型的参数,参数的变量格式为vertex_1 [ 3 ],在边缘的第一次顶点。这是一个3维空间(X,Y,Z)的位置。
第4个参数为输入:
输入double 双精度类型的参数,参数的变量格式为vertex_2 [ 3 ],在边缘的第二顶点。这是一个3维空间(X,Y,Z)的位置。
第5个参数为输出:
输出int * 整数型的参数,参数的变量格式为sense,在小面的边缘的感觉。这就是:0如果沿出现vertex_1 - >顶点21,如果边缘显示为顶点V2 - > vertex_1
第6个参数为输出:
输出int * 整数型的参数,参数的变量格式为edge_id,在小面的边缘的标识。
UF_FACET_find_edge_in_facet函数实例代码演示:
这个例子创建一个面模型和两个方面其中有一个常见的边缘。然后,它使用顶点从一个共享的边缘面来发现其他小面的对应边的edge_id。最后,加入沿着共享边缘的两个方面。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_assem.h>
#include <uf_facet.h>
static void example4( void );
#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)
{
example4();
}
/*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);
}
static void example4( void )
{
tag_t part_tag;
tag_t new_model;
double facet_vertices[30][3];
int adjacencies[30];
int facets[7];
int sense;
int shared_edge_id;
/*
First create a part in which we will initially create a
block.
*/
UF_CALL(UF_PART_new( "uf_facet_exp4_test_part",
1 /* MM */,
&part_tag )); /* 1 = mm */
UF_CALL(UF_ASSEM_set_work_part( part_tag ));
UF_CALL(UF_FACET_create_model( part_tag, &new_model ));
facet_vertices[0][0] = 0.0;
facet_vertices[0][1] = 0.0;
facet_vertices[0][2] = 0.0;
facet_vertices[1][0] = 0.03;
facet_vertices[1][1] = 0.05;
facet_vertices[1][2] = 0.0;
facet_vertices[2][0] = 0.060;
facet_vertices[2][1] = 0.0;
facet_vertices[2][2] = 0.0;
adjacencies[0] = UF_FACET_NULL_FACET_ID;
adjacencies[1] = UF_FACET_NULL_FACET_ID;
adjacencies[2] = UF_FACET_NULL_FACET_ID;
UF_CALL(UF_FACET_add_facet_to_model( new_model,
3,
facet_vertices,
NULL,
adjacencies,
facets+0 ));
facet_vertices[0][0] = 0.0;
facet_vertices[0][1] = 0.0;
facet_vertices[0][2] = 0.0;
facet_vertices[1][0] = 0.060;
facet_vertices[1][1] = 0.0;
facet_vertices[1][2] = 0.0;
facet_vertices[2][0] = 0.03;
facet_vertices[2][1] = 0.03;
facet_vertices[2][2] = 0.05;
UF_CALL(UF_FACET_add_facet_to_model( new_model,
3,
facet_vertices,
NULL,
adjacencies,
facets+1 ));
/* Check that an edge exists in both facets.*/
UF_CALL(UF_FACET_find_edge_in_facet( new_model,
facets[0],
&(facet_vertices[0][0]),
&(facet_vertices[1][0]),
&sense,
&shared_edge_id
));
printf( "Shared edge in first facet is %d\n",
shared_edge_id );
/*
Stitch the two facets together along the shared edge.
*/
UF_CALL(UF_FACET_set_adjacent_facet( new_model,
facets[0],
shared_edge_id,
facets[1] ));
}
[/quote]