|
|
- int ATT_EDT_CUSTOM_CAL ( int dialog_id,
/ J) t3 y9 E6 m3 v - void * client_data,
1 s6 @. ^' I, y, _0 M2 j - UF_STYLER_item_value_type_p_t callback_data)
3 k2 C) U: m. K: y9 h% W& F - {
1 L) L. P/ q+ t& n% O0 D/ ] - UF_STYLER_item_value_type_t data;* I, P( l' w3 J) c% e. z* \
- int stock_class=0;
9 G) ~9 n5 p n0 c" `7 i1 ^ - int count=0;- S0 Z8 e0 C' j8 @/ _
- tag_p_t objects;
6 p" m( S! V1 G2 @ -
) i; i5 w0 {8 ? - //设置坐标系
! c G- t0 \9 b$ r9 h5 }$ K2 p* B( V f8 r - double csys_origin[3]={0.0,0.0,0.0};% T0 T8 ?8 e- T: N
- tag_t matrix_id;9 g. y$ d- o9 x9 ?# K, c7 Z
- tag_t csys_id ;
! R# c. k0 V, a8 i1 ~8 } - int option=15;
5 ]/ e& [# |5 M& g6 S8 n - double csys_matrix[9];
$ r0 I; x8 x3 ~, j" R* K: s( } - char title[40]="定义临时坐标系";
: b1 \' J" m% W2 F' o. K6 l - 4 T3 _) i8 W9 z# J9 l& |
2 W$ j! A; g r# B- //毛坯尺寸
# G4 {* B. d0 {2 t - char stock_size[256];. \) K. U% s# M- o
+ @* c3 U" A% b& m9 d8 a4 a- //坐标对齐边界盒& i5 a0 @) U2 V7 V5 d9 X3 }
- logical expand=FALSE;
; i- L1 e! D$ d5 t. G) m1 s - double min_corner[3];
! M0 l: W; e6 a2 ? - double directions[3][3]; $ ~2 R: [8 k9 }( q# L& U: {+ C
- double distances[3];
6 F6 y: g5 C j+ z( K
+ S, [- M& r$ I) p# i! Q( r0 k, C- //坐标系定义对话框返回值1 [- z: p. z" @, I# N# M V
- int response; Z2 z! T( }4 f
0 E6 d+ ~" c* T
) Q- q5 V5 I2 e7 o. X. l1 r- /* Make sure User Function is available. */ 3 N1 @3 C6 n( w! [% q
- if ( UF_initialize() != 0) 4 A3 f! u; q9 f, N' c
- return ( UF_UI_CB_CONTINUE_DIALOG );& ?8 p- H# d/ t
5 T' E, X6 T/ ^- /* ---- Enter your callback code here ----- */6 ?& U0 P: C4 T9 G. ]6 m p
- data.item_attr=UF_STYLER_SELECTION;
9 |: W, N' i5 Z, [5 D - data.item_id=UF_STYLER_DIALOG_INDEX; + m% D% y k7 X3 Y$ `0 m: x' c: q, @
- UF_STYLER_ask_value(dialog_id,&data);
# j2 ~: T. `7 c0 }# G; [ - UF_UI_ask_sel_object_list(data.value.selection,&count,&objects);
' {7 K' }+ x( t: p, u
3 V& \/ Y2 s+ b y; t- data.item_attr=UF_STYLER_VALUE;
/ l! w/ L4 N. k5 |4 ~, ^ - data.item_id=ATT_EDT_STOCK_CLASS;
. C2 e# z$ ^- \4 z7 k6 [1 F+ c - UF_STYLER_ask_value(dialog_id,&data);
1 r8 f) o1 M+ g1 s4 |: G3 n - stock_class=data.value.integer;
* c- i- J+ c+ s1 { - & q. V& _/ ?( J( ^/ u% B' w
- uc1630(title,&option,csys_matrix,csys_origin);, s) \6 G* j& {
) m" e: a- k3 w* q- //定义坐标系
- ^/ U: q9 O6 m Q' I( `; T - if(0==stock_class)! n* S- C; s1 O- T# S& H7 u+ O9 U/ E
- {
& I c: A! ~* d, d' w0 w0 l/ v+ S - uc1601("定义临时坐标系",0);2 G8 \7 T- Z( H
- response=uc1630(title,&option,csys_matrix,csys_origin);
0 I* b# p8 Y8 m1 _2 p! Q8 ?5 A - }1 C) D4 J1 c! d4 B! }
- " ~+ `9 V2 O7 b7 ]6 s
- if(0==count||3!=response)( ~! |- L/ S! _5 p$ V) x
- {
O/ U3 d2 R; T- U9 c4 M3 H - uc1601("请选择实体或定义坐标系",1);: e0 \( ]3 u4 L% L5 Y) @
- }0 K2 B) I- i! ]$ s- z1 s
- else if(3==response) K& z( ~% V/ |/ P) k8 S
- {' X- ^8 G9 U; c* z8 u! W" {
- $ r: A v6 m K; t e% V- Q9 f
- UF_CSYS_create_matrix(csys_matrix,&matrix_id); q3 a/ ~1 h1 E; b& \
- UF_CSYS_create_csys(csys_origin,matrix_id,&csys_id);
: z! L7 {3 N3 }5 D - ; ~) I; B8 m. F7 }# p0 Z! w
- UF_MODL_ask_bounding_box_aligned(objects[0],csys_id,expand,min_corner,directions,distances);; Z# l* M8 ]9 W. h
0 N9 y. n8 O$ F# Q, Y- stock_size_string(distances,stock_class,stock_size);
5 @' P- u$ o: U0 H -
% |5 j7 H% ?7 N( L, } - data.item_attr=UF_STYLER_VALUE;
: |) S! V. m+ \% `* ^) c# X8 ^, e - data.item_id=ATT_EDT_MAT_DIM;
8 I" d$ a; X3 E3 t6 i/ d - data.value.string=stock_size; 8 |) X x$ w+ n4 k+ E5 D9 x) u9 u
-
: Q+ N% @4 u* P& G; W - UF_STYLER_set_value(dialog_id,&data);
- B2 ]# ?" U- j" u) `, Q - UF_OBJ_delete_object(csys_id);
) _0 t7 p. Z& [* u5 ]# _0 ?1 q* D - }! p L2 F& M. Q1 W& S) E
( c, Z- h! h9 [4 `* V. T: [7 g8 h& U3 D- UF_terminate ();% a7 a E. C9 F# \5 ~* P5 {
! e: x5 x( _ R# b1 M# [- /* Callback acknowledged, do not terminate dialog */
; i/ \' v0 S% w3 h$ b" h" E# f g1 [ - return (UF_UI_CB_CONTINUE_DIALOG);
/ x- p2 g# Q. S; ~; T0 B -
& \% D8 S8 _! p0 U4 ]: b - /* or Callback acknowledged, terminate dialog. */6 ~! Z* n: N3 z0 \ k3 `; y' u
- /* return ( UF_UI_CB_EXIT_DIALOG ); */
5 I! v; G" F- W$ o- ~& g
7 D2 J* b. F# W( {3 z% S; k' T, m- }9 M, j; @# f" C% j" ?8 Z
复制代码 |
|