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