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