//1.进入草图环境
char name[UF_OBJ_NAME_BUFSIZE] = "SKETCH";
tag_t sketTAG = NULL_TAG;
UF_SKET_initialize_sketch(name, &sketTAG);
//2.指定CSYS创建草图
double matrix[9] = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 };
tag_t object[2];
int reference[2];
int plane_dir = 2;
UF_SKET_create_sketch(name, 2, matrix, object, reference, plane_dir, &sketTAG);
//3.创建直线
UF_CURVE_line_t line;
line.start_point[0] = 0.0;
line.start_point[1] = 0.0;
line.start_point[2] = 0.0;
line.end_point[0] = 10.0;
line.end_point[1] = 10.0;
line.end_point[2] = 0.0;
tag_t lineTAG = NULL_TAG;
UF_CURVE_create_line(&line, &lineTAG);
//4.添加曲线到当前草图
tag_t objline[1] = { lineTAG };
UF_SKET_add_objects(sketTAG, 1, objline);
//5.线性尺寸
UF_SKET_dim_object_t dim_object1, dim_object2;
dim_object1.object_tag = lineTAG;
dim_object1.object_assoc_type = UF_SKET_end_point;
dim_object1.object_assoc_mod_value = UF_SKET_first_end_point;
dim_object2.object_tag = lineTAG;
dim_object2.object_assoc_type = UF_SKET_end_point;
dim_object2.object_assoc_mod_value = UF_SKET_last_end_point;
double dim_origin[3] = { 5, 12, 0 };
tag_t dim_tag = NULL_TAG;
UF_SKET_create_dimension(sketTAG, UF_SKET_horizontal_dim, &dim_object1, &dim_object2, dim_origin, &dim_tag);
//6.退出草图环境
UF_SKET_terminate_sketch();
创建草图,添加线性尺寸
最新推荐文章于 2024-06-07 20:11:45 发布