|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/*********************************************************/. S, @* H& N* W" l3 M1 y5 t
#include <stdio.h>
7 w; r* e; Q: C& b; |* _4 P#include <stdlib.h>
6 V: Q. D1 j0 K+ C4 U: Y. M#include <uf.h>0 `4 `) x* v6 k) d) \" _
#include <uf_attr.h>0 s4 o1 t$ s% ]; g
#include <uf_cfi.h>
2 g/ {, j/ H3 b" W1 Q4 @/ ]#include <uf_curve.h>
8 |) M) P9 _# _; @5 j. X( j4 C#include <uf_ui.h>/ B+ ^6 c5 @" a' R0 H4 |" ?
#include <uf_modl.h>
8 ]. Z/ T# H1 u#include <uf_disp.h>
7 ~0 T2 a' h3 ~+ {. U#include <uf_obj.h>
4 q) A% O5 y _- m2 D. |#include <uf_csys.h>: e% b3 }& u1 w3 A# f
1 x: F7 ]2 @8 K/ q3 s: N
7 @9 t1 e$ l2 Y6 p8 J/************* unload alloc mem *************************/
6 t. D$ r* T6 I- M& X/* UF_UNLOAD_SEL_DIALOG _UG_TERMINATE _IMMEDIATELY */
# L* c& }) X# {, w0 Y
! Z. F q2 e2 Q8 Cstatic int init_proc(UF_UI_selection_p_t select,void* user_data)
. _$ U& M& \' E{
\; g4 O( H5 J* V3 v+ b$ u$ v int num_triples = 1; //只选择一种类型/ w' a$ I( e4 y3 u1 F* z, C
UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0,};5 ^8 A4 L1 M8 u( a4 v7 c% k5 r
if((UF_UI_set_sel_mask(select,
' E5 \; q G$ V4 V% {4 q$ ^ UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,8 s: s- \+ U9 E }
num_triples, mask_triples)) == 0)
) T/ L, `& R- F# m. E {, o4 ?* \! Y" L' D# ?6 a
return (UF_UI_SEL_SUCCESS);
; Z. w4 s$ {8 b- E2 Y1 c }
7 G+ S+ n, O- l% ~$ l! Y+ f else
3 K: l/ ?- a% O4 Y2 a5 c' j+ b {
$ d0 m2 o- @: \' W t* ] return (UF_UI_SEL_FAILURE); O0 F4 v& U) F! i
}
0 j$ \7 R; H* M; K5 e. _: T H}& t3 G' f' x; x- d
2 }! t* o/ P: z2 G* k E/ Y
9 U1 D, e2 Z0 Q, ~* _9 u) w* ~extern void ufusr( char *param, int *reTCod, int param_len )
0 f4 k- f& V, l{4 l! ^- a: G8 o- w" L" R; s" {5 x- }
UF_initialize();9 A: a4 P: Z8 l* e0 n5 ~5 S
/ d6 T$ G! c5 F8 u$ y9 D 2 u. A. V; }9 }& ]
char cue[] = "简简单单:请选择单个体";, @5 c0 ~/ n4 a2 g6 H* e1 \, b
char title[] = "简简单单:请选择单个体";" e& a$ L _0 I* d6 m
int response=0;; F- a: E. U* O
tag_t object;
1 X/ d) c/ g( [( x. A% Z8 x' |* Q, G4 k; g int count=0;% X. a; K4 k3 r
double cursor[3];
, r4 i$ z/ }5 ~ tag_t view;
1 M; x) j* ]' V# z4 X int i=0;
6 `1 v( [" N) o/ h" k- H double pt[3]={0,0,0};
6 P$ ^- [4 j9 s double z1[3]={0,0,1};7 j9 }$ z3 C$ i' |- A. z/ ?) o
UF_OBJ_translucency_t cyt=0;
6 Z7 w$ H0 {- w! u# ~L10:
" a G" z9 n% ?! h2 P UF_UI_select_with_single_dialog(cue,title,0,init_proc, NULL,&response,&object,cursor,&view);6 U1 t+ d; m( e& _
if(response==UF_UI_BACK) goto L10; //如果点后退就跳转到L10
8 H& z6 t1 x6 O" |& L if(response==UF_UI_CANCEL) return; //如果点取消就退出
# D4 A9 t( C8 A5 A1 Q5 b
9 Z; @8 i! ?( V8 t* E" L UF_DISP_set_highlight(object,0); //取消高亮显示/ B7 ]) B) E! k3 U
tag_t csys_tag;
( v" J1 w$ l8 [3 D# P, v7 B% V! j double min_corner [ 3 ] ; : N$ f. z4 _. O, {) L3 L' i. O
double directions [ 3 ] [ 3 ] ;
! f, _/ @/ \3 q8 h double distances [ 3 ] ;+ i8 G' t2 U# b7 Z
UF_CSYS_ask_wcs(&csys_tag);
- F# U4 U* X$ i UF_MODL_ask_bounding_box_exact(object,csys_tag,min_corner,directions,distances);
9 r; }% |1 t3 l' L$ T' N8 @% \. v- M. F/ |% R8 x! i- D' X
char mesg_x[256];* j1 r7 N. }* s7 k3 ~
sprintf(mesg_x,"%f",distances[0]);# J" Q0 e( J& R7 l) A
1 D. i8 S1 e" Z$ z5 [
char mesg_y[256];5 P1 B; f% t* b9 s( d0 B$ Z
sprintf(mesg_y,"%f",distances[1]);6 p1 E) @* t9 G4 m, E8 `
; M: Q" o- T3 H
char mesg_z[256];
; r! y- S) \! | k1 p; s+ I sprintf(mesg_z,"%f",distances[2]);* _1 o3 f) a% N) w8 [; x Z0 Z' Q
1 J( I8 a1 b% C$ v4 ~% N7 Z4 a char *edge[3] = {mesg_x,mesg_y,mesg_z};
( ]. c" L2 B U: Z: Z+ |( V5 ^ tag_t blk_tag;
) T2 H! u! e5 U& S$ R, B UF_MODL_create_block1(UF_NULLSIGN,min_corner,edge,&blk_tag);) a" _$ I7 P" {0 X; [. J+ V; M
% m) V I; O8 D& J; N UF_MODL_ask_feat_body(blk_tag,&blk_tag);
, W% X4 d2 H2 i* x UF_OBJ_set_translucency(blk_tag,100); //设置透明9 V. W# {9 Q& A e
UF_OBJ_set_line_width(blk_tag,UF_OBJ_WIDTH_5 ); //设置线宽
% f. u5 l& G, U UF_OBJ_set_font(blk_tag,UF_OBJ_FONT_CENTERLINE); //设置线型
& e4 Z. J+ r6 Y* y
8 p3 m, [0 y6 x: ^0 k9 @8 p/* uf_list_p_t ll;
6 m3 y( O; V) b/ x UF_MODL_create_list(&ll);/ D4 P+ ^# f" S3 K ]
UF_MODL_ask_body_edges(blk_tag,&ll);
% I3 {) z( o0 a* A9 c int ww;
9 l. Q, J7 V5 ?4 } UF_MODL_ask_list_count(ll,&ww);
6 q$ {" w, _% G for (int i=0;i<ww;i++)
* D. X/ f9 S" Y6 f2 E& J {
' x- n$ S& W, T/ i& P4 _( C I: ^ tag_t yy,curve1; % ?$ {3 W9 B$ ~
UF_MODL_ask_list_item(ll,i,&yy);
* w) z* y5 ^$ a" ? Q4 O UF_MODL_create_curve_from_edge(yy,&curve1); //抽取曲线
/ n4 j( ?: D: `/ m }*/
2 E! k! |- ?, h char box[256];
& c# S/ q/ ?* w5 O3 v sprintf(box,"简简单单:对象尺寸(X-Y-Z):*%.2f X %.2f X %.2f",distances[0],distances[1],distances[2]);
# Q) \5 s1 Y' L: H9 b uc1601(box,1);+ O3 h# {& z% h, o+ m" @( j
5 X2 u0 J, V( H: N' Q; Z0 N# v
goto L10; //透明之后继续回到选择的状态5 ] M. z7 f0 m4 o% j& f! {
- M! o1 Z! }! e& |: |- ?
( o2 ~& O) [/ q1 t ^1 s8 ]+ D9 S* z/ i% z: g
1 A& z2 ^& P, u6 X; Y. w
w( \9 n+ Y! }& X7 `: f! P% d UF_terminate();
( J( R6 q/ D& O8 L9 h5 e return;/ Q3 G( E0 \$ r* A7 k) ]
}( y6 J* U7 X# ^6 w* I# K: n% Z0 o; h
0 ]' L' O9 n$ H8 D- a8 O+ H b w6 ~
: j+ q. S/ }4 [ c; n7 eextern int ufusr_ask_unload(); \9 [$ z( z* |* k: |
{
o! f9 i6 I% k6 r6 w7 J5 h1 Y return UF_UNLOAD_IMMEDIATELY;$ Q! ]& C$ @; ?* f' }
}
% Y' `2 E* a* G1 I6 [4 ?$ v0 v+ l$ \/ k# u3 v( B" v. Q4 Z
|
-
-
评分
-
查看全部评分
|