|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/
7 R; j: j6 k2 V% V8 f/ x: y& ^#include <stdio.h>/ l" Z$ e! i9 f7 Z
#include <stdlib.h>; e6 K( G/ }1 Q2 h
#include <uf.h>
" |2 a% l* I4 Q& ~; x* l; V2 @#include <uf_attr.h>1 ^4 c1 P2 L: j. f. [- ] u$ }: I
#include <uf_cfi.h>, \) W6 n; M2 k6 Z2 z( P7 x- I
#include <uf_curve.h>
+ U N# c* `$ n, U) G, ]2 m#include <uf_ui.h>5 l8 y, ~0 J9 b$ j! k
#include <uf_modl.h>
. u1 i/ S0 m' ]% y#include <uf_disp.h>
3 }8 x( E8 d5 n$ C5 P: I#include <uf_obj.h>
( m: N& ~& o8 O. u#include <uf_csys.h>
) R/ B. L& B8 y5 C w7 {; ?1 Z
/ t! ?7 s6 _, B# k& v$ X: }# U& o1 n% y' [: n1 W
/************* unload alloc mem *************************/
! c2 F0 P1 c" _5 W: M4 d. K/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
$ p; c3 ~! e P4 @1 m
8 u/ R. v u, l: u4 S3 A5 s5 Qstatic int init_proc(UF_UI_selection_p_t select,void* user_data)
% e& s3 l" \+ t* C, F{
p; d4 w" u! l+ z' ~! D int num_triples = 1; //只选择一种类型9 N* q' b! r: ?, i
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
; ]% _9 Y0 z- P$ M6 F/ ]/ u if((UF_UI_set_sel_mask(select,9 M C% s: D) f) x; t" J
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
, p R- f8 @! x: ^. Q num_triples, mask_triples)) == 0)
" @' T+ l6 s- I* U8 q. Y {
) a9 g& `7 ]& e( j4 `8 b return (UF_UI_SEL_SUCCESS);1 R7 F9 E/ g! J1 W4 u
}$ n8 M6 l& g7 @* I
else
1 K: N0 E/ j9 _2 J! ~( V& A {/ K. {2 D/ S, l% Q
return (UF_UI_SEL_FAILURE);/ V- V, N* k; [. v
}- C+ x% o, G4 h. S, N$ w+ u8 M
}
3 P0 K' C! v3 J3 a' w, X
, h6 q; ~6 x4 v9 t- \, ~- F3 U; x( J5 M# E
extern void ufusr( char *param, int *reTCod, int param_len ) % y- h n% t, O6 @+ m: b
{- ~, ^0 z9 l1 @7 r4 k
UF_initialize();1 e1 D& R* {& R6 T
7 ]8 e7 q# p9 c' _! g, g) E! m
( s2 L) x; e# h4 I) Y char cue[] = "简简单单:请选择单个体";
2 p( q; G: m) p9 s2 }1 e& x o7 B char title[] = "简简单单:请选择单个体";0 i( S8 g: H8 u& d. I
int response=0; K8 p# k6 G% a/ o
tag_t object;, {) Q% G: S; N& S3 J2 x
int count=0;9 l% [* w$ p Q$ \4 V
double cursor[3];
+ b' |/ p' F& b% j tag_t view;; V+ ~; \* v1 {( x) N
int i=0;
7 x" Z4 d6 J. |* D3 \; ` double pt[3]={0,0,0};
2 V$ N5 R7 w- z) } double z1[3]={0,0,1};1 H- ], T% z& r
UF_OBJ_translucency_t cyt=0;* F! I7 \( y. B5 `
L10:
0 w8 G @% @) n! f$ z/ h UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);# d% @9 v1 O2 K% \
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10$ i9 n K9 i" w
if(response==UF_UI_CANCEL) return; //如果点取消就退出
) [+ ]/ \1 s& F$ @, u" b9 R! `* P( P4 t
UF_DISP_set_highlight(object,0); //取消高亮显示
5 X5 f! @" {+ i* d! C/ h( M: i tag_t csys_tag;
2 H1 {5 X! M/ v' F R double min_corner [ 3 ] ;
3 T. ?) \( d6 E% [ double directions [ 3 ] [ 3 ] ; ) r" Y* g& P9 w5 G
double distances [ 3 ] ;
' y1 c- \" s5 P UF_CSYS_ask_wcs(&csys_tag);: Z' i' U+ h% }/ l/ r: J1 [, v
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);8 o. M3 D. D: I
) w/ n0 D3 t) ~; P# m6 U" z) z+ W char mesg_x[256];9 ^) u; V# `# L) v$ F
sprintf(mesg_x,"%f",distances[0]);
' u6 g$ B3 n) i1 i9 b# C9 l' m ' n& j$ U4 C6 R2 u# H
char mesg_y[256];
, X& }3 g/ h" N( U8 f! E8 L1 u, T1 _2 B sprintf(mesg_y,"%f",distances[1]);
, ^& v8 [3 m9 v" X( [
" Q/ O; K& V0 U1 [. }. H9 ]! a* J6 k% G char mesg_z[256];. K1 u, j/ s0 [. d
sprintf(mesg_z,"%f",distances[2]);" s3 K; S; v3 ?9 L) p
* @* z, K# B% N5 b/ F char *edge[3] = {mesg_x,mesg_y,mesg_z};2 B% S2 e+ ]5 C9 @
tag_t blk_tag;
1 E" W0 i5 r! D% }: z$ e+ L1 F; ~' y4 d UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);$ q6 N' a9 K+ |6 Q; r% O
; }) b# Y9 \1 |
UF_MODL_ask_feat_body(blk_tag,&blk_tag);
- S1 o0 n g9 k6 s1 Y UF_OBJ_set_translucency(blk_tag,100); //设置透明6 x ~3 W$ \4 @4 A
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽( n* N4 ?4 ?2 w. @( ?! E7 j
UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
$ w+ L/ t! F2 M+ ^5 M3 s- w& u, J5 B+ B! H) m1 X
/* uf_list_p_t ll;5 x! J7 Z" C7 ]* q# t1 `! ?
UF_MODL_create_list(&ll);) f' I3 Q& G7 m2 g7 k N, [ \ {
UF_MODL_ask_body_edges(blk_tag,&ll);
, Q( a; e, d7 E# w1 T7 N int ww;
7 w6 A+ H A* l) t% } UF_MODL_ask_list_count(ll,&ww);& A4 {* D- v) P2 h. K2 N- G
for (int i=0;i<ww;i++)
* {. v& `, p! y3 C& A; ? {. T5 M( X% G- n% `' R) }
tag_t yy,curve1;
7 A' E; e1 ^ [5 e! E L UF_MODL_ask_list_item(ll,i,&yy);
1 j0 a/ I) t# v" }- y UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线
9 E, D' Z% B4 a; @8 Z }*/5 u7 l( N" H8 t, G
char box[256];
! ]3 P2 j- c1 k( n sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);. j2 V6 t( @1 r* R, L+ k
uc1601(box,1);
; a$ @( H) c0 H5 D8 r
" Q ~- Q* g, P goto L10; //透明之后继续回到选择的状态- D% |+ a! y- i1 I B, a" Y
* M0 N4 p$ Y4 ?$ U2 Z 1 n$ z @# \- P# x2 g0 J& D
+ a& M/ w$ u% Z; f
' w u& }+ t% [/ ?( f1 B* s2 o4 w- ^( h. t) Y) S
UF_terminate();
@. |* z/ I6 Y# C return;
+ f; h. g; g9 J% r3 I}
+ Q1 S* Y/ t7 s1 C1 d/ U& K# ]$ y1 z9 R" p
* N# K M7 `+ @7 u7 u
extern int ufusr_ask_unload()
: h' q! S! v) D. E2 x( S7 W" Y{1 N% Y/ B0 ]. `) A
return UF_UNLOAD_IMMEDIATELY;7 I T* M$ v9 o" R6 g
}: M k* ~) G4 j# F4 i& C0 u
! S4 [9 ^: r. t% C" R7 R |
-
-
评分
-
查看全部评分
|