点击查看详细介绍

UF_DRAW_edit_boundary_point() 函数的参数解释说明、函数详细用法,以及实例代码演示

misnn 9年前 894 0

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


函数结构:
UF_DRAW_edit_boundary_point
(
tag_t defining_point,
tag_t new_point,
tag_t view_tag
)

函数说明:
替换一个聪明的定义点关联视图边界一个新的智能界定点曲线。此功能可能会返回错误在UF_DRAW_define_view_boundary使用,因为当defining_pt是与new_pt更换,断线/细节边界被重新定义,基于新点位置。

函数参数:
第1个参数为输入:
defining_point代表参数变量,tag_t 为输入参数类型,的限定点的标签将被替换

第2个参数为输入:
new_point代表参数变量,tag_t 为输入参数类型,新点的标签将取代界定点。

第3个参数为输入:
view_tag代表参数变量,tag_t 为输入参数类型,谁的角度定义的视图标签被替换。该视图必须有一个断线/详细信息类型的边界,边界必须被关联到模型几何体(通过UF_DRAW_set_boundary_assoc)。

UF_DRAW_edit_boundary_point函数实例代码演示:
本示例创建的命名对象两款智能点(NAMEDLINE1和NAMEDLINE2)。然后设置视图与锚点边界联想和编辑的定义缔点(右侧和上部花键的左端点),将它们转移到智能点的位置。静态函数create_two_smart_points包含演示的创建聪明点。
[quote]
#include <stdlib.h>
#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_draw.h>
#include <uf_draw_types.h>
#include <uf_obj.h>
#include <uf_part.h>
#include <uf_so.h>
#include <uf_view.h>
static void create_two_smart_points
( tag_t part_tag,
tag_t view_tag,
tag_t point_tags[2] );
void ufusr(char *param, int *retcod, int param_len)
{
int ifail = 0;
int return_code = 0;
int curve_count = 0;
tag_t part_tag = NULL_TAG;
tag_t view_tag = NULL_TAG
tag_t new_point_tags[2] = {NULL_TAG, NULL_TAG};
tag_t defining_point_tag = NULL_TAG;
tag_t drawing_tag = NULL_TAG;
char error_message[133];
char * view_name = "TOP@1";
UF_DRAW_view_boundary_p_t boundary_curves;

ifail = UF_initialize();

if( ifail == 0 )
part_tag = UF_PART_ask_display_part();
if( ifail == 0 && part_tag != NULL_TAG )
ifail = UF_DRAW_ask_current_drawing( &drawing_tag );
if( ifail == 0 && drawing_tag != NULL_TAG )
ifail = UF_VIEW_ask_tag_of_view_name( view_name,
&view_tag );
if( ifail == 0 && view_tag != NULL_TAG )
create_two_smart_points( part_tag,
view_tag,
new_point_tags);

if( ifail == 0 && new_point_tags[0]!= NULL_TAG &&
new_point_tags[1] != NULL_TAG )
{
ifail = UF_DRAW_set_boundary_assoc( view_tag,
&curve_count,
&boundary_curves );
if( ifail == 0 && curve_count > 0 &&
boundary_curves[0].point_count > 0 )
{
/* the boundary point being edited
* is the last defining point of the
* first boundary curve */

defining_point_tag =
boundary_curves[0].defining_points
[boundary_curves[0].point_count -1];
ifail = UF_DRAW_edit_boundary_point(
defining_point_tag,
new_point_tags[0],
view_tag );
/* the boundary point being edited
* is the first defining point of the
* first boundary curve */

defining_point_tag =
boundary_curves[0].defining_points[0];
ifail = UF_DRAW_edit_boundary_point(
defining_point_tag,
new_point_tag[1],
view_tag );
/* ALWAYS update the view if you wish
* to see the correct view boundary */
return_code = UF_DRAW_update_one_view
(drawing_tag, view_tag );
}
}
printf("UF_DRAW_edit_boundary_point ");
if( ifail != 0 )
{
ifail = UF_get_fail_message( ifail, error_message );
printf( "fails.\nError is: %s\n", error_message );
}
else if ( part_tag == NULL_TAG )
printf( "fails.\nError is: no active part.\n" );
else if ( view_tag == NULL_TAG )
printf( "fails.\nError is: no ORTHO@2 view.\n" );
else if ( new_point_tags[0] == NULL_TAG ||
new_point_tags[1] == NULL_TAG )
printf( "fails.\nA new point was not created.\n");
else if ( curve_count == 0 )
printf("fails.\nError is: no curves in boundary.\n" );
else if ( boundary_curves[0].point_count <= 0 )
printf("fails.\nError is: no def. pts in 1st curve.\n");
else
printf( "is successful.\n" );

UF_DRAW_free_boundary(curve_count, boundary_curves);
ifail = UF_terminate();
}
static void create_two_smart_points
( tag_t part_tag,
tag_t view_tag,
tag_t point_tags[2] )
{
int return_code = 0;
tag_t line_tags[2] = {NULL_TAG, NULL_TAG};
tag_t scalar_tags[2] = {NULL_TAG, NULL_TAG};
char *line_name1 = "NAMEDLINE1";
char *line_name2 = "NAMEDLINE2"
return_code = UF_VIEW_expand_view( view_tag );
if ( return_code == 0 )
return_code = UF_OBJ_cycle_by_name( line_name1,
&line_tagS[0] );
if ( return_code == 0 )
return_code = UF_OBJ_cycle_by_name( line_name2,
&line_tags[1]);
if ( return_code == 0 && line_tags[0] != NULL_TAG &&
line_tags[1] != NULL_TAG )

/* Create two scalars.*/
return_code = UF_SO_create_scalar_double(
part_tag,
UF_SO_update_after_modeling,
0.648,
&scalar_tags[0] );
return_code = UF_SO_create_scalar_double(
part_tag,
UF_SO_update_after_modeling,
0.466,
&scalar_tags[1] );
if ( return_code == 0 && scalar_tags[0] != NULL_TAG &&
scalar_tags[1] != NULL_TAG)
{
return_code = UF_SO_create_point_on_curve(
part_tag,
UF_SO_update_after_modeling,
line_tags[0],
scalar_tags[0],
&point_tagS[0] );
return_code = UF_SO_create_point_on_curve(
part_tag,
UF_SO_update_after_modeling,
line_tags[1],
scalar_tags[1],
&point_tagS[1] );
}

return_code = UF_VIEW_unexpand_work_view();
return point_tag;
}



[/quote]

0

最新回复 (0)
请登录后发表新帖