|
error LNK2001: unresolved external symbol _main- M( p2 U( O9 z7 `1 @% m X
+ {+ R& V+ t' c. W1 z% `源程序:" v G6 f5 i; k. l
/*=============================================================================
0 H t/ q% S. m# p0 } WARNING!! This file is overwritten by the UIStyler each time the Styler
2 i5 s; w9 i. v# N G6 E0 u file is saved.
' p" k8 G3 h5 f( z# l, e
( A3 z1 }! K _7 q6 T* D" R; c
2 ?, ] ^$ i% j4 l Filename: pro_design_template.c
- W: B$ }" R) J" @$ X & Y: W0 c# D% K, u/ U* ~
This file was generated by the NX User Interface Styler
* U& }' V% S1 R1 S% I- r: J Created by: befree
5 t4 p- |4 p, p- D6 o1 \* S2 I Version: NX 3
$ V) U, H3 J& h Date: 10-27- 6
2 e& y' j; f) z) Z( S7 e- | Time: 10:04
5 q( j3 g6 G8 e! m4 s' f & p; Y) k) D# F+ ]
This template file is overwritten each time the UIStyler dialog is
+ Z8 w1 F" F) { saved. Any modifications to this file will be lost.) ^$ _7 D8 D' | k) D2 }/ [
==============================================================================*// E# {3 |8 M, g/ ^6 C
. G/ ~9 F, j3 ^- ]- L+ ~
+ b2 Q' a9 v4 p. d' V/*==============================================================================2 ^1 A& F; h% C1 f. E n, \# M
Purpose: This TEMPLATE file contains C source and static structures to & }9 e3 h: n! j- G& F
guide you in the construction of your NX Open application dialog.
/ V( m7 {+ f+ ~ The generation of your dialog file (.dlg extension) is the first step towards
i6 Y; o- i# Z4 L9 e; h) D dialog construction within Unigraphics. You must now create a ugOpen
- F# ]+ k4 e# _) j application that utilizes this file (.dlg). 7 W3 d. v) g/ Y
& R6 Y# J1 z, y( d+ T* X; b The information in this file provides you with the following:
2 f/ d5 I" T. l2 @
' ]- V, C) {7 c2 y/ ]4 f8 n5 l. n2 b1 j 1. Help on the use of the functions, UF_MB_add_styler_actions and
+ F/ b1 a- P/ E* n UF_STYLER_create_dialog in your NX Open application. These functions 0 y! |" _( K) H
will load and display your UIStyler dialog in Unigraphics. 5 W' }# v) T5 g( L' t
q$ B" z I0 \8 C
An example of the function, UF_MB_add_styler_actions to associate your 1 z8 W; Q! o( k7 M8 ~# Y
dialog to the menubar is shown below (Search on Example 1). " `8 ~( B/ z9 Q* u
+ h9 V5 b" {2 r1 w1 Q$ L5 k
An example of a invoking a dialog from a callback utilizing " f+ j, q4 F# e5 V1 B6 i5 u Q
UF_STYLER_create_dialog is also shown below (Search for Example 2). # c# G6 I7 p4 O' ]# Y
1 O! j1 r; ^; h' t An example of a user exit utilizing UF_STYLER_create_dialog is also
8 S* p( S* Z. @5 N: D shown below (Search for Example 3). 6 k2 Z: z; ?1 ^6 k4 p$ x/ R
: Z1 M! y$ ?1 M7 a/ X& m
2. The callback structure: --- PRO_DESIG_cbs ---
G1 J7 N6 Z4 [) P This structure is VERY important if you have callbacks associated with
$ y5 @4 N0 w4 B2 O0 t your dialog. It correlates the dialog items in your dialog with the
3 d& c& N \$ H, }* ^ callback functions you must supply. You should not modify this 1 f# P% e& Q: b9 [+ d% H# q! l
structure since it MUST match up to the information stored in your
" d3 b; Q/ [: J o dialog file (.dlg). Any attempt to do so will cause an error while
: y3 o! h$ `& O' a) @4 c constructing your dialog. If you wish to modify the association of
+ q9 H$ e @9 z: T your callbacks to your dialog, please reload your dialog file (.dlg) into, }. U) g2 E7 O1 v" R0 v
the UIStyler and regenerate your files.
$ H% E) J0 \* a* c9 E You do not need to be concerned about this structure, simply pass it as
' z# q+ F0 J1 t an argument to the function, UF_STYLER_create_dialog along with your ! h( t" p) e8 e7 {7 Z8 q8 i
dialog file (.dlg).2 u9 l0 w: y% ?7 K3 o
6 K+ G5 E& t- _. a4 c4 O! s
Example 1 displays the actual call you may make for this particular & O F6 h" Y9 U2 A3 Z4 C
dialog.
, ^& z) P6 e" z: u. R! h' Y ; Z G1 R, O" l8 h( S/ m
3. The empty callback functions (stubs) associated with your dialog items 8 ^4 [) S! f) R5 G8 r$ R
have also been placed in this file. These empty functions have been
* k- L9 E7 x) E) f, x1 c' O created simply to start you along with your coding requirements.
& Z% C0 j$ |/ r: T The function name, argument list and possible return values have already
$ f) \% D6 F1 V0 M& _; N9 y been provided for you.
6 J8 }: `8 o& _! z* K: d
$ A- q S+ \/ Y RNOTE: Each callback must be wrappered with the functions UF_initialize() 8 C9 K( F5 h( a5 K
and UF_terminate().
/ K/ h+ L) G; E7 e( F' e
6 U4 X! A# W5 _* e x( j==============================================================================*/
/ `; x$ d$ e$ Z4 H1 Z' a
0 N5 q6 Y- ~! o1 I& y5 L, S4 a" p8 D/* These include files are needed for the following template code. */5 d1 Z0 H& c* f
#include <stdio.h>
7 R8 m u! _5 _2 T% T/ u( r#include <uf.h>
/ k; T' w& j3 E7 u w) `#include <uf_defs.h>
7 I& W1 f& Z8 ?/ {: |#include <uf_exit.h>
1 r+ ]) s! ]& f0 ?7 `& l#include <uf_ui.h>$ n) j" ]$ o9 X
#include <uf_styler.h>% q6 `& P& T) v* W* [
#include <uf_mb.h>
* u2 h2 E8 [, {2 h- H+ H: F#include <uf_part.h>6 p# k) L, M% D7 Z2 a
#include <uf_modl.h>9 n$ _9 C7 k2 T5 \' }
#include "pro_design_dialog.h"
1 x4 Y! h; N1 f& W/* The following definition defines the number of callback entries */9 I8 t) f: i1 n9 m; R( n/ G
/* in the callback structure: */# w# S2 o/ ^) g( R f2 ]: U
/* UF_STYLER_callback_info_t PRO_DESIG_cbs */
8 `2 A$ R- F; J; ^3 x/ f+ B/ M/ b: Y#define PRO_DESIG_CB_COUNT ( 4 + 1 ) /* Add 1 for the terminator */. E4 L% U: I5 }6 L4 h8 y% l' Z
% F1 l" y8 `! L( I, @
/*--------------------------------------------------------------------------
6 \3 P; U7 L0 ~5 I! v6 E: FThe following structure defines the callback entries used by the
; z; N- ?7 u8 z6 W4 `) Jstyler file. This structure MUST be passed into the user function, 0 Y. R; n, T ^4 z3 \& D
UF_STYLER_create_dialog along with PRO_DESIG_CB_COUNT.
, P1 I3 g/ \ X--------------------------------------------------------------------------*/
. ]; q" P4 `, G$ z0 |) ]4 Tstatic UF_STYLER_callback_info_t PRO_DESIG_cbs[PRO_DESIG_CB_COUNT] =
9 [. I/ l, A; Z' z* Q{+ o8 E7 F" p" J. Y8 }9 y
{UF_STYLER_DIALOG_INDEX, UF_STYLER_CONSTRUCTOR_CB , 0, PRO_DESIG_construct_fun},
" [) V& `8 a- d. X/ G {UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB , 0, PRO_DESIG_ok_fun},
: D( D; C, J) H# G# T {UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB , 0, PRO_DESIG_apply_fun},2 M- n3 d C$ U. w# H) }7 i/ m
{UF_STYLER_DIALOG_INDEX, UF_STYLER_CANCEL_CB , 0, PRO_DESIG_cancel_fun},
2 p' ~2 ?& J* q {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
+ [4 }! ?, f) m0 E D};
1 m5 l) n6 v1 k) X, S, J" w' |% S) P. Q6 m$ R, d0 V& p
/*--------------------------------------------------------------------------
3 k. {( F& p2 OUF_MB_styler_actions_t contains 4 fields. These are defined as follows:
; @0 n) N( ^0 p9 e " d" a" x! e) Z* D" [: g3 H
Field 1 : the name of your dialog that you wish to display.9 U' L$ N. `2 q0 A
Field 2 : any client data you wish to pass to your callbacks.
, T1 ?8 G. J0 ?; x' O2 i! \# Z- gField 3 : your callback structure.
% q/ w( ]- {6 pField 4 : flag to inform menubar of your dialog location. This flag MUST & c A8 u0 h9 t* G2 P, K
match the resource set in your dialog! Do NOT ASSUME that changing
. X7 n0 e: p9 ^0 F$ T5 ?/ b this field will update the location of your dialog. Please use the : D) R( v3 A' x) s C& ]
UIStyler to indicate the position of your dialog.
% e/ ^7 W, p# s! r5 W--------------------------------------------------------------------------*/- N3 r! f) k4 z
static UF_MB_styler_actions_t actions[] = {4 o M4 U; Z, [% k: r% q
{ "pro_design.dlg", NULL, PRO_DESIG_cbs, UF_MB_STYLER_IS_NOT_TOP },
, v! I# [: c3 ^% ?! P8 l { NULL, NULL, NULL, 0 } /* This is a NULL terminated list */* I# n' s2 x; Z( o
};3 c% A5 m9 H4 n: G/ _) I j2 S- X. @
# U9 v" ]/ }+ }/ k2 K1 }9 I. k: ^; }* i. I! u
8 X( D8 V: |3 Y! X, w
2 c9 t0 V0 ~5 S6 K, I8 Y$ _8 |/*-------DIALOG CREATION FROM A CALLBACK HELP Example ----------
6 j0 m( \3 Y4 g) W) m0 y% g, [If you wish to have this dialog displayed from the callback of
# x3 V% K- _3 w1 p* Kanother UIStyler dialog, you should: + n: G4 C4 K- r8 E
1) Make sure that the callback of your UIStyler dialog is 4 z0 d! S+ F) m( X
designated as a dialog building callback.
! i7 R1 C' p- @; o) u/ P9 J2) Remove the conditional definitions:6 f$ G1 g& n; R
#ifdef DISPLAY_FROM_CALLBACK
# Y: K% i2 W. A! `0 S. Z #endif DISPLAY_FROM_CALLBACK
( x/ N2 R0 F8 X6 D! U0 T, d3) Your callback should issue a call to this function.- V9 j( H0 n5 T" N% P
4) You should also add the funcitonal prototype to your header file 3 W [& F! c* U1 `) e7 C! t+ m
(pro_design.h) and ensure that the file is properly included.. H, o3 I+ O: b) {( `
All dialog files must be located in
! ~' o( m! P# l, w( _% u4 W $UGII_USER_DIR/application or ( Q6 O7 J. I* S
$UGII_SITE_DIR/application or 7 r: p8 l8 n- @# J! N- K+ S- i4 o
$UGII_VENDOR_DIR/application directory& A. c; A1 s/ } w3 E4 s. N7 K }
--------------------------------------------------------------*/
# l: j, N% |, R
4 A; A! `5 u( i; k! ^: |6 qextern int LaunchProDesignDialog( int *response )
: g+ V! K9 z1 g9 o( r{2 e2 G- H8 a8 Z# T1 l3 I1 e
int error_code = 0;. B: ]8 v0 ~9 V, D. |# p
3 F/ i, s( V+ C, i: Q$ e* n$ P4 ?( E if ( ( error_code = UF_initialize() ) != 0 ) - j' J8 g5 c' _. b& n. R+ C
return (0) ;
: L3 X! D! N7 R if ( ( error_code = UF_STYLER_create_dialog ( "pro_design.dlg",1 K, c6 @ |$ G. o$ F! u
PRO_DESIG_cbs, /* Callbacks from dialog */0 ?+ y% m0 v. w3 c. Y: L5 m7 f" T* k
PRO_DESIG_CB_COUNT, /* number of callbacks*/
7 J* ~: y l1 C NULL, /* This is your client data */7 \+ Q) D, e5 F
response ) ) != 0 )
+ m" T, v( D3 x9 e# A+ ?3 l. H {
' L9 B- Y3 y+ r* E3 ?# X$ b$ \! { char fail_message[133];
" e4 a6 l ^* q! }* h /* Get the user function fail message based on the fail code.*/
) p; ]% R* ^0 R( V1 s5 z* G/ D9 a UF_get_fail_message(error_code, fail_message);0 y3 _; [1 t, t( R8 G5 d1 [
UF_UI_set_status (fail_message);3 i. X- Y& @7 b" c0 k6 l
printf ( "%s\n", fail_message );
8 Z' ]6 i& n+ K }/ Z( b; B- x, s9 O3 t9 K! @3 b
5 s: a7 I* Z4 ] UF_terminate();
8 Z+ N1 }5 `% r- ] return (error_code);$ I8 d. e9 c1 k* {
}% P: Z4 l, q9 t2 y5 Y+ Y# ^
, G1 `5 ]* |" h* s8 e$ w
3 U" ?3 q h0 F( q' C% V' W. f8 x8 ]- |2 e
" S2 K2 E4 S0 t) p5 H! X# Y5 x0 |/*-------------------------------------------------------------------------*/
" B0 _ e" R$ _0 ~+ \/*---------------------- UIStyler Callback Functions ----------------------*/. i0 l4 P% z7 K( T& a7 [
/*-------------------------------------------------------------------------*/- Y+ U/ V Q1 q# g6 L9 i
/* -------------------------------------------------------------------------7 g5 _" D' ^ O d. }* M
* Callback Name: PRO_DESIG_construct_fun9 {3 S# L9 t, g9 I: N& K
* This is a callback function associated with an action taken from a% A- o( D$ g0 m. u5 a9 }
* UIStyler object.
" p$ v/ N9 ^7 U1 N *& D6 M$ c5 M0 _ {5 x1 ]( ]/ I
* Input: dialog_id - The dialog id indicate which dialog this callback
6 f3 `7 t4 B$ X b2 l# B * is associated with. The dialog id is a dynamic,
" H6 D. a* H1 D$ s5 \ * unique id and should not be stored. It is5 w0 z# z/ v3 h, ]5 E
* strictly for the use in the NX Open API:! Q+ C6 M1 X* S6 q! j
* UF_STYLER_ask_value(s)
; N! b- S$ X9 | * UF_STYLER_set_value # J- ?* o% `' a7 e, j) y1 D
* client_data - Client data is user defined data associated" I0 c# C3 N1 R; X6 ?8 N _$ J
* with your dialog. Client data may be bound
8 H9 b2 ?+ u' B7 x O# [9 C. z5 D$ S * to your dialog with UF_MB_add_styler_actions/ o! [3 h6 s9 P% o7 A$ U5 Q2 C; ^
* or UF_STYLER_create_dialog. 3 E$ {- E' q8 C. ]0 ?# W! U B# O
* callback_data - This structure pointer contains information
) o4 o( |. y! u5 J# k * specific to the UIStyler Object type that
1 A9 e- q7 G4 D# t * invoked this callback and the callback type.
. b! X- r. l1 H { * -----------------------------------------------------------------------*/0 m. T$ z5 O5 b7 Z9 Q! ~
int PRO_DESIG_construct_fun ( int dialog_id,: `, w' X7 K, e' x) Z7 Z
void * client_data,
, R) Z3 z l) x% p7 G3 X UF_STYLER_item_value_type_p_t callback_data); e3 h' [$ v; ]) Z8 o( L, [6 d9 d9 o
{* C) F5 F# A/ U7 u8 G! c5 Y/ D8 t
/* Make sure User Function is available. */
' d p- k" k! ~$ E+ R1 T( g double value; m, r4 M+ P. G- Q+ @
char prompt[256];
3 H7 U Q( S, S8 i UF_STYLER_item_value_type_t data;
7 w9 U3 ]; ]. p3 w$ K8 m if ( UF_initialize() != 0) : m% E% l7 o3 Y* U: @) B4 ~* L
return ( UF_UI_CB_CONTINUE_DIALOG );
% K0 _8 T: a- K* X' ~ data.item_attr=UF_STYLER_VALUE;
" p! D1 ^3 p% w; ?1 i9 ^6 F data.item_id=PRO_DESIG_REAL_L1;: B8 r: J( d4 j: ^
UF_MODL_eval_exp("L1",&data.value.real);
! Z* H5 y5 @8 T7 y* G# ^ UF_STYLER_set_value(dialog_id,&data);
3 z" O- e' a. E" `# i7 u* N data.item_attr=UF_STYLER_VALUE;
. S* e9 t9 u9 I! p data.item_id=PRO_DESIG_REAL_W1;$ J4 ^* c; M8 _: j7 J( e$ x* h r
UF_MODL_eval_exp("W1",&data.value.real);% O0 c u( R, C: y+ m
UF_STYLER_set_value(dialog_id,&data);. B, e, m1 i+ e2 r' |) P
data.item_attr=UF_STYLER_VALUE;
H/ v2 i$ u6 {1 Z/ a9 w% { data.item_id=PRO_DESIG_REAL_H1;
0 R- T- @% w0 F' C" i( ` UF_MODL_eval_exp("H1",&data.value.real);
% f; h! ]; P. Z* L, i2 r* I; [& t UF_STYLER_set_value(dialog_id,&data);
0 ~$ N/ I, } Q. c+ [, x& g- t! @9 a% p1 r2 E/ Q
data.item_attr=UF_STYLER_VALUE;6 E/ R, j0 L: ]! @/ y+ f+ A8 A
data.item_id=PRO_DESIG_REAL_H2;
/ h( [" b* d1 s, m5 w% p UF_MODL_eval_exp("H2",&data.value.real);1 H, g; r% p/ z* m5 w5 G5 A' g
UF_STYLER_set_value(dialog_id,&data);
4 w" A1 p m4 x2 E data.item_attr=UF_STYLER_VALUE;
$ Z& Z* f/ N& y% {; N$ v data.item_id=PRO_DESIG_REAL_L2;) ?# C8 f' E8 d, @
UF_MODL_eval_exp("L2",&data.value.real);
% T' z0 ~% K% H- t% a UF_STYLER_set_value(dialog_id,&data);" t/ ]. v5 _7 m: q1 g
data.item_attr=UF_STYLER_VALUE;
8 f0 T2 x1 c1 \" |( T data.item_id=PRO_DESIG_REAL_W2;
& E3 U A2 \; Y/ N UF_MODL_eval_exp("W2",&data.value.real);. G4 U9 ~2 j- F
UF_STYLER_set_value(dialog_id,&data);
9 L7 v" C7 h. Z data.item_attr=UF_STYLER_VALUE;3 {5 P2 Q5 I1 H8 M6 d
data.item_id=PRO_DESIG_REAL_L3;4 _' ^. o7 m' d x6 M
UF_MODL_eval_exp("L3",&data.value.real);( O T' s/ [3 d: Z! j5 F+ T
UF_STYLER_set_value(dialog_id,&data);
. U6 g8 `6 Q- B, t# X: [7 m UF_MODL_eval_exp("VOLUME",&value);
& ^; L( T. G" T( D, M sprintf(prompt,"当前压块的体积为%.3f",value);
, z( l& t* a- B* m* }: n! e data.item_attr=UF_STYLER_LABEL;
) m7 v! Z! f2 i+ J H E1 C data.item_id=PRO_DESIG_LABEL_VOLME;
' l/ B2 U$ K, K m7 K$ p) a data.value.string=prompt;- B8 Z. V; q# S+ G
UF_STYLER_set_value(dialog_id,&data);$ `; Q7 J% e3 ]6 j
/* ---- Enter your callback code here ----- */! k4 ] ^$ o5 ~! e, v% W5 T: j
UF_terminate ();5 _# b- f, @7 m
/* Callback acknowledged, do not terminate dialog */, ^. _9 }+ Z! u- R+ n0 _
return (UF_UI_CB_CONTINUE_DIALOG); ! a/ [ @+ s! N' b5 q& v
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */
- [. S+ D. W: n+ h /* for this callback type. You must continue dialog construction.*/
0 w' w& D; }+ ]9 D}3 @% z/ ~( c( k1 ^# W9 M
% X. n/ m+ f4 N6 W- D' {
/* -------------------------------------------------------------------------! w9 K8 q4 d! m+ h" X8 C7 X! L
* Callback Name: PRO_DESIG_ok_fun
6 \+ [( _" U* q! q1 X0 ~6 g * This is a callback function associated with an action taken from a
) h4 R1 h- ? C1 s * UIStyler object.
0 }' u5 e T( Q *- v. \; p# g# B" X
* Input: dialog_id - The dialog id indicate which dialog this callback
7 h, }) W" x+ b * is associated with. The dialog id is a dynamic,
5 g( K5 l* T1 ]; O# f3 B0 r * unique id and should not be stored. It is
5 U) ]8 }# ^9 I% g * strictly for the use in the NX Open API:/ T8 A$ U& O' ] O) F, e# i, A
* UF_STYLER_ask_value(s) + ]) E& T& e; ?8 s# e$ S9 A) `8 R" y
* UF_STYLER_set_value 2 J5 i0 k% d1 S9 p
* client_data - Client data is user defined data associated+ u( L! e7 q; S" a& P# k
* with your dialog. Client data may be bound
% k9 g, q! u( N+ ~7 r$ l4 z * to your dialog with UF_MB_add_styler_actions
# {8 R8 v0 ^' M: x% V& i0 @ * or UF_STYLER_create_dialog. / ~0 m, p; u1 t- H G
* callback_data - This structure pointer contains information
* l9 [9 v: O1 ^ * specific to the UIStyler Object type that
# {& R8 g: x" V, _- S/ ^) z+ x * invoked this callback and the callback type.
% f4 I/ z4 `8 A! D0 F3 p * -----------------------------------------------------------------------*/
/ O4 n4 z7 Q {) { J0 j; t" }int PRO_DESIG_ok_fun ( int dialog_id,
% R1 `' @1 f r% }- S! G9 [ void * client_data,8 t3 g& Y8 r6 h1 V" f+ a/ c/ Y
UF_STYLER_item_value_type_p_t callback_data)
1 n5 W3 w8 t2 L r7 h' O{" j4 `9 K2 ^$ b% f. O
/* Make sure User Function is available. */ ! w2 V+ L6 ?, M7 i x" X' w/ z" o
UF_STYLER_item_value_type_t data;8 a; K7 d5 y: U# A3 B8 A( q
if ( UF_initialize() != 0) / O- }7 Q9 w9 j2 O
return ( UF_UI_CB_CONTINUE_DIALOG );
5 S3 @' p: s, K2 x) }: N5 D% l
. d3 \3 r8 V! y+ A8 J* E0 Q2 P0 i$ R* x data.item_attr=UF_STYLER_VALUE;( v& n9 K1 b, R5 O s8 O
data.item_id=PRO_DESIG_REAL_L1;6 i# Y( ~6 i( O) `% W+ C
UF_STYLER_ask_value(dialog_id,&data);
/ j+ L8 K" T. V4 X$ Y PRO_DESIGN_edit_exp("L1",data.value.real);1 l) m3 Y- i, R" Q [3 t' e: i9 P7 \2 {
data.item_attr=UF_STYLER_VALUE;
3 w, B0 P+ M" b/ m data.item_id=PRO_DESIG_REAL_W1;
* J! p. `5 T; {6 c+ `% A0 r8 { UF_STYLER_ask_value(dialog_id,&data);
- v' b1 L6 }# W$ z4 L PRO_DESIGN_edit_exp("W1",data.value.real);3 R, t0 K. s* O; i
data.item_attr=UF_STYLER_VALUE;
1 O& X+ ?$ [+ l5 j" s data.item_id=PRO_DESIG_REAL_H1;
+ [1 G" q, b V- R% q UF_STYLER_ask_value(dialog_id,&data);$ U/ F+ T- }, m3 k0 }
PRO_DESIGN_edit_exp("H1",data.value.real);' U" U( h" U6 E/ d, m! G/ l b, D
+ |3 C7 m R, g: x- e
data.item_attr=UF_STYLER_VALUE;- D) t+ P3 v) _2 I& P
data.item_id=PRO_DESIG_REAL_H2;/ ]3 u) [4 d c4 Z. A
UF_STYLER_ask_value(dialog_id,&data);6 I' S7 D2 J. A( i4 R4 O5 L
PRO_DESIGN_edit_exp("H2",data.value.real);$ y j1 j1 G4 C2 {' O, K7 E
data.item_attr=UF_STYLER_VALUE;
/ A/ n" n' T+ V, P data.item_id=PRO_DESIG_REAL_L2;( t/ u A- S5 Q: W+ z7 f
UF_STYLER_ask_value(dialog_id,&data);1 O7 J6 d+ ~! I- O; n
PRO_DESIGN_edit_exp("L2",data.value.real);$ F- A8 i& z- n# e& ?
data.item_attr=UF_STYLER_VALUE;
, |, H$ f. {1 m0 T( V2 f data.item_id=PRO_DESIG_REAL_W2;
: K$ C- _* G d L9 E( K, k UF_STYLER_ask_value(dialog_id,&data);8 O1 T7 V; d3 I0 I& P
PRO_DESIGN_edit_exp("W2",data.value.real);
) c- x+ A l: w4 i6 W; s$ N data.item_attr=UF_STYLER_VALUE;% q$ K1 _: S! \+ o3 d) B( B2 v5 S
data.item_id=PRO_DESIG_REAL_L3;
' q8 O" U- w- B UF_STYLER_ask_value(dialog_id,&data);
, V. A- l4 \1 d& n$ E PRO_DESIGN_edit_exp("L3",data.value.real);
S z, W- O5 H2 L2 f9 @ UF_MODL_update();/ j: [7 z* Q" p( F* E ^( L
1 \: @% _# S% D
/* ---- Enter your callback code here ----- */
. H" k3 i1 B6 ~; I. v% x+ x UF_terminate ();
, T, y: Q Y9 b' q. Y$ U /* Callback acknowledged, terminate dialog */7 I3 ~ K1 I4 ~! m
/* It is STRONGLY recommended that you exit your *// V$ l. U( k3 x9 U4 n! ~- ]/ S
/* callback with UF_UI_CB_EXIT_DIALOG in a ok callback.*/
' N4 {2 D$ C* ~! k; U0 m /* return ( UF_UI_CB_EXIT_DIALOG ); */
$ |- j& v+ c# R* W' K: E" d return (UF_UI_CB_EXIT_DIALOG);
6 i3 I# V, [6 r B7 S5 ?}/ o& u$ r8 _# e/ q6 J! p; v
; p, c$ F' J, d( \/ J/* -------------------------------------------------------------------------, F+ o0 _- J0 b' Z" `; D) d) i5 `
* Callback Name: PRO_DESIG_apply_fun: P* M n2 c' t- Q
* This is a callback function associated with an action taken from a" i, N2 Q2 Q% e
* UIStyler object. # `8 A3 J7 ?3 {! E
*; k9 K+ ]; T/ t. {( h
* Input: dialog_id - The dialog id indicate which dialog this callback
: E0 p4 X5 j+ @ * is associated with. The dialog id is a dynamic,. k; G# u" {, r, _
* unique id and should not be stored. It is
/ ?0 y5 [" Z7 f8 o- m * strictly for the use in the NX Open API:3 h- P8 I- K0 s4 E/ \$ V1 k
* UF_STYLER_ask_value(s)
, R7 s' I9 y& z0 j6 Y * UF_STYLER_set_value ( A; C5 f' z b) i2 q% L
* client_data - Client data is user defined data associated9 H. ]3 X+ N7 ~; g9 {4 x7 F' }
* with your dialog. Client data may be bound
+ @( I5 }5 p b' ^' u; i8 R * to your dialog with UF_MB_add_styler_actions
4 F! t2 a/ v6 i% Q8 d# `. g * or UF_STYLER_create_dialog. 7 p, B4 Q4 u0 i( \
* callback_data - This structure pointer contains information7 I/ A* o% ]# l
* specific to the UIStyler Object type that
* E; @6 I0 v# i& Z$ X+ C * invoked this callback and the callback type.1 L- z- G* \# O5 D% h, m, \( `
* -----------------------------------------------------------------------*/6 B7 R5 L% I& b" W9 q$ Y t
int PRO_DESIG_apply_fun ( int dialog_id,
7 k; i+ B" }3 e0 m- ? void * client_data,
2 W+ V2 a* h1 ` UF_STYLER_item_value_type_p_t callback_data)4 |5 w2 d' g8 s7 B6 s. l
{
( Q3 u9 t* n D- g /* Make sure User Function is available. */' I4 Z" q' L0 g7 G' |
UF_STYLER_item_value_type_t data;5 L% j0 ~6 l: `5 ^: F2 j7 L4 Q6 l
double value;- S& x; ^! j/ ]; @' Y- O# j
char prompt[256];& i) z# t4 C) g( [
if ( UF_initialize() != 0) - N: `/ W( p; c" w
return ( UF_UI_CB_CONTINUE_DIALOG );7 o& u4 a9 v3 m
data.item_attr=UF_STYLER_VALUE;
- m* B, N* p1 A. U9 ^2 }: _( a data.item_id=PRO_DESIG_REAL_L1;( b+ z6 L7 ?, f) m% ?0 q; O
UF_STYLER_ask_value(dialog_id,&data);# D K! A: |& k1 R- x
PRO_DESIGN_edit_exp("L1",data.value.real);0 ~/ J* a5 i8 I) g( m- R3 J7 @
data.item_attr=UF_STYLER_VALUE;* u- j3 x+ ]' p2 F. q6 G* ~
data.item_id=PRO_DESIG_REAL_W1;8 K! V; z: c, J9 v
UF_STYLER_ask_value(dialog_id,&data);
. R0 J) o% P4 E8 B( g, Y/ G PRO_DESIGN_edit_exp("W1",data.value.real);
: A5 p6 B% C1 o+ k9 k# T data.item_attr=UF_STYLER_VALUE;) K3 p V1 L, \$ H9 B/ V, ?5 T( l
data.item_id=PRO_DESIG_REAL_H1;
' p. T. R' {! l3 |- } Y/ _9 { UF_STYLER_ask_value(dialog_id,&data);
+ [# h& e* N0 @: H! |; ~! h# t6 x PRO_DESIGN_edit_exp("H1",data.value.real);6 u: a" ?' ?% M
$ P( L/ g/ O/ x) H. M+ ? data.item_attr=UF_STYLER_VALUE;
/ A. }# {% x4 u; l7 V5 r7 | ]& s data.item_id=PRO_DESIG_REAL_H2;. @9 b. R# C: z Z* k3 w, l
UF_STYLER_ask_value(dialog_id,&data);
- w. r- E* J# y. _9 v( h3 K4 v& Y8 \ PRO_DESIGN_edit_exp("H2",data.value.real);6 x: _$ \1 o* w6 c
data.item_attr=UF_STYLER_VALUE;! g, Z/ W4 U" S0 w0 K
data.item_id=PRO_DESIG_REAL_L2;
' e. l% r. |" f5 N( { UF_STYLER_ask_value(dialog_id,&data);
; e# v, T" x1 t l' p) K7 l) P PRO_DESIGN_edit_exp("L2",data.value.real);
+ ~, { c1 Z& W+ l8 K5 O, L" v data.item_attr=UF_STYLER_VALUE;
2 M% {/ D0 M( g$ _ data.item_id=PRO_DESIG_REAL_W2;
( K, {) Y& U% ~" h# o& V UF_STYLER_ask_value(dialog_id,&data);
6 w& d6 j& u, Q" a3 _2 T3 T( e PRO_DESIGN_edit_exp("W2",data.value.real);
: ~) Z$ D7 t5 x+ s data.item_attr=UF_STYLER_VALUE;
" U7 M# e- L, J5 ]* m ]$ Z9 G8 y data.item_id=PRO_DESIG_REAL_L3;
8 F( a$ ^8 f& ~5 \7 x3 B& n( N' K UF_STYLER_ask_value(dialog_id,&data);
8 e. n) u2 N' [+ b4 e0 ? PRO_DESIGN_edit_exp("L3",data.value.real);
) U9 r+ c l& t! A3 U# K UF_MODL_update();
7 n- a. O& b3 \" O* ^
7 k" b. z3 _: c; F8 Z UF_MODL_eval_exp("VOLUME",&value);
7 D2 H* `. y+ I" a5 E0 @ sprintf(prompt,"当前压块的体积为%.3f",value);
/ l3 W" h; v( H) H$ t# B data.item_attr=UF_STYLER_LABEL;
" D h! R6 C/ B- W4 A- a data.item_id=PRO_DESIG_LABEL_VOLME;* x. I$ e/ h6 E, |/ o
data.value.string=prompt;
" ~: D+ \" l3 z: p, Z UF_STYLER_set_value(dialog_id,&data);
8 ]5 U$ i( _8 ]: X( G6 v9 { /* ---- Enter your callback code here ----- */9 H; R; n% _8 _( ]$ Q
UF_terminate (); o5 w; r. x5 k1 B
/* Callback acknowledged, do not terminate dialog */
/ E; g6 A' r' h. Y /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */
) V7 I3 b1 a5 m /* for this callback type. You must respond to your apply button.*/
% ^; b5 p; }( {3 z8 @" `' I return (UF_UI_CB_CONTINUE_DIALOG); : H1 M' R6 R& ^( J* S- E
}
( T, m- v2 E* E! ] G4 X/ }4 N, v8 v' w" k
int PRO_DESIGN_edit_exp(char *dim_name,double dim_value) T; w- H6 N( t9 G5 L4 l
{
& w, `% N7 n A$ C- [8 U! j char exp[256],temp[50];
z3 I8 G+ W( M int err;
( L. E. T0 _! P' p( y4 T* ` strcpy(exp,dim_name);
6 s& c" e2 N0 i$ h" g% y strcat(exp,"=");# }% m, x; |! p. l- C- m
sprintf(temp,"%.5f",dim_value);( e% U3 U* R) h! `' s4 u4 R
strcat(exp,temp);
( ?! Z- ]4 h& N. L" O err=UF_MODL_edit_exp(exp);
( o5 F9 X/ [& ~3 r5 X5 m5 \4 Z return err;" H+ k( J3 b4 z% Y2 H4 i3 H
}
8 r% X w) A8 K+ f- e7 q/* -------------------------------------------------------------------------
' F. ]* h3 F& o% E * Callback Name: PRO_DESIG_cancel_fun5 z- \( T# i0 D" M. U4 \: V3 n
* This is a callback function associated with an action taken from a
0 W% B5 p B( k' B * UIStyler object. , x7 i( g9 t* d9 f, g
*
% g: F" J3 G& q/ Q) Y * Input: dialog_id - The dialog id indicate which dialog this callback
1 ~& i8 S. ^0 F1 l* W2 x. t% ` * is associated with. The dialog id is a dynamic,
; c: Y$ V- g: F) G7 k6 K4 m5 ` * unique id and should not be stored. It is
- b$ p' J m- u3 }+ o * strictly for the use in the NX Open API:! u5 R5 f% U- l
* UF_STYLER_ask_value(s)
6 S3 V2 k4 n) L3 y# j! Q9 w& D1 ^, X * UF_STYLER_set_value
@6 n+ I; c2 B- A, g4 { * client_data - Client data is user defined data associated
1 o4 P" \ Z# m% I) @$ N * with your dialog. Client data may be bound7 Y& g# X/ G! K) e, x) p, d* [
* to your dialog with UF_MB_add_styler_actions9 m6 t0 s1 Z* @: X7 ~
* or UF_STYLER_create_dialog. 1 V/ E$ j# |% A/ e! a: k; p4 \, ^
* callback_data - This structure pointer contains information
7 \- `. X" Z7 [8 I: W4 Q2 q * specific to the UIStyler Object type that
: O6 t3 q) ~1 `8 d * invoked this callback and the callback type.
1 [" y' e! G7 m * -----------------------------------------------------------------------*/! z; C* \* A- n, ?. v
int PRO_DESIG_cancel_fun ( int dialog_id," e: Q5 {: u1 `1 ^- ]1 e
void * client_data,+ X) g2 |% Y/ s4 g: Y
UF_STYLER_item_value_type_p_t callback_data)3 F+ D s' d# m) `+ m. S
{
; l6 E2 B+ c+ ] /* Make sure User Function is available. */
1 G" i! U1 }; e4 B( J( ?0 [ if ( UF_initialize() != 0)
( @+ |4 p% g; A$ a) v& O* B return ( UF_UI_CB_CONTINUE_DIALOG );
3 G' Q1 _: O u7 }8 C* @ /* ---- Enter your callback code here ----- */
) ^! i# P) V N3 P, x$ _- M( t5 F UF_terminate ();
8 j; y `' [. P1 A /* Callback acknowledged, terminate dialog */
# a. c3 M7 G% S) k0 _ /* It is STRONGLY recommended that you exit your */
1 M6 x: t) f" q /* callback with UF_UI_CB_EXIT_DIALOG in a cancel call */# P$ i% R0 D3 j) w6 N, x( G$ _# X
/* back rather than UF_UI_CB_CONTINUE_DIALOG. */$ R3 Z8 `& @& G/ H
return ( UF_UI_CB_EXIT_DIALOG );
6 C6 q7 `- m6 ]$ r* [0 ~' P} |
|