选择体绘制包裹体
/*********************************************************/#include <stdio.h>
#include <stdlib.h>
#include <uf.h>
#include <uf_attr.h>
#include <uf_cfi.h>
#include <uf_curve.h>
#include <uf_ui.h>
#include <uf_modl.h>
#include <uf_disp.h>
#include <uf_obj.h>
#include <uf_csys.h>
/************* unload alloc mem *************************/
/* UF_UNLOAD_SEL_DIALOG_UG_TERMINATE_IMMEDIATELY*/
static int init_proc(UF_UI_selection_p_t select,void* user_data)
{
int num_triples = 1; //只选择一种类型
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
if((UF_UI_set_sel_mask(select,
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
num_triples, mask_triples)) == 0)
{
return (UF_UI_SEL_SUCCESS);
}
else
{
return (UF_UI_SEL_FAILURE);
}
}
extern void ufusr( char *param, int *retcod, int param_len )
{
UF_initialize();
char cue[] = "简简单单:请选择单个体";
char title[] = "简简单单:请选择单个体";
int response=0;
tag_t object;
int count=0;
double cursor;
tag_t view;
int i=0;
double pt={0,0,0};
double z1={0,0,1};
UF_OBJ_translucency_t cyt=0;
L10:
UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);
if(response==UF_UI_BACK) goto L10;//如果点后退就跳转到L10
if(response==UF_UI_CANCEL) return; //如果点取消就退出
UF_DISP_set_highlight(object,0); //取消高亮显示
tag_t csys_tag;
double min_corner [ 3 ] ;
double directions [ 3 ] [ 3 ] ;
double distances [ 3 ] ;
UF_CSYS_ask_wcs(&csys_tag);
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);
char mesg_x;
sprintf(mesg_x,"%f",distances);
char mesg_y;
sprintf(mesg_y,"%f",distances);
char mesg_z;
sprintf(mesg_z,"%f",distances);
char *edge = {mesg_x,mesg_y,mesg_z};
tag_t blk_tag;
UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);
UF_MODL_ask_feat_body(blk_tag,&blk_tag);
UF_OBJ_set_translucency(blk_tag,100); //设置透明
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
/* uf_list_p_t ll;
UF_MODL_create_list(&ll);
UF_MODL_ask_body_edges(blk_tag,&ll);
int ww;
UF_MODL_ask_list_count(ll,&ww);
for (int i=0;i<ww;i++)
{
tag_t yy,curve1;
UF_MODL_ask_list_item(ll,i,&yy);
UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线
}*/
char box;
sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances,distances,distances);
uc1601(box,1);
goto L10;//透明之后继续回到选择的状态
UF_terminate();
return;
}
extern int ufusr_ask_unload()
{
return UF_UNLOAD_IMMEDIATELY;
}
Good Job! :lol,不容易啊 请问这个是用JA录制的吗
楼主好人啊,好人一生平安!
页:
[1]