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