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