|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/
+ h* i T& O: A$ H+ o* s( t* L#include <stdio.h>( c% t- M9 Z6 O; K; n$ D7 \) L
#include <stdlib.h>" B5 ^5 Z6 B; b9 l
#include <uf.h>" a! [$ n& ?7 \0 l }
#include <uf_attr.h>
8 E, Z' _* m9 R$ L#include <uf_cfi.h>
3 ]0 `: T# v0 P" f#include <uf_curve.h>! Q+ s2 s5 T1 l
#include <uf_ui.h>; d. P+ ?; n, P, J
#include <uf_modl.h>5 j8 {+ L7 u. l8 i
#include <uf_disp.h>
# Q8 R' {! l3 ~! A" Z#include <uf_obj.h>
& u1 U% Z: b; R$ |! `6 E#include <uf_csys.h> o1 ^! A8 z9 _, k" @/ G
6 p# k' C8 l, p: `" @1 F7 e. b2 y1 ]7 k, y0 v
/************* unload alloc mem *************************/* E+ e9 Z* Q9 m' {& B
/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
2 P, K- X# X1 c! T0 _ |
2 U& o* x) K9 F& K: ystatic int init_proc(UF_UI_selection_p_t select,void* user_data)" l: M* q7 B! u: I$ F
{ j0 h9 J' r8 P" P8 O `/ ~
int num_triples = 1; //只选择一种类型
- M; L# d# Z U& g. Y4 K' e UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};
, |& L6 p2 J. s: M# W( i if((UF_UI_set_sel_mask(select,! ]' f: f6 L3 |
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
) ?5 w$ j4 I. q7 B' [# r- ? num_triples, mask_triples)) == 0)* R, L9 u# K2 V- V" f( w6 b5 W
{' H+ C/ O: O$ k$ k
return (UF_UI_SEL_SUCCESS);
m3 b1 m8 Y- y! A5 d }
* \) }9 }' C8 x) Q; n else
# Y/ t {- S8 P9 Q {6 |; ^1 s+ j: U
return (UF_UI_SEL_FAILURE);7 E5 b5 J" O8 ~4 U8 f5 f
}
. K; W' i' g# b5 j# r. c/ [}
, _! I/ k- E: t' `. Y( O% n) q' ]: g! y+ n# t1 X
: i* J/ i2 c' h# l) W7 w, t
extern void ufusr( char *param, int *reTCod, int param_len )
8 i$ h! y# {, E' S5 o{; m$ F1 o& I" C: s; u$ V P
UF_initialize();' h- b I% E6 p5 q7 M8 o1 G
) h2 F. G4 G( ^" ^. {, m
4 B4 D, z2 M6 }: l char cue[] = "简简单单:请选择单个体";
$ g; O1 i- W* H5 V }% @ char title[] = "简简单单:请选择单个体";
; S2 d( a- X! @+ _. L0 f) C int response=0;( k# U7 Y4 d( B M3 ?' e9 g. `
tag_t object;0 [8 p$ b% w- M
int count=0;1 A& R9 [2 p% u
double cursor[3];
0 r9 A3 [# |/ W, t" g/ I tag_t view;0 b, \$ e& Q5 v9 `! j# ?$ e& N
int i=0;
?& c# E, R4 h) D double pt[3]={0,0,0}; r5 U; a) W3 X$ @( _6 y; e$ \
double z1[3]={0,0,1};9 H: \8 }, q6 |; g& O
UF_OBJ_translucency_t cyt=0;2 Y, d: k' q) c7 [) H; s
L10:: w) M9 ^% Y- v0 o3 A' ]! d. r
UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);3 B* f: q8 K6 w2 z7 E) @* ^
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10
V; c1 W5 z9 f if(response==UF_UI_CANCEL) return; //如果点取消就退出4 W; ], H$ t4 X( T( O6 A7 l
" z9 p( e. e* _3 r
UF_DISP_set_highlight(object,0); //取消高亮显示" n9 q2 `+ r( o1 v: Y( k
tag_t csys_tag;
9 G& k3 n. b3 c double min_corner [ 3 ] ; $ v$ V& H4 w7 i" C
double directions [ 3 ] [ 3 ] ;
2 X" S. J. Q, M* r: {+ @ double distances [ 3 ] ;
- T% U: N$ M- j7 S UF_CSYS_ask_wcs(&csys_tag);) V' ^5 y7 z- q% n
UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);
- \0 Z- I# b# N, w: j. E& ?. a# E- ?+ E( Y
char mesg_x[256]; W3 t( U e, x# B# _( O
sprintf(mesg_x,"%f",distances[0]);$ |. D9 J8 P- E0 m6 A4 ` }
1 \- _5 K) D! o C
char mesg_y[256];; Y) V$ f0 c k, N+ H/ V
sprintf(mesg_y,"%f",distances[1]);
% m0 t5 s! \' r0 d5 W% ~/ ^9 M p
! W, I- | k3 a char mesg_z[256];
! N5 e v& X, t5 _ sprintf(mesg_z,"%f",distances[2]);
2 T6 M( H# W7 v: D0 ?+ _' E 7 Z7 H. _+ g4 _1 X
char *edge[3] = {mesg_x,mesg_y,mesg_z};
/ z1 t }; B$ I C8 F tag_t blk_tag;
3 p1 _% i5 Q5 a- z( K UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);) E2 q# _% E( V) Z
& D3 f1 [/ s8 g
UF_MODL_ask_feat_body(blk_tag,&blk_tag);
& p# {1 B8 ]0 _ y* n6 ~ UF_OBJ_set_translucency(blk_tag,100); //设置透明8 }3 Y- V, G8 f9 S4 D
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
% C ^# o0 Q9 G4 v UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型( r) N9 [$ I( S% ~: W( g
) O* W0 @, X$ q% }1 Q' e7 ~2 T/* uf_list_p_t ll;
5 B6 `8 C2 `9 M M UF_MODL_create_list(&ll);! h( D8 o! X$ e J( M
UF_MODL_ask_body_edges(blk_tag,&ll);
' _; J& }# j: Y int ww;0 c; W* E S" }: T; o) ]
UF_MODL_ask_list_count(ll,&ww);
* V6 ]6 _/ |3 z% b! Z for (int i=0;i<ww;i++)( x! }, G& U7 ?/ @2 d
{
: z8 H1 ~4 F: r1 ] tag_t yy,curve1;
( y. _/ }; Z! h! z1 R UF_MODL_ask_list_item(ll,i,&yy);
# s: D8 [) C0 F+ ^3 ~& V1 @ UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线7 A/ U$ d* H5 N7 Q( D/ U
}*/% G L; o; j/ x0 I+ B# p; T
char box[256];2 a1 H$ E, a, r% ?
sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);$ ?! `9 e5 |& O, F5 l3 \
uc1601(box,1);! B" Y D" @3 s8 ^3 n) i
, ~* E4 J# I; l: Q goto L10; //透明之后继续回到选择的状态6 e( t1 _/ c3 W& g3 U% R4 R2 I
8 M1 |8 |5 w( O3 n' D: y a
" ?9 F, e9 E9 {4 O+ x# n+ \* j- \9 A
1 j) W! j; a2 L% X
" I; h% I8 B% N
" l/ T4 ?" i( r+ X UF_terminate();, w# V7 c1 T+ p7 r+ o" O
return;+ J* A' p0 X0 ~) n b% M2 g
}
6 @1 p# d$ f* O: A7 B- r
9 {7 z' R! z" @* ^9 O9 l' n: s
' P+ M( o- N& a7 Q7 e! L3 G% Xextern int ufusr_ask_unload()
3 b5 E4 [* {6 F/ y. c) p{
; c6 F; _3 I* `9 L return UF_UNLOAD_IMMEDIATELY;# }# ]$ e0 W; s1 G0 u3 N/ i. _$ ~
}) `% m, u3 B% @* l w4 B* ~. D- \
3 p' b: q* |) c+ S
|
-
-
评分
-
查看全部评分
|