|
|
- int ATT_EDT_CUSTOM_CAL ( int dialog_id,
: l0 U% O# t F! B9 r+ p - void * client_data,
( C9 M6 Z: X; f4 ~6 r) O9 N& s) ^ - UF_STYLER_item_value_type_p_t callback_data)
" D7 P+ Y2 X& W. K, s+ Y* F - {9 s- p/ z5 t# p+ G( H
- UF_STYLER_item_value_type_t data;6 Z, M+ l3 f- J. _$ y
- int stock_class=0;* t. a3 h/ c4 f* N
- int count=0;" Q& ], F ?5 h* z8 P
- tag_p_t objects;
7 F* q) z0 P, Z; n* e w - p& l& I6 L# c0 w3 a: ^
- //设置坐标系% A4 h' c7 I, ~8 P% B
- double csys_origin[3]={0.0,0.0,0.0};; F; f& n4 m# o! S
- tag_t matrix_id;% S: y) {& J1 d3 z x( l4 o
- tag_t csys_id ;
# P2 U- Q2 |$ X& P - int option=15;
& I) j8 { J: L; Q! P o - double csys_matrix[9];8 i+ m# g4 C$ j
- char title[40]="定义临时坐标系";
' Z) i4 d; g% _ J" a/ r0 v: \' {' R -
( r: G! H0 m3 B. h
" S+ M7 u- D# O- //毛坯尺寸
" x' q8 L3 U% X0 ~, W! Q6 c. A4 Z: j - char stock_size[256];
+ G# ?7 ]- P8 ]6 S0 a
" ?; e+ i! m& _' k. Y W6 b' ?3 \9 E- //坐标对齐边界盒
6 N% b4 R6 }3 D S' s% ?1 Y/ u% e - logical expand=FALSE;
4 w7 U& W: o* Y* U7 j - double min_corner[3];
" U/ ]! ?2 [" Q) p' C0 R - double directions[3][3];
, C7 v) M8 [( Y8 T Q - double distances[3];* d+ l2 J4 A) v l6 s
- # Q/ {: w/ o, G4 H4 Y
- //坐标系定义对话框返回值% ~$ y! Q# t/ S0 Z0 ~- q* V
- int response;% I) J9 G6 @$ i+ j
( n! W0 R d2 A1 P. n
2 P. E) Y$ v$ U! }- /* Make sure User Function is available. */ 3 _* x R3 o( i8 [6 |. f
- if ( UF_initialize() != 0) 7 C k! F( _- ~
- return ( UF_UI_CB_CONTINUE_DIALOG );
) O5 i1 U' E# R3 Y - 1 w, x x! Q! t4 F0 }3 @+ c# o
- /* ---- Enter your callback code here ----- */; Z" x+ m8 }6 s. z o# {4 T
- data.item_attr=UF_STYLER_SELECTION;
K0 l; A5 Z3 h. n3 b+ A0 e' g - data.item_id=UF_STYLER_DIALOG_INDEX;
8 y* t* |! S- z0 u6 J - UF_STYLER_ask_value(dialog_id,&data);
5 K8 P+ |/ j, [ - UF_UI_ask_sel_object_list(data.value.selection,&count,&objects);; S" J. `. {9 O! E* ], \7 d
- - M6 c Z# Q+ A
- data.item_attr=UF_STYLER_VALUE;# A- j3 }2 q/ H8 @3 E% ~
- data.item_id=ATT_EDT_STOCK_CLASS;; I0 u A" L4 G) C( r5 C; z: z4 T
- UF_STYLER_ask_value(dialog_id,&data);
2 K3 e6 S+ \2 i) L! M# t7 Z - stock_class=data.value.integer;3 B3 { ]& V2 E
u! k- _2 a+ c$ ?$ M2 v- uc1630(title,&option,csys_matrix,csys_origin);
" y3 i N3 R/ h' K7 u7 d - ; J8 W: d$ s6 k5 S: L- o" ~
- //定义坐标系) v( C/ j/ t2 ~, Z+ _, t1 c
- if(0==stock_class)3 A' A) P6 D8 Y" X8 X
- {! o/ J% M0 G3 J1 }
- uc1601("定义临时坐标系",0);
! Q+ m/ _. ]5 i/ K5 W% Z) @* ] - response=uc1630(title,&option,csys_matrix,csys_origin);
- c( ?$ a$ X: q: G+ P - }/ \1 w& Q0 g) ~, v
- ; e/ U- ?( T5 V
- if(0==count||3!=response)' W, O( }+ X7 @, F
- {
/ Y6 H1 z% e. u* V, p# y - uc1601("请选择实体或定义坐标系",1);) e( |0 M! y8 p5 ?
- }
, g* B! s5 r0 Z* ~$ l9 n$ y - else if(3==response)
. E* n& t l. W3 s1 p - {
; N( U9 P6 E6 ^ c3 Z4 F b8 U
* W# ~3 R! w+ u9 Y# C9 r" _& c- UF_CSYS_create_matrix(csys_matrix,&matrix_id);" d7 t. H& a+ ^& E4 ?" O
- UF_CSYS_create_csys(csys_origin,matrix_id,&csys_id);% Z# ]; h4 f0 @; C' {' K
# k+ J4 s, `0 c3 s' H [$ c- UF_MODL_ask_bounding_box_aligned(objects[0],csys_id,expand,min_corner,directions,distances);$ w: b X. n q `5 E
- / L" E. f* Y7 a
- stock_size_string(distances,stock_class,stock_size);/ Q& M3 {6 ^/ @$ B
-
8 I, m/ A4 E: S; r$ m - data.item_attr=UF_STYLER_VALUE;
6 ~1 B0 \7 r7 R( l - data.item_id=ATT_EDT_MAT_DIM;
4 R3 A0 m: A0 G: F- R7 N - data.value.string=stock_size; 0 D" @! n4 G5 W# z
-
" Y5 Q0 n! y' j6 z. _/ e - UF_STYLER_set_value(dialog_id,&data);
- c. l2 H% o( O" B+ ]0 `% x - UF_OBJ_delete_object(csys_id);
$ k, |( l5 E! F! P3 g7 ?/ K; v' g - }; D7 Z7 K" J+ P! W2 O2 r5 e0 i
- $ s8 u, |1 i- `* T) [( A
- UF_terminate ();$ m8 K' a O- s, R5 x( Y
- * f7 }6 r1 [% E3 r4 y# P W; \3 C' S8 T
- /* Callback acknowledged, do not terminate dialog */
# Q) E; _& T0 Z! P! v - return (UF_UI_CB_CONTINUE_DIALOG); 4 n5 ]+ Y8 F* G+ Q
-
$ s1 S: {7 O) G. u - /* or Callback acknowledged, terminate dialog. */# n4 k$ C' P) c+ t' [+ {$ g0 |' \
- /* return ( UF_UI_CB_EXIT_DIALOG ); */ b+ w4 J. d/ h8 L6 q! w1 S4 u
; D6 e% [. T0 e/ A# e& N2 L& x& L- }! B$ k# U4 U8 x' _5 V9 q
复制代码 |
|