|
|
- int ATT_EDT_CUSTOM_CAL ( int dialog_id,) g# C' I3 [" N: K0 E4 u
- void * client_data,& ~( p* d0 x: N6 i3 l) u
- UF_STYLER_item_value_type_p_t callback_data)% w V2 v$ z2 h! A. B( S8 ?* l/ ?
- {
& G# m! P$ @/ m. e2 F - UF_STYLER_item_value_type_t data; H( F) i& p9 r
- int stock_class=0;3 ?. f3 v$ b& y% Z$ g- K1 M8 J# @
- int count=0;
& M- w. \% z/ n, R i - tag_p_t objects;$ A. Y" N3 T8 {+ Q
- 4 e* T* V9 `" G
- //设置坐标系( ^8 P* |3 I3 w5 L$ _
- double csys_origin[3]={0.0,0.0,0.0};
2 ]( f" B6 [; H$ e/ }, L - tag_t matrix_id;
7 B3 N* n$ Y! e9 \$ F! S - tag_t csys_id ;. T5 i# {5 H& v& S+ U
- int option=15;, Z; }/ b+ R& ?% K
- double csys_matrix[9];& i1 G @2 u: ~: i5 e. O- w
- char title[40]="定义临时坐标系";& }! R0 H E5 i. M
-
. n) f; A8 o v( e% T8 @/ Q3 r
) L1 t: x( j$ @, { p- //毛坯尺寸
& D, l; _3 G6 [6 H- x9 x+ w/ C - char stock_size[256];; s+ ?0 M2 _$ U2 N6 O+ W4 c
- - l: \$ Q+ _/ B4 a1 w# [* C& k
- //坐标对齐边界盒
. u- \; e# R6 y' K6 @2 _8 c - logical expand=FALSE;
5 n$ v6 G. n: o+ o+ P - double min_corner[3]; ( }/ t/ ~- d% Q$ ?. H5 x7 n
- double directions[3][3]; + {4 S0 J, \, K8 U9 P
- double distances[3];
" S' {5 Z4 R9 V5 s. t! A
5 A3 e+ E; r- g* x k2 X' ]- //坐标系定义对话框返回值& E {8 t7 R; X1 k/ x- I/ f
- int response;& w# O) e- A: F4 n o
$ k/ b7 V! i6 g! q- - f Q3 c4 g) [+ A! c
- /* Make sure User Function is available. */ " H$ r* l5 o9 J( ]' r4 p5 |) h
- if ( UF_initialize() != 0)
9 F' e+ c- p2 W8 c! _3 C# ?- J1 N4 B - return ( UF_UI_CB_CONTINUE_DIALOG );
5 ^* w* G' b5 t
9 f, r8 f3 T7 t6 R* G2 S- /* ---- Enter your callback code here ----- */% ]1 e8 V& l7 G3 A, X9 z/ j9 o
- data.item_attr=UF_STYLER_SELECTION; ! A* {9 h: r3 l6 _) N
- data.item_id=UF_STYLER_DIALOG_INDEX;
$ p- C6 d$ a# ?$ Z: v( \7 C; O$ j - UF_STYLER_ask_value(dialog_id,&data);
5 m+ D, G* ~; [( ^- q - UF_UI_ask_sel_object_list(data.value.selection,&count,&objects);
* f6 O0 z7 K( \6 o* J - ! ?4 @) x, c; f* }3 p
- data.item_attr=UF_STYLER_VALUE;
+ a' r' T7 \- R [. g) L$ v - data.item_id=ATT_EDT_STOCK_CLASS;& v1 D. t9 ]4 M \
- UF_STYLER_ask_value(dialog_id,&data);
! _9 P k/ Y# ~$ N& ?; E - stock_class=data.value.integer;4 z% q& u6 F: z, t
- + z0 y+ ]1 w8 `# `6 @# o
- uc1630(title,&option,csys_matrix,csys_origin);
5 V1 b: `( R; i+ M! R' l - ! h* c2 H- g6 m" t- }- N" ] r; v4 A
- //定义坐标系
( _1 C- Y! v+ l$ z - if(0==stock_class)
0 |) ]' Z. p* Q% a. G- I6 d - {
! l* ~5 G4 r2 {5 P; p- ~( k7 S - uc1601("定义临时坐标系",0);
/ Z8 w3 [8 g. x+ ^: e - response=uc1630(title,&option,csys_matrix,csys_origin);7 f" x1 R. y) G: z4 z+ v4 i
- }: Q' h1 W1 ~+ o% ^1 b; a6 J, J) H5 ^% a
& X) Q/ p- f" l$ A0 ]3 b! F, m- if(0==count||3!=response). S. [+ b% A# u, H" J+ D" _& \
- {. x/ @+ C% R1 ] G
- uc1601("请选择实体或定义坐标系",1);+ C, ^1 n0 t [, j! X0 U
- }
" c6 B- |1 c9 Y5 |8 n3 ` - else if(3==response)
' N+ H" H/ F+ @# O W% [* V - {
& L/ @; k" W" s: C: y8 ], ~ - % w2 r& @! i/ K6 B$ L* ]3 V
- UF_CSYS_create_matrix(csys_matrix,&matrix_id);
8 F* @4 z8 H; H6 U - UF_CSYS_create_csys(csys_origin,matrix_id,&csys_id);% Q O' o; l: z" `8 b3 _ w
- ! M0 e% m$ u0 p6 A. p8 `
- UF_MODL_ask_bounding_box_aligned(objects[0],csys_id,expand,min_corner,directions,distances);8 C! S5 _& u+ E, m8 y. S" R- I
- ' @* M' M( r0 @ C, Z9 O
- stock_size_string(distances,stock_class,stock_size);1 \* w% s& O+ G7 n) X" E, m- a
- # h' [$ X `9 y# I3 f
- data.item_attr=UF_STYLER_VALUE; # {% w4 d$ \9 ^8 z
- data.item_id=ATT_EDT_MAT_DIM;
: ?- V, n. H2 L; S! M& t* s - data.value.string=stock_size;
4 [) J4 A7 k$ r" h9 ?5 m - / W# p% |; U% \1 x0 f
- UF_STYLER_set_value(dialog_id,&data);
2 `& p, `( F X F% W" i0 W6 |" ~ - UF_OBJ_delete_object(csys_id);
5 ]4 r$ D& b9 w. ^ - }# X6 y3 k7 `. B2 m
0 A' R) N! k, s- UF_terminate ();$ b- Q& o( g+ @- }( D2 R* M4 F9 `# o
& M% g' G/ e8 M4 o/ D c- /* Callback acknowledged, do not terminate dialog */
4 J/ S" G+ X& l' r- A9 Z! q4 c' y4 T! U - return (UF_UI_CB_CONTINUE_DIALOG); & Q4 i3 \$ V( y
-
) N# W& z) s1 g; B - /* or Callback acknowledged, terminate dialog. */
( N& c) B; @. t( e - /* return ( UF_UI_CB_EXIT_DIALOG ); */* p- F. p ?& o' o8 h4 o
$ D3 I7 [6 ]* U' M$ S4 y% C- }
+ _. A8 ^: ~; Z$ g1 o0 Z. F, n
复制代码 |
|