uf垂直尺寸
#include <stdio.h>
#include <uf_defs.h>
#include <uf_drf.h>
#include <uf_curve.h>
/* TODO: Add your application code here */
//垂直尺寸标注
tag_t base_pt_tag1,base_pt_tag2;
UF_CURVE_line_t line_coords;
int status = 0;
status = UF_initialize();
if (!status)
{
double base_pt1[3] = {100.0, 100.0, 0.0};
double base_pt2[3] = {140.0, 140.0, 0.0};
// 创建点
status = UF_CURVE_create_point(base_pt1, &base_pt_tag1);
// 创建点
status = UF_CURVE_create_point(base_pt2, &base_pt_tag2);
}
if (!status)
{
tag_t dimension_tag;
UF_DRF_object_t object1, object2;
UF_DRF_text_t drf_text;
double origin[3] = {160.0, 70.0, 0.0};//【输入】尺寸位置点坐标
/* 尺寸附加文本内容 */
char dimtxt[15+1] = "HORIZONTAL DIM ";
drf_text.user_dim_text = dimtxt;
drf_text.lines_app_text = 0;// 文本行数 0=不加文本
//char apptxt[2][132+1]= {"APPENDED TEXT","APP TXT LINE"};
//drf_text.appended_text =apptxt;
/* 初始化的对象结构 */
UF_DRF_init_object_structure(&object1);
UF_DRF_init_object_structure(&object2);
// 获得点标识
object1.object_tag = base_pt_tag1;
object1.object_view_tag = NULL_TAG;
object1.object_assoc_type = UF_DRF_end_point;
// 获得点标识
object2.object_tag = base_pt_tag2;
object2.object_view_tag = NULL_TAG;
object2.object_assoc_type = UF_DRF_end_point;
/* 垂直尺寸标注*/
status = UF_DRF_create_vertical_dim(
&object1, //【输入】对象结构
&object2, //【输入】对象结构
&drf_text, //【输入】附加文本
origin, //【输入】尺寸位置点坐标
&dimension_tag); //【输出】
//删除点
//UF_OBJ_delete_object(base_pt_tag1);
// UF_OBJ_delete_object(base_pt_tag2);
}
if (status)
{
char stat_msg[133];
UF_get_fail_message(status,stat_msg);
uc1601(stat_msg,1);
}
/* Terminate the API environment */
_____________________________________________________________________________ _
中磊UG二次开发教程 梅雷著 qq1821117007
学UG就上UG网 http://www.9sug.com/ |