iCAx开思工具箱
标题:
ug三维图转二维图的函数是什么?
[打印本页]
作者:
maoyu018
时间:
2004-7-23 09:49
标题:
ug三维图转二维图的函数是什么?
是啊,我找到了uc6481,ug帮助上说是add_view,但是我用了没效果啊,郁闷啊,谁能写个程序流程来,急用啊。
作者:
haiying
时间:
2004-7-23 11:08
给你个例子,希望能有所帮助!
#include <stdlib.h>
#include <stdio.h>
#include <uf_ui.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_draw.h>
#include <uf_draw_types.h>
#include <uf_obj.h>
#include <uf_part.h>
#include <string.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_defs.h>
#include <uf_drf_types.h>
#include <uf_obj.h>
void ufusr(char *param, int *retcod, int param_len)
{
int ifail = 0;
double reference_point[2] = {200, 100};
double reference_point1[2] = {200 , 400};
tag_t drawing_tag = NULL_TAG;
tag_t new_sxview_tag;
tag_t part_tag = NULL_TAG;
tag_t view_tag = NULL_TAG;
tag_t draw_view_tag = NULL_TAG;
tag_t ortho_view_tag = NULL_TAG;
tag_t parent_view_tag = NULL_TAG;
double view_placement_pt[2]={500,420};
double sxview_scale = 2.0;
double step_dir[3]={146,420,0};
double arrow_dir[3]={130,420,0};
UF_DRAW_proj_dir_t projection_direction = UF_DRAW_project_infer;
char error_message[133];
char drawing_name[MAX_ENTITY_NAME_SIZE] = "ymh";
UF_DRAW_info_t drawing_info;
drawing_info.size_state=UF_DRAW_CUSTOM_SIZE;
drawing_info.size.custom_size[0] = 594;
drawing_info.size.custom_size[1] = 841;
drawing_info.drawing_scale=1.0;
drawing_info.units=UF_PART_METRIC;
drawing_info.projection_angle=UF_DRAW_FIRST_ANGLE_PROJECTION ;
char *view_name1 = "TOP@1";
char *view_name = "TOP";
UF_DRAW_view_info_t view_info;
view_info.view_status = UF_DRAW_ACTIVE_VIEW;
view_info.anchor_point = NULL_TAG;
view_info.view_scale = 1.0;
view_info.use_ref_pt = FALSE;
view_info.inherit_boundary = TRUE;
ifail = UF_initialize();
if( !ifail )
part_tag = UF_PART_ask_display_part();
ifail = UF_DRAW_create_drawing( drawing_name, &drawing_info,
[$drawing_tag)]
if( !ifail && part_tag != NULL_TAG )
ifail = UF_DRAW_ask_current_drawing( [$drawing_tag )]
if( !ifail && part_tag != NULL_TAG && drawing_tag != NULL_TAG)
{
ifail = UF_OBJ_cycle_by_name( view_name, [$view_tag )]
if( !ifail && view_tag != NULL_TAG )
{
ifail = UF_DRAW_import_view( drawing_tag, view_tag,
reference_point, &view_info,
[$draw_view_tag )]}
if( !ifail && drawing_tag != NULL_TAG )
ifail = UF_OBJ_cycle_by_name( view_name1,
[$parent_view_tag )]
if( !ifail && view_tag != NULL_TAG )
{ ifail = UF_DRAW_add_orthographic_view( drawing_tag,
parent_view_tag,
projection_direction,
reference_point1,
[$ortho_view_tag )]
}
}
if( ifail )
{
ifail = UF_get_fail_message( ifail, error_message );
uc1601( error_message,1 );
}
else if( part_tag == NULL_TAG )
uc1601( "fails.\nError is: no active part.\n",1 );
else if ( drawing_tag == NULL_TAG )
uc1601( "fails.\nError is: no current drawing.\n" ,1);
else if ( view_tag == NULL_TAG )
uc1601( "fails.\nError is: invalid view tag.\n" ,1);
else
uc1601( "is successful.\n",1 );
ifail = UF_terminate();
}
图中的位置尺寸可根据你图形自己调整一下。
作者:
maoyu018
时间:
2004-7-23 16:22
太谢谢了。
欢迎光临 iCAx开思工具箱 (https://t.icax.org/)
Powered by Discuz! X3.3