购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_DRF_create_gdt_symbol( int num_lines_text, char text_string [ ] [ MAX_LINE_LENGTH+1 ], double origin_3d [ 3 ], UF_DRF_leader_type_t leader_type, UF_DRF_leader_attach_type_t leader_attach_type, UF_DRF_object_p_t object, double model_pos_3d [ 3 ], UF_DRF_frame_corner_t frame_corner, tag_t* gdt_symbol_tag) 函数说明:
?创建并显示GD&T符号。
函数参数:
第1个参数为输入:
输入int 整数型的参数,参数的变量格式为num_lines_text,文本行数
第2个参数为输入:
输入char 字符类型的参数,参数的变量格式为text_string [ ] [ MAX_LINE_LENGTH+1 ],相关的文本字符串
第3个参数为输入:
输入double 双精度类型的参数,参数的变量格式为origin_3d [ 3 ],在WCS坐标3D对象原点
第4个参数为输入:
leader_type代表参数变量,UF_DRF_leader_type_t 为输入参数类型,领袖型UF_DRF_leader_type_none=无UF_DRF_leader_type_line=引线UF_DRF_leader_type_ext_line=延长线
第5个参数为输入:
leader_attach_type代表参数变量,UF_DRF_leader_attach_type_t 为输入参数类型,利达附件类型如果领导者类型= UF_DRF_leader_type_line,UF_DRF_leader附加对象=连接对象UF_DRF_leader_attach_screen=屏幕位置
第6个参数为输入:
object代表参数变量,UF_DRF_object_p_t 为输入参数类型,对象的数据附加领导看到uf_drf_types.h如果leader_type= UF_DRF_leader_type_line和leader_attach_type= UF_DRF_leader_attach_object,有效的对象类型:点,线,弧,二次曲线,三次样条,B曲线,实线。如果leader_type= UF_DRF_leader_type_ext_line有效的对象类型:行,直实线。如果leader_attach_type是UF_DRF_leader_attach_screen,则对象= NULL。
第7个参数为输入:
输入double 双精度类型的参数,参数的变量格式为model_pos_3d [ 3 ],3D模型空间中的位置。如果leader_attach_type= UF_DRF_leader_attach_object此位置被用作近似点在对象上附加的领导者如果leader_attach_type= UF_DRF_leader_attach_screen这一立场是领导者的终点
第8个参数为输入:
frame_corner代表参数变量,UF_DRF_frame_corner_t 为输入参数类型,框架角如果leader_type= UF_DRF_leader_type_ext_line UF_DRF_frame_upper_left=左上UF_DRF_frame_upper_right=右上角UF_DRF_frame_lower_left=左下UF_DRF_frame_lower_right=右下
第9个参数为输出:
gdt_symbol_tag代表参数变量,tag_t* 为输出参数类型,创建GD&T符号的对象标记。
UF_DRF_create_gdt_symbol函数实例代码演示:
这个例子创建一个GD&T的象征。
[quote]
#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_drf.h>
#include <uf_curve.h>
void ufusr(char *param, int *retcod, int param_len)
{
int status = 0;
int lines_of_text = 8;
static double origin[3] = {24.0, 7.0, 0.0};
static double base_pt[3] = {20.0, 5.0, 0.0};
char text[10][132+1];
char stat_msg[133];
tag_t text_aid_tag;
tag_t base_pt_tag;
UF_DRF_object_t object;
status = UF_initialize();
if (!status)
{
/* initialize the object structures */
UF_DRF_init_object_structure(&object);
/* create a base point */
status = UF_CURVE_create_point(base_pt, &base_pt_tag);
}
if (!status)
{
/* create a geometric dimensioning and tolerancing symbol */
strcpy(text[0], "GEOMETRIC DIMENSIONING <+>");
strcpy(text[1], "AND TOLERANCING SYMBOLS <+>");
strcpy(text[2], "<M><+><(><S><)><+><O>
<+>");
strcpy(text[3], "<&1><&2><&3><&4><&5&
gt;<&6><+>");
strcpy(text[4], "<&7><+><&8><+><&9>")
;
strcpy(text[5], "<&10><&11><&12><&13><&am
p;14>");
strcpy(text[6], "It points to the screen position at
(20,5).");
strcpy(text[7], "This is the LAST line<+>");
object.object_tag = NULL_TAG;
object.object_view_tag = NULL_TAG;
object.object_assoc_type = UF_DRF_end_point;
object.object_assoc_modifier = UF_DRF_first_end_point;
status = UF_DRF_create_gdt_symbol(lines_of_text, text,
origin,
UF_DRF_leader_type_line,
UF_DRF_leader_attach_screen,
&object, base_pt, UF_DRF_frame_none, &text_aid_tag);
}
printf("UF_DRF_create_gdt_symbol ");
if (status)
{
UF_get_fail_message(status, stat_msg);
printf("has ERROR %d: %s.\n", status, stat_msg);
}
else
printf("is successful.\n");
UF_terminate();
}
[/quote]