购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_DRF_create_perpendicular_dim( UF_DRF_object_p_t object1, UF_DRF_object_p_t object2, UF_DRF_text_t* drf_text, double dimension_3d_origin [ 3 ], tag_t* dimension_tag) 函数说明:
创建并显示垂直维度。
函数参数:
第1个参数为输入:
object1代表参数变量,UF_DRF_object_p_t 为输入参数类型,基(线)对象的数据(见uf_drf_types.h)有效对象类型:线,直链的,圆柱形的,对称的中心线,直实线,平面,圆柱面
第2个参数为输入:
object2代表参数变量,UF_DRF_object_p_t 为输入参数类型,点,线,弧,圆锥形,三次样条,B曲线,图案,实线,平面,圆柱面:第二物体有效目标类型的数据
第3个参数为输入:
drf_text代表参数变量,UF_DRF_text_t* 为输入参数类型,关联文本(见uf_drf_types.h)
第4个参数为输入:
输入double 双精度类型的参数,参数的变量格式为dimension_3d_origin [ 3 ],3D尺寸起源于WCS坐标
第5个参数为输出:
dimension_tag代表参数变量,tag_t* 为输出参数类型,创建的标注对象标记。
UF_DRF_create_perpendicular_dim函数实例代码演示:
这个例子创建一个垂直维度。
[quote]
#include <stdio.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;
static double point[3] = {2.0, 11.0, 0.0};
static double origin[3] = {4.0, 13.0, 0.0};
static char dimtxt[15+1] = " PERPENDICULAR ";
static char apptxt[3][132+1] = {"APPENDED TEXT",
"APP TXT LINE 2",
"APP TXT LINE 3"};
char stat_msg[133];
tag_t point_tag, line_tag, dimension_tag;
UF_CURVE_line_t line_coords;
UF_DRF_object_t object1, object2;
UF_DRF_text_t drf_text;
status = UF_initialize();
if (!status)
{
/* initialize the object structures */
UF_DRF_init_object_structure(&object1);
UF_DRF_init_object_structure(&object2);
/* load drf_text specification */
drf_text.user_dim_text = dimtxt;
drf_text.lines_app_text = 3;
drf_text.appended_text = apptxt;
/* create a point */
status = UF_CURVE_create_point(point, &point_tag);
}
if (!status)
{
/* create a line */
line_coords.start_point[0] = 10.0;
line_coords.start_point[1] = 11.0;
line_coords.start_point[2] = 0.0;
line_coords.end_point[0] = 5.0;
line_coords.end_point[1] = 13.0;
line_coords.end_point[2] = 0.0;
status = UF_CURVE_create_line(&line_coords, &line_tag);
}
if (!status)
{
/* create a perpendicular dimension */
object1.object_tag = line_tag;
object1.object_view_tag = NULL_TAG;
object1.object_assoc_type = UF_DRF_end_point;
object1.object_assoc_modifier = UF_DRF_first_end_point;
object2.object_tag = point_tag;
object2.object_view_tag = NULL_TAG;
object2.object_assoc_type = UF_DRF_end_point;
object2.object_assoc_modifier = UF_DRF_first_end_point;
status = UF_DRF_create_perpendicular_dim(&object1, &object2,
&drf_text, origin, &dimension_tag);
}
printf("UF_DRF_create_perpendicular_dim ");
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]