购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_GEXP_edit_length( tag_t feature_tag, tag_t new_object, tag_t new_xform) 函数说明:
通过传递引用的新编辑的长度表达功能如果需要,目标和一个新的XForm。在重新计算长度传播到表达,和所有对象哪些引用其值更新到正确的值。调用例程必须调用UF_MODL_update()有编辑生效。
函数参数:
第1个参数为输入:
feature_tag代表参数变量,tag_t 为输入参数类型,长表情特征的标签进行编辑。
第2个参数为输入:
new_object代表参数变量,tag_t 为输入参数类型,对象的标签用于新编辑的长度。有效的对象类型是:UF_line_type UF_circle_type UF_spline_type UF_conic_type UF_solid_type发生的标签是不允许的。使用原型标签来代替。
第3个参数为输入:
new_xform代表参数变量,tag_t 为输入参数类型,对象转化标签。该标签为NULL TAG如果对象是在其中创建要素的相同部分。
UF_GEXP_edit_length函数实例代码演示:
以下代码编辑长度表达测量的长度的边缘测量行的长度。
[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_ui.h>
#include <uf_defs.h>
#include <uf_obj.h>
#include <uf_gexp.h>
#include <uf_object_types.h>
#include <uf_curve.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)
{
UF_CURVE_line_t line_coords;
double block_orig[3] = {0.0,0.0,0.0};
char *block_len[3] = {"1","2","3"};
tag_t blk_obj;
char *string;
int i=0;
char buf[UF_UI_MAX_STRING_LEN+1];
tag_t part, feat_tag, exp_tag, solid, solid_edge, line_tag;
int type, subtype;
UF_CALL(UF_MODL_create_block1(UF_NULLSIGN,block_orig,
block_len,&blk_obj));
UF_CALL(UF_UI_open_listing_window());
if((part=UF_PART_ask_display_part()) == NULL_TAG)
{
UF_UI_write_listing_window("Failed to get part tag\n");
return;
}
solid=NULL_TAG;
solid_edge=NULL_TAG;
while (i < 1)
{
type=UF_solid_type;
UF_OBJ_cycle_objs_in_part( part, type, &solid );
UF_OBJ_ask_type_and_subtype(solid, &type, &subtype);
if (!solid_edge && subtype == UF_solid_edge_subtype)
{
solid_edge=solid;
i++;
}
}
UF_CALL(UF_GEXP_create_length(solid_edge, NULL_TAG, &feat_tag,
&exp_tag));
UF_CALL(UF_MODL_ask_exp_tag_string(exp_tag,&string));
sprintf (buf, "Created length expression %s\n", string);
UF_UI_write_listing_window(buf);
line_coords.start_point[0] = 5.0;
line_coords.start_point[1] = 7.0;
line_coords.start_point[2] = 8.0;
line_coords.end_point[0] = 10.0;
line_coords.end_point[1] = 10.0;
line_coords.end_point[2] = 2.0;
UF_CALL(UF_CURVE_create_line(&line_coords, &line_tag));
UF_CALL(UF_GEXP_edit_length(feat_tag, line_tag, NULL_TAG));
sprintf (buf, "Edited length expression %s\n", string);
UF_CALL(UF_MODL_update());
UF_UI_write_listing_window(buf);
UF_free(string);
}
/*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]