点击查看详细介绍

UF_DRF_create_ordorigin() 函数的参数解释说明、函数详细用法,以及实例代码演示

misnn 6年前 1237 0

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


函数结构:
UF_DRF_create_ordorigin
(
UF_DRF_object_p_t object,
int positive_quad_id,
int arr_dim_line_display,
int origin_symbol_display,
char* user_object_name,
tag_t* origin_tag
)

函数说明:
创建和显示的坐标原点。

函数参数:
第1个参数为输入:
object代表参数变量,UF_DRF_object_p_t 为输入参数类型,对象的数据(见uf_drf_types.h)有效的对象类型:点,线,弧,二次曲线,三次样条,B曲线,花纹,实线,偏移中心点,圆柱形,对称中心线相交的象征,起草点

第2个参数为输入:
输入int 整数型的参数,参数的变量格式为positive_quad_id,正象限标识符会决定尺寸的迹象1 =右上2=左上3 =右下4 =左下5 =所有象限

第3个参数为输入:
输入int 整数型的参数,参数的变量格式为arr_dim_line_display,箭头和标注线显示1=无2= YES

第4个参数为输入:
输入int 整数型的参数,参数的变量格式为origin_symbol_display,产地符号显示1 =产地名2=无显示

第5个参数为输入:
输入char* 字符类型的参数,参数的变量格式为user_object_name,用户提供的对象名

第6个参数为输出:
origin_tag代表参数变量,tag_t* 为输出参数类型,创建坐标原点的对象标记。

UF_DRF_create_ordorigin函数实例代码演示:
这个例子创建一个坐标原点。
[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]

0

最新回复 (0)
请登录后发表新帖