|
error LNK2001: unresolved external symbol _main! t( M' J' S4 h( A7 N
0 h1 T- y7 o( Z2 U
源程序:8 T/ X5 d% ?$ [5 C0 a5 D6 v
/*=============================================================================: d& W7 R. W, @$ Q- X( c' V' F$ Y- B6 @
WARNING!! This file is overwritten by the UIStyler each time the Styler 2 R* W- U1 \6 ]3 Y* \
file is saved.
! O) P4 Z1 K& o/ O; C) T, ~, g
8 a- M. X s G5 f / ^ C! P! g& l# x! @5 s( w
Filename: pro_design_template.c- w* J& X# y" J, r# C6 a: {; n
2 R/ Q* n3 d+ Q: M- [' l8 g1 f
This file was generated by the NX User Interface Styler
* b3 `8 k2 A% m3 T8 [ Created by: befree
$ Y4 `9 f: K! N" } Version: NX 3+ i) G b, S" H4 L* t
Date: 10-27- 6
0 n) f7 G( \) t2 k) U1 N. E& I Time: 10:04
1 S# Q5 s$ v7 I% H$ n3 L 0 o4 v* j. K' R2 z7 ]# d4 E6 ], j
This template file is overwritten each time the UIStyler dialog is
$ i7 B P3 D: `& S saved. Any modifications to this file will be lost.
, A; x: ?) [ `6 H==============================================================================*/ T! c2 ]1 Q; n- S. y3 N$ d# i
. h* G# d( \6 R, G( m9 g, n1 r; z$ m x6 z/ y2 a2 ~% [" _& O( S
/*==============================================================================
' t4 ~- k. J: `2 h4 O( P Purpose: This TEMPLATE file contains C source and static structures to * a4 X ?, ?' p% [) c( ~" M
guide you in the construction of your NX Open application dialog. 3 Y( N! F! L$ Z) R: ]: Q; o
The generation of your dialog file (.dlg extension) is the first step towards, Q* b Y2 N" l
dialog construction within Unigraphics. You must now create a ugOpen
0 P1 a5 H0 x3 ?8 S( \+ k7 f" x application that utilizes this file (.dlg).
# ~" l0 Q$ H9 Y1 h g9 N6 \
" W% U5 G1 Y* e+ C/ i; I) W The information in this file provides you with the following: 8 \4 U: P: u, m" S
6 X! K0 o, b0 m& d1 Y
1. Help on the use of the functions, UF_MB_add_styler_actions and 9 c* R ~% S. c4 V, d; X, }
UF_STYLER_create_dialog in your NX Open application. These functions 4 h. s4 k; s+ m$ C n( u V5 O: S6 Z. s
will load and display your UIStyler dialog in Unigraphics. ^ O5 P3 e& ?; u y: W4 W
& U$ ]8 _- \$ V$ S0 k- m An example of the function, UF_MB_add_styler_actions to associate your
: j6 U' S& \3 Q3 b# }5 N7 |1 b9 [4 y3 k dialog to the menubar is shown below (Search on Example 1).
$ y8 c% z# {6 | ) a7 {' z* i, q
An example of a invoking a dialog from a callback utilizing - F+ D, B+ F \
UF_STYLER_create_dialog is also shown below (Search for Example 2). + V8 P' c4 w( Q+ I4 n' g
" l& z! [& u2 L, U3 g An example of a user exit utilizing UF_STYLER_create_dialog is also - o3 K+ F* | R
shown below (Search for Example 3).
g" n" v6 @$ \$ i1 q4 a * f8 I8 P3 Q3 Z
2. The callback structure: --- PRO_DESIG_cbs ---
8 X; E* ^7 N Z& {9 q7 ~/ }3 Z This structure is VERY important if you have callbacks associated with
; ]9 ^% [# H8 O1 |% I1 {2 s your dialog. It correlates the dialog items in your dialog with the ' i* w/ R2 p8 D/ \$ _& N: s8 U
callback functions you must supply. You should not modify this
6 O# C! A$ r% _) E structure since it MUST match up to the information stored in your
' S0 ^0 B! O& h T dialog file (.dlg). Any attempt to do so will cause an error while - B# M4 r1 K" s9 ^- q
constructing your dialog. If you wish to modify the association of ( Q; O/ S% n" b# Z5 B2 C
your callbacks to your dialog, please reload your dialog file (.dlg) into) X. x1 ?" N; J+ R" r' a/ b
the UIStyler and regenerate your files.
( R+ ]5 L7 \6 h) M/ h You do not need to be concerned about this structure, simply pass it as
& ]6 k( u+ y0 y% `: d! B" E& g3 t an argument to the function, UF_STYLER_create_dialog along with your
# c& w! @: d9 B- W- ^ dialog file (.dlg).
, r3 k( x& f/ z% Q- E6 e 0 R0 I) i" {0 B* k# a
Example 1 displays the actual call you may make for this particular
- w2 N1 k9 \7 e dialog. ) C$ v) G9 j6 N+ _/ _- v" }
& {9 c* w, J6 `6 T 3. The empty callback functions (stubs) associated with your dialog items
% m: b" A; d3 N8 y/ [ have also been placed in this file. These empty functions have been
+ |; w( U* j0 j) x. K created simply to start you along with your coding requirements. ! a; a, p) m' t& F0 q
The function name, argument list and possible return values have already 8 e( h$ @+ Z, a7 m
been provided for you. " t5 b) Q9 k6 |3 Y8 h; B8 ^( j) N
5 u L1 X7 O! H9 P+ H$ z; |
NOTE: Each callback must be wrappered with the functions UF_initialize() 5 m- b1 I, A/ q O; x$ |
and UF_terminate().
& O& j/ R) j, `6 p! d, G
9 ], h5 U. q+ ~" E8 ^- S==============================================================================*/& ?% t6 I( x! |( T9 T
- m: O9 N" D4 @6 S/* These include files are needed for the following template code. */
, t- N# v4 T: s/ F) i+ l8 K" M#include <stdio.h> + K7 {) ]4 P2 M% z7 C
#include <uf.h>
' f( ~/ q" _" {$ B# Y/ [: R#include <uf_defs.h>) d7 r) a. G) k* ]& Y
#include <uf_exit.h>+ T8 j+ n- Z8 J6 z! \, s O
#include <uf_ui.h>7 A+ ?8 X+ l" ]& d
#include <uf_styler.h> m; ?- Y* _6 f* x4 [ Q
#include <uf_mb.h> $ W5 T/ [* g* B" B9 v) }$ T) \
#include <uf_part.h>
/ e, t i$ t/ e; v, I% v#include <uf_modl.h>
) u8 W4 \1 l0 G9 j2 i+ ~#include "pro_design_dialog.h"/ V* m* G: C7 n; P* f
/* The following definition defines the number of callback entries */
^$ G) R* n* C k4 v7 Q/* in the callback structure: */
0 K. |) e3 }- m% x5 P2 ]/* UF_STYLER_callback_info_t PRO_DESIG_cbs */+ B: K M$ g, }
#define PRO_DESIG_CB_COUNT ( 4 + 1 ) /* Add 1 for the terminator */$ |8 J! Q1 G+ f4 r! x
) m: f. A0 u8 K9 U- K$ N
/*--------------------------------------------------------------------------
' M5 l( ~' G' n; s8 {! {The following structure defines the callback entries used by the
5 m) T D; b" r# h8 |- Q5 tstyler file. This structure MUST be passed into the user function, ! E4 A( Y0 x, W# D; `. q
UF_STYLER_create_dialog along with PRO_DESIG_CB_COUNT.
# @) B7 x- ?0 U- N. V--------------------------------------------------------------------------*/
. C R/ x3 T. m' P tstatic UF_STYLER_callback_info_t PRO_DESIG_cbs[PRO_DESIG_CB_COUNT] =
# S' o! w. g V+ }{5 p1 ^0 J# I. l y* p: i9 d
{UF_STYLER_DIALOG_INDEX, UF_STYLER_CONSTRUCTOR_CB , 0, PRO_DESIG_construct_fun},
& U8 j' |( a5 _# T {UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB , 0, PRO_DESIG_ok_fun},
& B' w) z! b# x3 C1 z {UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB , 0, PRO_DESIG_apply_fun},
: V6 F. ]' y( v3 r9 P* P {UF_STYLER_DIALOG_INDEX, UF_STYLER_CANCEL_CB , 0, PRO_DESIG_cancel_fun},
/ i+ z$ d! ]+ G" ]4 n$ v {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
+ I0 D6 I R8 G: F% M};9 t& [5 o. L2 Y5 I: t O
! g+ z+ A! ~' W8 ~, F* n/*--------------------------------------------------------------------------
* s' m; Z- O" U) E# v! ~5 A5 eUF_MB_styler_actions_t contains 4 fields. These are defined as follows:
3 \$ {' G4 E. ]
: P7 U1 w, T" y2 h d4 dField 1 : the name of your dialog that you wish to display.
$ V2 @$ \$ _+ b2 i' j" F& A9 R7 q2 qField 2 : any client data you wish to pass to your callbacks.9 d* [- l. C4 o; m
Field 3 : your callback structure., s G2 e4 X; X/ A k# C# h/ ^9 H
Field 4 : flag to inform menubar of your dialog location. This flag MUST ; M9 b5 F* }. z6 [) T
match the resource set in your dialog! Do NOT ASSUME that changing 6 B' _$ |. d1 O1 ?7 l* N
this field will update the location of your dialog. Please use the - A b$ \2 q& _! J/ ~# q
UIStyler to indicate the position of your dialog.
6 E4 ?. }2 x+ }) K4 X& p--------------------------------------------------------------------------*/
( V- B$ I) G; S7 d( Zstatic UF_MB_styler_actions_t actions[] = { G- M: Y4 U& L. D1 u8 l. b
{ "pro_design.dlg", NULL, PRO_DESIG_cbs, UF_MB_STYLER_IS_NOT_TOP },
' N. g' ~" O4 a9 b2 K { NULL, NULL, NULL, 0 } /* This is a NULL terminated list */0 F; h! G9 \& P& E' q7 _ ]# j, C
};' |: g6 q1 ~8 M* A/ k# l+ M
% Z( }8 u/ b" s: Q/ i: R" ?7 _- ^( @6 i& F, m- _6 c2 m
! u- A* U" `: U* z
/ b" t+ D' b+ b9 F/*-------DIALOG CREATION FROM A CALLBACK HELP Example ----------
& x( J ^# n) [: {# b/ H- ?If you wish to have this dialog displayed from the callback of
7 b: p6 z% I( {4 u) v8 c2 i ?another UIStyler dialog, you should:
" T% r$ T9 b2 U5 W0 m+ S1) Make sure that the callback of your UIStyler dialog is % y9 E D4 O! I7 O8 J A: o& b* J
designated as a dialog building callback.
& P1 S; g ~' i! F4 H* }' a2) Remove the conditional definitions:
9 f# }- z# x: x #ifdef DISPLAY_FROM_CALLBACK
1 Q# J+ G$ R: b* y6 y #endif DISPLAY_FROM_CALLBACK- \- q) K% Y6 ~# ]3 X
3) Your callback should issue a call to this function.9 v3 y, ]; B% l9 i3 h
4) You should also add the funcitonal prototype to your header file
& F- o2 Z2 I% `2 }6 @% L (pro_design.h) and ensure that the file is properly included.
5 P* U' `0 A. o. D& k! mAll dialog files must be located in
# G1 B' I1 Y' V $UGII_USER_DIR/application or
" h+ `) [& n- W $UGII_SITE_DIR/application or
" ]' ~" c7 Z! X5 X $UGII_VENDOR_DIR/application directory
" Q3 }% [5 t5 a t" u--------------------------------------------------------------*/
5 @- m2 T5 t) v2 H8 {
) T( i5 c: c' ]" B1 H0 S& O& B5 d. dextern int LaunchProDesignDialog( int *response )
( h9 K( h0 Y3 R' t( E" j{
. G" z. Y% Q9 w: ~ int error_code = 0;
9 ~0 K: ^( K3 R% P 0 Q8 z9 i3 s' F- N
if ( ( error_code = UF_initialize() ) != 0 )
6 S! s, H' m, i$ X8 ? return (0) ;% @6 E( Q$ p+ B
if ( ( error_code = UF_STYLER_create_dialog ( "pro_design.dlg",* e& T: B+ ?6 P, s) ] w2 g* |) d
PRO_DESIG_cbs, /* Callbacks from dialog *// s7 T( k6 L S9 y& D
PRO_DESIG_CB_COUNT, /* number of callbacks*/
+ S! F+ C% K! C! {$ D+ ~ NULL, /* This is your client data */
& w* g, H$ D" D response ) ) != 0 )
' {; W7 v$ ?" n8 T5 [0 ? {, K# A% r; {' ^2 o+ y! y4 t
char fail_message[133];" ~: R7 R2 x6 J* Y- o( ?4 v# U
/* Get the user function fail message based on the fail code.*/2 A: u* U8 p# ^! o$ ]$ z
UF_get_fail_message(error_code, fail_message);
& Y& C) \6 { O) o6 Q- B8 N# y. q, l UF_UI_set_status (fail_message);" O" j7 E1 i9 u" @3 g
printf ( "%s\n", fail_message );
- x' Z9 X: t: Y' q }
1 V+ m# C5 w3 H' ]6 H$ J1 }. y
4 S" y. u ]# J. S, {: c! ~, x UF_terminate();
6 u% `& u) K' v5 q& h return (error_code);
+ |6 Q7 w# k" b0 U. q' A1 ~" I}
3 \4 n( Y# F) z" m+ m8 T2 F8 H" k& G9 z) j* x! z
4 b. g% ]. r. }/ P. F" z
- ^0 |: Y! U; q2 l/*-------------------------------------------------------------------------*/
. ]7 u4 q: ]! A2 B% o/*---------------------- UIStyler Callback Functions ----------------------*/. o8 `% G0 c" c3 r0 ^( ^4 J4 _
/*-------------------------------------------------------------------------*/
; U) p5 E0 I- p' s$ A l/* -------------------------------------------------------------------------) W+ _4 w: z& [$ ?5 v/ O- Q# W
* Callback Name: PRO_DESIG_construct_fun) v& d3 E5 a8 l2 L
* This is a callback function associated with an action taken from a1 z+ p& F- g5 ^
* UIStyler object.
# v# c( m0 G; ? *
R3 v5 [, K% o' V# z * Input: dialog_id - The dialog id indicate which dialog this callback; r- y/ z4 l6 X/ F) |0 X# m
* is associated with. The dialog id is a dynamic, I; k( T6 H9 O
* unique id and should not be stored. It is
0 X! X4 p) D- i5 l. d1 z * strictly for the use in the NX Open API:3 [# `: }. Q( J) e
* UF_STYLER_ask_value(s) + x3 X/ E0 b" P- y" O" u1 s! \* G
* UF_STYLER_set_value
$ f, g* ~! v& r" j * client_data - Client data is user defined data associated
. b4 I+ |8 d M( k) M7 q * with your dialog. Client data may be bound
) V4 V& R/ P' [0 |' Z+ P * to your dialog with UF_MB_add_styler_actions
" Y% @ `$ D, x3 [: M, L * or UF_STYLER_create_dialog.
- W: [9 }! R8 J! p( a * callback_data - This structure pointer contains information- l' f- k# J8 {; Q" R% m% a
* specific to the UIStyler Object type that
& q' r5 k2 f$ E$ O * invoked this callback and the callback type.0 T$ f( i( I. r: k7 Q- ^/ F- Z
* -----------------------------------------------------------------------*/$ i' k) v$ P* [1 R7 T
int PRO_DESIG_construct_fun ( int dialog_id,/ B$ n+ }- l2 A8 g0 T( x1 |
void * client_data,5 O4 G" e: G0 r
UF_STYLER_item_value_type_p_t callback_data)
K" U7 N* `2 E3 e. d& |{
- C d9 D4 \1 a7 e /* Make sure User Function is available. */
/ ]( T7 u+ B; v( x double value;( y: U" T. K }4 C
char prompt[256];& R5 d/ U, I) T' N4 ^* c; b2 Y, Z
UF_STYLER_item_value_type_t data;
J0 D* d( i7 c/ J6 B- B if ( UF_initialize() != 0) $ q+ |' C6 I. f) Y/ `
return ( UF_UI_CB_CONTINUE_DIALOG );
; j6 R, X8 B. W$ Y data.item_attr=UF_STYLER_VALUE;" z z6 i8 O7 b8 B$ ]0 C- }
data.item_id=PRO_DESIG_REAL_L1;
- l# W" c6 V: k3 _. X7 l, Z u8 Q UF_MODL_eval_exp("L1",&data.value.real);
% ~1 B' W0 ~6 d% `4 \ UF_STYLER_set_value(dialog_id,&data);
' y& s& F/ o8 t" G$ T$ F data.item_attr=UF_STYLER_VALUE;
2 ~+ j# y$ Y3 C6 Q data.item_id=PRO_DESIG_REAL_W1;+ w6 f- N+ u5 A9 d! [
UF_MODL_eval_exp("W1",&data.value.real);
8 j" i' y- @6 Q: K& o9 |) _. B$ {! } UF_STYLER_set_value(dialog_id,&data);* f8 }8 n% r. f5 J
data.item_attr=UF_STYLER_VALUE;" n: N- a* ?, W6 f; T
data.item_id=PRO_DESIG_REAL_H1;$ |9 ], }& w7 k# A
UF_MODL_eval_exp("H1",&data.value.real);
J$ g+ u, d9 s7 D3 F" h UF_STYLER_set_value(dialog_id,&data);
) ?0 m$ |. P: I m+ Z O, ~$ G( `$ T0 E7 H8 U5 W4 p
data.item_attr=UF_STYLER_VALUE;# p6 ?1 y! w! i' [8 d
data.item_id=PRO_DESIG_REAL_H2;% U/ s( ?( `: f% r1 B( c# h, S/ k, D
UF_MODL_eval_exp("H2",&data.value.real);* k$ Y+ q7 i4 o: B, \4 c \1 D
UF_STYLER_set_value(dialog_id,&data);
5 }. D2 E2 n/ k; c% Q* C" \ data.item_attr=UF_STYLER_VALUE;- }3 b; N ?+ A. a! \, e' ^, k! o
data.item_id=PRO_DESIG_REAL_L2;
- @% ]! n! v1 R7 {# @ UF_MODL_eval_exp("L2",&data.value.real);2 \ ?2 R" e8 a, V
UF_STYLER_set_value(dialog_id,&data);5 {0 G5 B3 `1 |2 [4 N0 Y" C
data.item_attr=UF_STYLER_VALUE;
; `7 r, }2 o1 r$ i4 u data.item_id=PRO_DESIG_REAL_W2;
# C& q, i! ]* n* w6 F+ G5 J UF_MODL_eval_exp("W2",&data.value.real);1 V$ L+ J+ e4 r+ q$ W
UF_STYLER_set_value(dialog_id,&data);
+ P( p! n i2 h data.item_attr=UF_STYLER_VALUE;
) E6 J& R- Y% l* F+ r8 Z# B4 `" b data.item_id=PRO_DESIG_REAL_L3;- Q* A" _, ?1 H* ?
UF_MODL_eval_exp("L3",&data.value.real);
1 y6 C# V- |/ Z UF_STYLER_set_value(dialog_id,&data);
2 s: h: P! |' x6 e5 S UF_MODL_eval_exp("VOLUME",&value);
# u1 l) Q# _& } v sprintf(prompt,"当前压块的体积为%.3f",value);
) g8 R8 J" t# U( K/ y6 \( R' T data.item_attr=UF_STYLER_LABEL;1 T' \& W" x9 ^4 r/ M
data.item_id=PRO_DESIG_LABEL_VOLME;, D! l9 p) F" `# T2 P# B, o# V- d) v
data.value.string=prompt;( j# c6 }1 ?5 r; H0 B+ \
UF_STYLER_set_value(dialog_id,&data);1 E% o" ~ z2 M: z2 q) S
/* ---- Enter your callback code here ----- */
) n! O) o% W: {5 S0 a UF_terminate ();. u. V1 U# Z0 E# }( B7 k
/* Callback acknowledged, do not terminate dialog */! h* p" f9 _1 V3 p# Q
return (UF_UI_CB_CONTINUE_DIALOG); ! [$ C) u9 ]' g7 \' w
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */4 r1 f4 s8 l5 @1 l
/* for this callback type. You must continue dialog construction.*/
4 ]- y1 [( z7 G$ S! `7 T}
& V) a' A. { L# E- c: Y
2 W/ s0 A: R7 j! C# F/* -------------------------------------------------------------------------
9 Q. J6 z0 f" F) r/ \3 J * Callback Name: PRO_DESIG_ok_fun. @- n" y* h: T, {
* This is a callback function associated with an action taken from a# G) B3 C1 h4 W1 ?/ m; v! M
* UIStyler object.
$ g, a: @3 A7 I: ~3 m8 v: W *) D5 Q$ Y7 X2 J. y+ |
* Input: dialog_id - The dialog id indicate which dialog this callback
0 l% e! |2 Y0 K4 S: p6 R/ r * is associated with. The dialog id is a dynamic,
4 u0 I" t, j6 X * unique id and should not be stored. It is
7 W9 F# `' j1 J Y * strictly for the use in the NX Open API:
2 y+ y( f( Q1 t8 n * UF_STYLER_ask_value(s)
W: M2 j! [7 m$ q# ~& W3 @ * UF_STYLER_set_value ( X9 O9 Z$ p. V9 Z* J: e
* client_data - Client data is user defined data associated
+ C8 W1 ]9 W) H * with your dialog. Client data may be bound K" w) @, T" p
* to your dialog with UF_MB_add_styler_actions
C1 [" H" W' ` * or UF_STYLER_create_dialog. 0 ]* c. S. A3 R2 A O: R
* callback_data - This structure pointer contains information. E+ C. {. ~* G% ~7 k9 F" b, {2 w
* specific to the UIStyler Object type that
- J6 l( ? \1 @ * invoked this callback and the callback type.
4 g! u# R2 Y. P( \6 y8 f5 U0 z * -----------------------------------------------------------------------*/
+ I5 t) j. R) N, r3 i3 ]3 Nint PRO_DESIG_ok_fun ( int dialog_id,2 h* d3 }* h* |) p
void * client_data,0 |* G) E U! K+ e5 ^& s3 B
UF_STYLER_item_value_type_p_t callback_data)6 x" u) C0 g, w. ?
{
, `2 P! t$ N3 ~! E! J. D# S. z /* Make sure User Function is available. */ 8 [2 k8 ?4 k# z M
UF_STYLER_item_value_type_t data;8 p& j0 V, P( Q5 e8 k
if ( UF_initialize() != 0) ( L9 j0 C/ s! s! O& |6 D& h, Q
return ( UF_UI_CB_CONTINUE_DIALOG );# K) G ?9 j, |4 r
% G1 m8 a; ]" @3 J Z data.item_attr=UF_STYLER_VALUE;: L& _% v, Y# T4 I
data.item_id=PRO_DESIG_REAL_L1;( g: Z9 Z- f1 {/ g0 ?
UF_STYLER_ask_value(dialog_id,&data);
. @" M4 k9 Z# n3 m4 l# d PRO_DESIGN_edit_exp("L1",data.value.real); N- T7 z) h1 `9 V8 a
data.item_attr=UF_STYLER_VALUE;* a, B* @, J& G; D
data.item_id=PRO_DESIG_REAL_W1;: W+ @% T f a3 `" l" K
UF_STYLER_ask_value(dialog_id,&data);
8 F1 y0 J* h7 n9 I( W* E* f0 q4 b, m PRO_DESIGN_edit_exp("W1",data.value.real);3 g1 ?) V% e; u1 c
data.item_attr=UF_STYLER_VALUE;
; [1 X/ @. y4 y; O R L data.item_id=PRO_DESIG_REAL_H1;$ y* l* _& [' t
UF_STYLER_ask_value(dialog_id,&data);
+ _: I' S S& [ q, T5 o PRO_DESIGN_edit_exp("H1",data.value.real);: b7 e. [- c( v* K1 {1 Y
, s- u, X; O7 d% a2 r! [$ m' T( @( P
data.item_attr=UF_STYLER_VALUE;; m9 w; v9 w& Z+ B: A
data.item_id=PRO_DESIG_REAL_H2;6 s) @! ?. N$ @& Z( n8 N: ?4 @. @
UF_STYLER_ask_value(dialog_id,&data);
( b' z% }, L. U+ R' e, x; { L PRO_DESIGN_edit_exp("H2",data.value.real);
J4 m1 @$ a! ?1 } data.item_attr=UF_STYLER_VALUE;% u) A4 ]/ x$ }2 T4 j
data.item_id=PRO_DESIG_REAL_L2;
9 l* o# s! t# r! u% ^5 e UF_STYLER_ask_value(dialog_id,&data);
0 n5 M4 Y5 [8 V h2 n5 B, m PRO_DESIGN_edit_exp("L2",data.value.real);
a8 z+ G; U8 {: | data.item_attr=UF_STYLER_VALUE;
: I# H& h( D0 ]0 } data.item_id=PRO_DESIG_REAL_W2;
( @& d1 H* X* n! [4 |1 o UF_STYLER_ask_value(dialog_id,&data);8 S, `3 |: E3 ~1 J+ }
PRO_DESIGN_edit_exp("W2",data.value.real);/ W; e' B2 n N8 B: }9 [; L: ^3 F
data.item_attr=UF_STYLER_VALUE;
3 ^, ]* W9 @" b data.item_id=PRO_DESIG_REAL_L3;
6 b- `- u4 x3 d. j2 ~ UF_STYLER_ask_value(dialog_id,&data);
( c8 g; ~, e" b PRO_DESIGN_edit_exp("L3",data.value.real);
* A% V5 Q: n$ e5 C* {, b# G7 { UF_MODL_update();% Z _- \; n4 Z0 A
8 v% J. i1 e- i" c$ S# B! B
/* ---- Enter your callback code here ----- */
& t0 t: t3 j M( s UF_terminate ();
; f9 L3 i( H5 P2 b+ x4 A /* Callback acknowledged, terminate dialog */& T8 M8 [" L! X' ]2 K" x* R* Q/ j
/* It is STRONGLY recommended that you exit your */, X( a$ i0 {1 A) R
/* callback with UF_UI_CB_EXIT_DIALOG in a ok callback.*/
9 e8 W3 k2 ~9 t/ @* u /* return ( UF_UI_CB_EXIT_DIALOG ); */
, P: u: ]& d" [& ]1 s1 Y return (UF_UI_CB_EXIT_DIALOG); : q, c. o1 j& ]4 L" H/ o
}' m) s9 u3 G, x) d% ]# e3 e- S" \' E
5 }" l% t' b9 H1 }# _. {/* -------------------------------------------------------------------------
/ _3 @# _) b, u0 Y/ I/ c * Callback Name: PRO_DESIG_apply_fun) w7 ]* d. ]% _
* This is a callback function associated with an action taken from a
% X h$ q! \7 [; ?. Y * UIStyler object. " g9 H4 X. S3 o+ R# a* K) H9 [
*4 w: a) G. z4 k$ J* u* _
* Input: dialog_id - The dialog id indicate which dialog this callback( L/ ^1 Q) X/ C6 b; |/ x; G
* is associated with. The dialog id is a dynamic,
7 Y5 S$ a U( g8 W * unique id and should not be stored. It is
8 s3 c8 F! V0 J+ m% @ * strictly for the use in the NX Open API:
; G- z6 h4 f) ?9 M& ?! T * UF_STYLER_ask_value(s) - h* z# ? g- P( ~3 h* W
* UF_STYLER_set_value
+ W# p' [4 e6 j/ i * client_data - Client data is user defined data associated- h4 N4 m! {# o h. s9 v
* with your dialog. Client data may be bound
1 {5 D7 ?# ^/ T0 a: x * to your dialog with UF_MB_add_styler_actions# t* |1 M$ l5 V4 d+ I* X
* or UF_STYLER_create_dialog. % {6 e+ X5 v, B/ P+ z6 l
* callback_data - This structure pointer contains information4 L7 K; I( Q2 B/ n: y+ G& q- c& x
* specific to the UIStyler Object type that ) Y1 h) z& ^/ v
* invoked this callback and the callback type.
; R1 S; j R3 O2 V * -----------------------------------------------------------------------*// a* d! h, z/ y( j& W8 ~
int PRO_DESIG_apply_fun ( int dialog_id,
3 H+ f: n4 n$ |$ f# L: Z/ ?) R void * client_data,% b0 y$ D7 @7 V
UF_STYLER_item_value_type_p_t callback_data)8 Q _8 G4 {) M" w
{4 S: b3 Q( |8 E
/* Make sure User Function is available. */
% x+ d I& \3 e$ S# O UF_STYLER_item_value_type_t data;
' Q! v+ r% k# U- c double value;3 j& q2 `$ b0 D6 ~/ h
char prompt[256]; p8 M3 A3 w8 i, m; S
if ( UF_initialize() != 0) % T3 Y# \8 b% e! }
return ( UF_UI_CB_CONTINUE_DIALOG );
0 S+ |" M9 ~; w0 S# T" f data.item_attr=UF_STYLER_VALUE;1 g( |( F1 k# L8 B* w2 o! _
data.item_id=PRO_DESIG_REAL_L1;
! l/ V2 H( _% ?: q( j8 Q7 y! G UF_STYLER_ask_value(dialog_id,&data);* E) j" E' Z3 J3 X" N7 h/ `
PRO_DESIGN_edit_exp("L1",data.value.real);
7 j& a: B2 j' o3 | data.item_attr=UF_STYLER_VALUE;
: r3 l7 u8 l: r data.item_id=PRO_DESIG_REAL_W1;
; ^% y/ f$ K' E* A+ k. Q UF_STYLER_ask_value(dialog_id,&data);
% d) i% M. v( Y0 @5 G PRO_DESIGN_edit_exp("W1",data.value.real);
; g- H q% B4 ^& V, _+ `8 X# L data.item_attr=UF_STYLER_VALUE;8 C4 L4 f) r/ [; s+ x( p8 o
data.item_id=PRO_DESIG_REAL_H1;$ i+ ~2 l6 ]- F
UF_STYLER_ask_value(dialog_id,&data);
# c. X+ j; C: b4 m6 c PRO_DESIGN_edit_exp("H1",data.value.real);
& u7 @0 F: H) I! k" S% T- i5 p$ _- ^; Z. W
data.item_attr=UF_STYLER_VALUE;/ e/ I+ P- H1 x* b/ ~$ r
data.item_id=PRO_DESIG_REAL_H2; G- E* V+ y* l( }+ {- R( V9 S
UF_STYLER_ask_value(dialog_id,&data);
" ?6 B; N% P" k3 ^- H' u PRO_DESIGN_edit_exp("H2",data.value.real);7 Z5 d- K' S* T9 A- ?; u
data.item_attr=UF_STYLER_VALUE; O: t- g/ \# H
data.item_id=PRO_DESIG_REAL_L2;
6 r2 P: Z u1 a; ^5 C4 x1 k5 q UF_STYLER_ask_value(dialog_id,&data);
. U; t& k1 ^# d7 p PRO_DESIGN_edit_exp("L2",data.value.real);1 R2 W) ?$ S, w. {& g, `
data.item_attr=UF_STYLER_VALUE;9 ]& N% W9 r) d4 D2 l8 M
data.item_id=PRO_DESIG_REAL_W2;
& j# R" e& U$ K UF_STYLER_ask_value(dialog_id,&data);
7 k$ C5 Y: ^1 ?+ c; s PRO_DESIGN_edit_exp("W2",data.value.real);
' [: h5 C5 a1 B' M# c$ M- l data.item_attr=UF_STYLER_VALUE;. b$ B1 c6 ~8 X; N& q3 C2 K2 S& {
data.item_id=PRO_DESIG_REAL_L3;
0 t4 ~& V9 r ~6 E; ] UF_STYLER_ask_value(dialog_id,&data);
- t6 G$ g |2 [( m5 t PRO_DESIGN_edit_exp("L3",data.value.real);, I' o: ~8 D% @* q h3 R9 v( O8 }
UF_MODL_update();0 B1 ^% v7 p/ i, r
7 ?- j; ]8 C, ^7 Q( C! | UF_MODL_eval_exp("VOLUME",&value);
# X; B$ X" b/ H# j" J% l sprintf(prompt,"当前压块的体积为%.3f",value);
6 C- G: |- |: H6 k data.item_attr=UF_STYLER_LABEL;
* M4 k, z& W1 }, S4 H; H data.item_id=PRO_DESIG_LABEL_VOLME;2 A5 f1 I D2 i8 w
data.value.string=prompt;
" p: Y7 Y! k8 b0 ^& e UF_STYLER_set_value(dialog_id,&data);
1 G" J; K4 \" S /* ---- Enter your callback code here ----- */
$ p. x$ w8 _: J, X/ g& K# O6 U UF_terminate (); x; B1 v9 ^5 S
/* Callback acknowledged, do not terminate dialog */, _0 }2 |- E( J v, m
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */# l7 @% K0 N0 y
/* for this callback type. You must respond to your apply button.*/
& `9 l. d8 c0 l4 p7 c G' } return (UF_UI_CB_CONTINUE_DIALOG);
$ ]4 O2 j( f6 f}
: n8 B) c3 [, {4 @, T( w, t2 A3 L! U
int PRO_DESIGN_edit_exp(char *dim_name,double dim_value); D/ h7 S7 A4 x5 a& Q1 z0 r
{) C9 |4 |# R D, Y3 H0 D: X+ |) W
char exp[256],temp[50];+ C# Q' C8 H/ S5 H1 C6 Y" P
int err;2 L/ E: z7 f6 Y6 [0 t( K3 Q+ j$ T9 ~) x
strcpy(exp,dim_name);
7 f* R- z5 |7 R/ f; n( }/ n* ? strcat(exp,"=");
# R0 e0 x" e$ m7 v/ h sprintf(temp,"%.5f",dim_value);
& P( j' c T, l strcat(exp,temp);5 ^! R) E3 ~ A G
err=UF_MODL_edit_exp(exp);
6 s5 }+ t3 I0 g9 ] R return err;0 s' `1 R: j$ h" J
}
* {! \9 z- G5 b7 t/* -------------------------------------------------------------------------8 Z; o( W, u D0 F% I
* Callback Name: PRO_DESIG_cancel_fun3 F/ } ^3 r/ e/ E% J( u
* This is a callback function associated with an action taken from a
: o9 O0 q6 G+ W) ]! Y% M * UIStyler object. ) _5 V- |, U1 }( g
*( F0 S# [' d% X9 \9 w! q, d U- X9 F% P
* Input: dialog_id - The dialog id indicate which dialog this callback$ r; O& K7 N, Z; h, o x. l' d' ]
* is associated with. The dialog id is a dynamic,! x; r. {2 Z4 f$ M
* unique id and should not be stored. It is; I# E0 H2 u+ B9 Y- a
* strictly for the use in the NX Open API:. U; N- l0 P* N2 s1 v* U
* UF_STYLER_ask_value(s)
; J8 W$ \) O/ R$ i$ j- [ * UF_STYLER_set_value - T: q3 I% d6 h
* client_data - Client data is user defined data associated( e! I& P' R# }! n _
* with your dialog. Client data may be bound
0 j8 n3 ?7 t' R: O, E8 s# F7 P * to your dialog with UF_MB_add_styler_actions/ t: n5 {. m V- T* i
* or UF_STYLER_create_dialog.
) W2 Z8 M% b I$ J+ g+ Q * callback_data - This structure pointer contains information6 B' y# h# p% ?2 z3 e# u- @
* specific to the UIStyler Object type that # _0 J* D6 L* l ^3 g; c
* invoked this callback and the callback type.' j, {. r x \" x. X
* -----------------------------------------------------------------------*/0 \' ?' N* x4 q0 ~3 M
int PRO_DESIG_cancel_fun ( int dialog_id,
6 i M1 a' n% X& } void * client_data,4 |% q! l7 R* c0 n% M
UF_STYLER_item_value_type_p_t callback_data)
% I1 t; ]3 [! }+ W9 h, v{1 Q6 a1 k) z1 H9 j- p
/* Make sure User Function is available. */
1 S* v7 S4 u- ^9 P/ S# {" q8 H if ( UF_initialize() != 0)
3 s+ I: H8 w& L3 ` return ( UF_UI_CB_CONTINUE_DIALOG );1 G! A& H# j( Q T, [
/* ---- Enter your callback code here ----- */. l; A! L, [# Q- p
UF_terminate ();2 J& q) l( J) t8 k: |
/* Callback acknowledged, terminate dialog */
, v( S7 k* ^5 z( D4 A3 n y /* It is STRONGLY recommended that you exit your */ o, q/ I, w/ h* @1 V7 ]
/* callback with UF_UI_CB_EXIT_DIALOG in a cancel call */
" \( E* V' c% Z /* back rather than UF_UI_CB_CONTINUE_DIALOG. */
+ J+ g/ w0 z' O, U return ( UF_UI_CB_EXIT_DIALOG );
4 G( s, j6 @$ b& ?5 {+ m) L} |
|