购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_DRF_create_ordmargin( int margin_type, tag_t ordinate_origin_tag, UF_DRF_object_p_t object, double margin_xy_point [ 3 ], double margin_xy_direction [ 2 ], double offset_distance, tag_t* margin_tag) 函数说明:
创建和显示的坐标空间。
函数参数:
第1个参数为输入:
输入int 整数型的参数,参数的变量格式为margin_type,保证金类型1 =2的水平垂直=
第2个参数为输入:
ordinate_origin_tag代表参数变量,tag_t 为输入参数类型,纵坐标原点标签
第3个参数为输入:
object代表参数变量,UF_DRF_object_p_t 为输入参数类型,线对象的数据(见uf_drf_types.h)
第4个参数为输入:
输入double 双精度类型的参数,参数的变量格式为margin_xy_point [ 3 ],X,(如果需要在对象结构中的对象标记为空,否则将被忽略)在距y点
第5个参数为输入:
输入double 双精度类型的参数,参数的变量格式为margin_xy_direction [ 2 ],X,(如果需要在对象结构中的对象标记为空,否则将被忽略)保证金Y方向
第6个参数为输入:
输入double 双精度类型的参数,参数的变量格式为offset_distance,偏移距离
第7个参数为输出:
margin_tag代表参数变量,tag_t* 为输出参数类型,创建纵缘的对象标记。
UF_DRF_create_ordmargin函数实例代码演示:
这个例子创建一个坐标空间。
[quote]
#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_drf.h>
#include <uf_curve.h>
#include <uf_csys.h>
void ufusr(char *param, int *retcod, int param_len)
{
int status = 0;
/* positive quadrant: 1 = upper right; 2 = upper left */
/* 3 = lower right; 4 = lower left */
/* 5 = all quadrants */
static int pos_quad = 1;
/* arrow display: 1 = no; 2 = yes */
static int arrow_disp = 2;
/* origin symbol display: 1 = origin name; 2 = no display */
static int origin_disp = 1;
/* margin type: 1 = horizontal; 2 = vertical */
static int margin_type = 1;
/* dimension type: 1 = horizontal; 2 = vertical */
static int dim_type = 1;
/* text origin flag: 1 = center of total text box */
/* 2 = center of dimension text box */
static int text_origin = 1;
static double offset = 3.0;
/* distance from object center for dogleg */
static double dogleg_dist = 1.0;
static double dogleg_angle = 30.0;
static double origin[3] = {-5.0, -5.0, 0.0};
static char user_text[133];
static char append_text[4][133];
char stat_msg[133];
tag_t wcs, arc1_tag, arc2_tag, line_tag;
tag_t origin_tag, margin_tag, dimension_tag;
UF_CURVE_arc_t arc_coords;
UF_CURVE_line_t line_coords;
UF_DRF_object_t object;
UF_DRF_text_t drf_text;
status = UF_initialize();
if (!status)
{
/* initialize the object structures */
UF_DRF_init_object_structure(&object);
/* create two arcs */
UF_CSYS_ask_wcs(&wcs);
UF_CSYS_ask_matrix_of_object(wcs, &arc_coords.matrix_tag);
arc_coords.start_angle = 0.0;
arc_coords.end_angle = TWOPI;
arc_coords.arc_center[0] = 15.0;
arc_coords.arc_center[1] = 15.0;
arc_coords.arc_center[2] = 0.0;
arc_coords.radius = 1.0;
status = UF_CURVE_create_arc(&arc_coords, &arc1_tag);
}
if (!status)
{
arc_coords.arc_center[0] = 25.0;
arc_coords.arc_center[1] = 5.0;
status = UF_CURVE_create_arc(&arc_coords, &arc2_tag);
}
if (!status)
{
/* create a line */
line_coords.start_point[0] = 0.0;
line_coords.start_point[1] = 0.0;
line_coords.start_point[2] = 0.0;
line_coords.end_point[0] = 4.0;
line_coords.end_point[1] = 0.0;
line_coords.end_point[2] = 0.0;
status = UF_CURVE_create_line(&line_coords, &line_tag);
}
if (!status)
{
/* create an ordinate origin */
strcpy (user_text, "ORD ORG");
object.object_tag = arc1_tag;
object.object_view_tag = NULL_TAG;
object.object_assoc_type = UF_DRF_arc_center;
object.object_assoc_modifier = 0;
status = UF_DRF_create_ordorigin(&object, pos_quad,
arrow_disp, origin_disp, user_text, &origin_tag);
}
if (!status)
{
/* create an ordinate margin */
object.object_tag = line_tag;
object.object_view_tag = NULL_TAG;
object.object_assoc_type = UF_DRF_end_point;
object.object_assoc_modifier = UF_DRF_last_end_point;
status = UF_DRF_create_ordmargin(margin_type, origin_tag,
&object, NULL, NULL, offset, &margin_tag);
}
if (!status)
{
/* create an ordinate dimension */
strcpy (user_text, "");
strcpy (append_text[0], "ORD DIM");
/* load drf_text specification */
drf_text.user_dim_text = user_text;
drf_text.lines_app_text = 1;
drf_text.appended_text = append_text;
object.object_tag = arc2_tag;
object.object_view_tag = NULL_TAG;
object.object_assoc_type = UF_DRF_arc_center;
object.object_assoc_modifier = 0;
status = UF_DRF_create_orddimension(margin_tag, dim_type,
&object, dogleg_angle, dogleg_dist, &drf_text,
text_origin, origin, &dimension_tag);
}
printf("UF_DRF_create_ordorigin,_ordmargin,_orddimension ");
if (status)
{
UF_get_fail_message(status, stat_msg);
printf("have ERROR %d: %s.\n", status, stat_msg);
}
else
printf("are successful.\n");
UF_terminate();
}
[/quote]