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