|
/*=============================================================================
$ H) t4 {7 u2 R* a# T+ M9 H WARNING!! This file is overwritten by the UIStyler each time the Styler
7 p) _) c) T6 ^. `1 M3 u file is saved.
& ]" b# O1 z% x$ A% y ' W `5 D0 a- g$ w! f5 n4 j& S
- U, _! S* w$ ^2 W2 c/ a3 A Filename: ZGEAR_template.c
$ g5 l& J0 }+ w( T6 P& @" J
7 b( e3 T; D9 ` This file was generated by the NX User Interface Styler+ i6 c+ E3 o( h; z
Created by: Administrator
. q F" c: a5 v' ], B. i Version: NX 4
# a) f. R% H- J8 }6 `4 r; t8 i Date: 03-19-10$ v( q' n( }/ [" j+ |$ S
Time: 14:14
* s, C: W4 [3 p4 k1 A; ] , e- @/ I: v6 |6 d; ?: \
This template file is overwritten each time the UIStyler dialog is; E3 t9 e2 @0 H" D W [
saved. Any modifications to this file will be lost.
- P# j2 @% S# y) ?5 ]+ n" @+ K* U==============================================================================*/
( y- H- z& s. S! X , A7 j0 G5 Z0 `3 i# i
9 E; I9 O7 m6 j8 v, K! K
S( ] Y2 m' g! R2 X
/*==============================================================================. U0 h% O' R [9 n- U
Purpose: This TEMPLATE file contains C source and static structures to & G& i; ~/ d* B: o* a3 s: \
guide you in the construction of your NX Open application dialog.
* Y F. I4 r8 \ The generation of your dialog file (.dlg extension) is the first step towards' {8 w! d4 d# @) h& @- d
dialog construction within Unigraphics. You must now create a ugOpen $ W6 q( Y% Q0 G
application that utilizes this file (.dlg).
; S) f' I" s) V6 ?7 L6 J7 ]; S
; ^3 x( P5 \& H9 h& P& w The information in this file provides you with the following:
$ f' D2 p$ O4 p
5 N6 J% g* N& e0 A0 |3 l 1. Help on the use of the functions, UF_MB_add_styler_actions and 9 } g. G% }# e2 _" J7 N. ], m+ y6 i
UF_STYLER_create_dialog in your NX Open application. These functions
5 W2 i: F1 c( }( C# n0 p will load and display your UIStyler dialog in Unigraphics. , q+ q% V) ]& @2 Y3 M( z/ k
5 Q# S K: ?7 s+ q$ J
An example of the function, UF_MB_add_styler_actions to associate your + K. z9 l& c- Z, s/ T1 ^- ?
dialog to the menubar is shown below (Search on Example 1). , z8 Z( W. [7 b* w8 ^0 F% T5 Z u( y
! r2 V1 Z7 n8 C" V An example of a invoking a dialog from a callback utilizing
# P( L2 \8 f* g0 Q) U UF_STYLER_create_dialog is also shown below (Search for Example 2).
* ?( Z# |' o* q$ Y/ | W- x0 D2 n. E : k0 P8 i/ W" s( x9 H
An example of a user exit utilizing UF_STYLER_create_dialog is also
2 [' [* c c* I2 b shown below (Search for Example 3).
1 `4 ] i7 W5 X" w) v( J; G) d) g
% z2 e% D# } L1 O' y1 z/ A& m 2. The callback structure: --- ZGEAR_cbs --- 4 J0 {6 {3 j$ `4 k2 F( Y& F+ ]
This structure is VERY important if you have callbacks associated with 8 |/ o& \6 C: J3 Y
your dialog. It correlates the dialog items in your dialog with the
8 m) U3 O* M: U* D callback functions you must supply. You should not modify this # @0 c" K" J/ r3 R
structure since it MUST match up to the information stored in your 6 D6 ^; j' p5 Q. Q C, r
dialog file (.dlg). Any attempt to do so will cause an error while 8 w: k# Q* o2 u/ z+ u+ x W5 W
constructing your dialog. If you wish to modify the association of
% m0 Q9 p9 e! R; @6 a- r3 | your callbacks to your dialog, please reload your dialog file (.dlg) into
) z# Y7 y4 U5 d: e# [9 G the UIStyler and regenerate your files. 4 D9 b+ H7 v1 K3 f8 ]
You do not need to be concerned about this structure, simply pass it as
- Q0 P6 A$ n. a/ J& m an argument to the function, UF_STYLER_create_dialog along with your 0 f3 g6 |+ k7 t* h
dialog file (.dlg).
% m# q! E- d; `& ^4 T4 T( N ' q# m" O4 J2 ~ Z& L1 `4 v
Example 1 displays the actual call you may make for this particular
7 _2 S2 M, A% ]5 u, Q) j% [. |# k dialog. 8 n* p$ F" I( o$ `0 v
+ d9 p! C; r) O, v$ \1 X) [ 3. The empty callback functions (stubs) associated with your dialog items
( t! _! W9 N0 R8 `$ c! D- V7 Y9 A have also been placed in this file. These empty functions have been 5 \& K' y R0 ^; N
created simply to start you along with your coding requirements. 6 ?$ h+ @: S! I# h5 G& S( Z3 B" I) O" z
The function name, argument list and possible return values have already
# J# U8 a: |8 g, z4 d* U1 k, k d been provided for you. 6 k, g* `* _9 z2 p
# a ^$ q' o; _, W% F& ^ j
NOTE: Each callback must be wrappered with the functions UF_initialize() / l" C) y& a9 l$ ?
and UF_terminate(). . ~( s; s$ Y: s% a) @3 z* C
2 k# a4 t* q: m; F9 E" @5 z
==============================================================================*/2 Z* }8 m- ~# k: A( O8 t
9 J& x! E8 a6 \+ u/ x
, q1 W3 g% R* G% [( t1 [/ ^* s! U% m" g9 g
/* These include files are needed for the following template code. */: F6 Z9 w4 W& N2 l
#include <stdio.h> . _+ _7 U5 g) \" v4 ~% N
#include <uf.h>
6 A( ]# }$ ]1 g7 K# C#include <uf_defs.h>
$ a! G( A9 c; U8 [8 Q P" f#include <uf_exit.h>0 q+ Z: T3 r, y- H- u! o5 W
#include <uf_ui.h>/ P# t6 @, F, e* S7 e
#include <uf_styler.h>
A. H0 G1 _* K1 a, o0 K#include <uf_mb.h> , S2 T9 g- a @' Z6 p3 m
#include <stdlib.h>
) |. i% N o# S* |5 z A#include <uf_modl_expressions.h>
2 C4 T3 T6 _! L) W% I) l4 F4 \#include <uf_part.h>
9 T+ {' O) h! m! q#include <uf_modl.h>+ I, r' f. u! ~) v, z2 l c* v
#include "ZGEAR.h"( r5 ]& w4 Z$ X, g( ~* B
#define ZGEAR_CB_COUNT ( 3 + 1 ) /* Add 1 for the terminator */
( p+ S/ K1 ^( W4 t7 H% N ' j t2 F) k0 j: C
/*--------------------------------------------------------------------------0 C( X# g; r3 U( ~
The following structure defines the callback entries used by the
9 p+ |6 f7 m4 g' Z/ f* d) h# ostyler file. This structure MUST be passed into the user function, : F- P/ K& j2 k
UF_STYLER_create_dialog along with SPLINE_CB_COUNT.
' {. r! ]& ]% q7 L: q: k3 G--------------------------------------------------------------------------*/
W5 ]: J5 _, z) @: W. {static UF_STYLER_callback_info_t ZGEAR_cbs[ZGEAR_CB_COUNT] = 5 J3 o3 U6 @$ k) W
{
# R4 E/ E& ]0 I% I# a" ^! f) _ {UF_STYLER_DIALOG_INDEX, UF_STYLER_CONSTRUCTOR_CB , 0, ZGEAR_constructor},# K1 U; n* P1 Y+ ^0 u6 U% ^
{UF_STYLER_DIALOG_INDEX, UF_STYLER_DESTRUCTOR_CB , 0, ZGEAR_destructor},
4 {6 U2 O$ z" ^- W$ j {UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB , 0, ZGEAR_ok},! D* \. ]2 K0 d+ J6 @/ N0 w0 f
{UF_STYLER_DIALOG_INDEX, UF_STYLER_CANCEL_CB , 0, ZGEAR_cancel}, H" ?! n4 e0 I
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
+ P, X/ ^$ x, v! a& `2 n};
1 u% { e7 N- a% @static UF_MB_styler_actions_t actions[] = {7 E, I7 ]# C8 `# q; G5 @
{ "ZGEAR.dlg", NULL, ZGEAR_cbs , UF_MB_STYLER_IS_NOT_TOP },! E- B! S6 n& t
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */
( T8 P" m1 t# a( r6 Z H/ T};
: B4 x' ^' F& H D* p+ w3 D B3 r1 d" B
: c* I* q. n' {0 v3 T$ l5 H H2 E& v+ x1 K+ M- w) \
% }! d/ T( b# l2 M: O& q' {# F- e" ^6 u
+ z' ` o: ?" B `9 o# E
( w% p6 E- E. T3 D( ]/ P6 M1 E
3 G9 \$ l7 F( O0 q0 u7 n
) c; |# ^7 H* }/*---------------- MENUBAR HOOKUP HELP Example -------------------
& z" o9 N/ M" ~! H3 S9 q& x* {; @To launch this dialog from a Unigraphics menubar, you must follow
) g. e6 g5 j7 W. ^* Uthe steps below.! r9 a3 @9 r- a7 z( F7 f
1) Add the following lines to your MenuScript file in order to
+ e" j5 r" k& f& Z5 C: b7 E- w: l associate a menu bar button with your dialog. In this
" Y) ?5 |4 w& |6 h# G2 s3 H example, a cascade menu will be created and will be 3 x% i5 q* a) d6 K: k; m+ K5 v" @* S0 [
located just before the Help button on the main menubar.
# ^2 v# |8 U* n0 y2 o The button, ZGEAR_BTN is set up to launch your dialog and ! F3 Y' U7 h9 \. `. L. D/ b
will be positioned as the first button on your pulldown menu., J2 t* o& k3 u* N3 r0 t/ z
If you wish to add the button to an existing cascade, simply 7 `; Q: {( c4 d4 d4 _( p
add the 3 lines between MENU LAUNCH_CASCADE and END_OF_MENU
& g8 ] U+ D9 P5 M to your menuscript file. 6 _. `; R. G8 }+ S: Y
4 B" t8 L$ _6 E8 Q- }0 Y& U The MenuScript file requires an extension of ".men".
2 e9 ~0 [1 n1 b. v; g Make sure that you add the extension to the file and place
5 Y/ k3 K5 A7 c1 U. u1 [) K5 c6 _4 y4 n the file in your startup directory:+ ]) p6 C: w" W! ]2 a: g
$UGII_USER_DIR/startup or
$ l( ]. F0 R4 H* n& J1 U $UGII_SITE_DIR/startup or
2 w& x* B3 B* X2 J! B $UGII_VENDOR_DIR/startup directory0 L- }) z9 j1 r( Y" g
8 O R, u6 w- y8 A5 |2 \9 ?$ L+ g+ t# Q
Move the contents between the dashed lines to your Menuscript file.
, J) G! M$ s/ {; y, ^4 L# h& M! ----------------------------------------------------------------
# J% V$ b! j# H9 l! d4 n* _( V VERSION 120
: ~2 f: G! ~2 _8 L1 ?
0 a( v2 K/ t" o& M4 c EDIT UG_GATEWAY_MAIN_MENUBAR
" M# e2 I0 M8 A; V% a5 S8 d/ _$ O- t- a
BEFORE UG_HELP
& f' ~3 a0 Y$ i V CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN
& o' I/ }: _% y LABEL Dialog Launcher
/ X7 @+ q" T1 V; S: z END_OF_BEFORE: K9 s$ w0 P2 `7 }4 W
) ], l# y) e- y5 m7 B+ M" ]5 v MENU UISTYLER_DLG_CASCADE_BTN% G' E, m/ t' j7 d+ s
BUTTON ZGEAR_BTN* c& r. _. p7 ?. t
LABEL Display ZGEAR dialog, c5 T. e4 l; a
ACTIONS ZGEAR.dlg
/ ?+ e0 F& D( d6 ~! f END_OF_MENU
# p1 D' g9 a" f6 o" G! g! ---------------------------------------------------------------' }9 J: d9 @8 E7 D" M4 q4 Z
+ D4 b4 i0 a/ D1 t8 E
5 I- M: Z5 \" U* N6 X0 D7 o
2) Issue a call to the function, UF_MB_add_styler_actions from the ufsta! g+ o) c/ v ?" k' h" n/ M
user exit as shown below. To use this call, remove the conditional ( O& B( S5 q! ^5 H
definitions: #ifdef MENUBAR_COMMENTED_OUT 1 }- L5 V* ]* \5 [0 s) b% {, V
#endif MENUBAR_COMMENTED_OUT
( y7 h, S' H. ]; i( }3 e5 | ! R0 X0 l/ f1 r2 M. V$ P: V. @
The static structure, actions, will allow you to associate ALL of your# n+ W6 m3 H( z" ]2 K' l9 Y
dialogs and callback functions to the menubar at once. For example, if you ) O, F7 o: u# f" D- C3 ~% v
wish to have 10 dialogs associated to 10 different buttons on the menubar,% e' S4 Z& M4 ^" C
you may enter each dialog and callback list into the actions structure. Make
! O, g5 u: A8 k3 ? sure that you have created a corresponding button in your MenuScript file.
6 K* ~ F g8 K
7 L2 W. F# y+ R' p# X& _+ [ N You may also have separate shared libraries, each with a ufsta user exit
& @- N3 R: U* W for each individual dialog.
v. S, v' b. `' g* Y0 H7 f7 z, c
9 C; b; k) [( Z" K# ~6 z: D- X8 `* W/ Z [$ _+ n
3) Place your compiled and linked ufsta user function in % e% z* z! u, W1 v+ j
$UGII_USER_DIR/startup or # C0 ?6 @; y2 V' l+ y, l
$UGII_SITE_DIR/startup or ( o5 Z& ^ ?0 M; ~
$UGII_VENDOR_DIR/startup directory. + Q% W5 B9 m7 y i/ R
& `8 k0 F! L, r- s
NOTE: The user function must contain the proper extension .so, .sl or .dll
. I1 k/ m8 E- D5 v; | to make ensure that it is recognized by the MenuScript. If it does not% \, h! c( r; O+ Q( G
have the proper extension, it will NOT be recognized by MenuScript.
; N6 Z# T, P8 {$ U* I0 h$ ~1 a# g
0 i) \% ]9 W' @! s+ E; B' @* y' m6 G; x' f; }9 ~4 U
The action name you have provided in your MenuScript must correspond to+ Q# h% G1 C$ f1 N
to the dialog name provided in the action structure. This MUST match inorder
4 V9 E+ z- e" t$ |8 X8 n* K0 } to bind your dlg file to your MenuScript button. * S) o5 Y% M4 Y* {9 |# m" d! I
, ^1 b' p0 K3 H5 q+ p4 z9 k
9 v: \' u! ]* f+ b# |( }7 g4 h4) Copy your UIStyler dialog file to the proper directory.4 z* Q% c0 ^9 R1 A4 V
All dialog files (.dlg) must be located in 8 L$ Y* x% f& v. }% P) }
$UGII_USER_DIR/application or ; U" y; m: O' B6 L' _* I" P# N
$UGII_SITE_DIR/application or 5 i# H) Z9 r! H6 d4 H6 w; s7 s& q% o
$UGII_VENDOR_DIR/application directory
~6 C7 Y. L2 r0 j9 S3 w W% W7 Q; W& @9 Z! s& T
* r6 {+ T# Z) o9 _
( @+ R$ e7 f- M5 ]
2 n9 Y X7 L7 R9 q* h5 L$ o+ F. J------------------------------------------------------------*/+ r: L/ @: h4 } w
//#ifdef MENUBAR_COMMENTED_OUT
* m0 S2 @) D. p; gextern void ufsta (char *param, int *retcode, int rlen)" P; F/ e" r+ N% |/ Q9 T+ P7 J2 k
{- h/ Z% G J7 M& e
int error_code;
# k1 t# J4 x" J k! B. L: }
* ~/ n) y7 } B% w3 H b if ( (UF_initialize()) != 0)
" \! m* j( ^, o( b3 G% [2 j return;; W6 u- _5 A3 Y6 k3 @
; S5 n m: E! T* A" k if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )' \9 @) n2 V& K; m0 L) `9 D+ s
{- r$ _9 C6 h- o
char fail_message[133];
- K3 B$ P) G W: I( \ x
- i: X- g& }, p, e0 s; I UF_get_fail_message(error_code, fail_message);! c1 i6 A, T2 t: C% z5 w
printf ( "%s\n", fail_message ); 2 M; \/ V% d" T2 b' E3 `+ J+ i: I
}
" P* L( G8 z3 l C
, R; v @0 r& f$ V$ Q2 R UF_terminate();
3 _. m" e! A, [ R& {- O return;
S7 @2 X$ D V, I6 K}
( B/ [* f* Q; P7 l8 m: l7 d//#endif /*MENUBAR_COMMENTED_OUT*/" d+ {# M6 \: J& q: ?( {
; F4 ?4 A& U; X1 g6 g' K* `9 x% ?- y/ }+ V% T# r% C
. D, J$ W* T) k; | M. f( ]* c/ b, `$ R Y: w# F/ h
4 T) P' J- y' y. b( z
/*-------DIALOG CREATION FROM A CALLBACK HELP Example ----------* {, s& T# o* f/ F8 P' G/ V: k s5 j
If you wish to have this dialog displayed from the callback of
; ]% k, Z& U! b* Q) G' {9 tanother UIStyler dialog, you should: 1 h) I, ~* m, F t) F5 e. H
7 b7 J. M/ b) z2 ?! w+ y3 U
1) Make sure that the callback of your UIStyler dialog is
& E. q) |1 ~- N/ c1 X) G designated as a dialog building callback.
A) g7 Q& m9 R# Z* t8 y2) Remove the conditional definitions:
, Y! l" o$ J, v. X& e! [ #ifdef DISPLAY_FROM_CALLBACK ) ~+ o: T+ @4 t# y
#endif DISPLAY_FROM_CALLBACK8 l" p2 R/ H" `# L
3) Your callback should issue a call to this function.; u" V% y& Y0 J* N+ l
4) You should also add the funcitonal prototype to your header file
* j8 k+ r8 @! }0 [. [/ w (ZGEAR.h) and ensure that the file is properly included.3 ?5 q- A7 B. M7 a
, f& L4 x8 y# l5 \7 y5 L- uAll dialog files must be located in # A: p; `" I" D4 g" \
$UGII_USER_DIR/application or
# K6 k: a O! L. ]& f- z $UGII_SITE_DIR/application or
# Y( I* w7 v4 l1 C( h $UGII_VENDOR_DIR/application directory, l+ j/ e- u! I
--------------------------------------------------------------*/
2 R' ?( i2 K+ X p7 r: Y' E2 A: v9 ^
* a3 u; ^9 C8 l+ l& F
#ifdef DISPLAY_FROM_CALLBACK
7 w' V! K- E- M2 Nextern int <enter the name of your function> ( int *response )9 s0 `4 X' [ t6 n/ |% l" \! i1 u ~
{
4 \3 z( S+ s1 h( E: y) g5 \2 H int error_code = 0;# L! J4 x+ U1 @! b8 Y
+ W( S0 g& t+ }
if ( ( error_code = UF_initialize() ) != 0 ) . C+ E$ h, x/ F
return (0) ;6 U3 {9 i$ f: M8 z7 u# F* m4 T. d
n) C5 Y& p7 g. }# I0 u
if ( ( error_code = UF_STYLER_create_dialog ( "ZGEAR.dlg",9 z* K( O8 s7 L
ZGEAR_cbs, /* Callbacks from dialog */
5 D+ c8 P7 a! C ZGEAR_CB_COUNT, /* number of callbacks*/% ?4 u& v( R6 L, {
NULL, /* This is your client data */
O& ]5 V, t7 h% s response ) ) != 0 )
6 w( t* S3 h2 | {
$ _3 `- r( i$ ? Q; I9 v; x char fail_message[133];
4 s4 J. K& X- o9 {$ N8 t4 f+ f' e1 M& P6 o8 o
/* Get the user function fail message based on the fail code.*/
/ o8 T6 E: G u6 \9 {9 l" F UF_get_fail_message(error_code, fail_message);
* t/ E1 `# c7 {$ y/ a. e UF_UI_set_status (fail_message);; {) q; z( V0 \3 ]
printf ( "%s\n", fail_message );
4 s( v; E' y: Y+ A* d }- P/ M: b( c6 I" }9 E! N
0 h( Z' E1 i/ ?4 j6 b% P: g
* e4 h/ f% `* R) j. B6 Y! S UF_terminate();
& M7 Z" ~+ R; A, l return (error_code);
' H3 u' f' }' S( x0 \( d}
8 N3 `& W" g" I' K$ }! V#endif /* DISPLAY_FROM_CALLBACK */ 6 J7 h6 h p+ w" V2 G$ |# P
: {0 ^% m7 n" \ N& M7 F9 y3 ? C! m% b% ^
$ I1 U' l3 n9 n% H) F4 _5 h9 q, P6 Y/ [5 ~
/*-------DIALOG CREATION FROM A USER EXIT HELP Example --------" z# r+ d2 L. d. }7 e/ c
To create this dialog from a user exit, you must invoke a
$ l1 _ [& a. w) Ccall to the NX Open API, UF_STYLER_create_dialog. An example
7 R- C( T2 X( @) Nis shown below.
! s% l" N3 Z! |2 a9 J# N" l) e5 z0 s* ]' |9 o$ R
All dialog files must be located in
2 d$ p3 u. w: {. r% u+ P1 h8 Q $UGII_USER_DIR/application or
+ Q/ C! f* ^) S9 K5 u( z" u $UGII_SITE_DIR/application or
# c7 Z( ^9 b- [; t0 F $UGII_VENDOR_DIR/application directory
6 o9 O Z5 P6 s7 [+ c' @" ^) d
" K/ }# p c C1) Remove the conditional definitions:
4 E5 u: O R0 s* v- I/ v$ t; n #ifdef DISPLAY_FROM_USER_EXIT
" a1 m, L7 T8 d# \0 x+ Q7 L #endif DISPLAY_FROM_USER_EXIT
, b _$ a) e$ d" c2) Add a user exit to the function name below, for example, ufusr.
' X: `, Y9 ~7 a; Y- d& i3) Consider how your shared library will be unloaded. Take a look* q7 x* @+ J% N' e% X) p
at the generated function ufusr_ask_unload.
8 h; I4 H8 F3 u$ |--------------------------------------------------------------*/9 j# g2 e) A: a2 i t; Y
: v6 ]' w" b Q% z: A+ t( u#ifdef DISPLAY_FROM_USER_EXIT: ]( v% ?" C- O! B0 o
extern void <enter a valid user exit here> (char *param, int *retcode, int rlen)
: c. i. V1 O5 ]7 G{- }& X& N5 x, H/ E
int response = 0;( T9 i1 |* B" g; q
int error_code = 0;2 b# b3 Y* g- [7 h; s" q% g5 ^
2 [. t' f I# ?2 g4 }! d3 T
if ( ( UF_initialize() ) != 0 )
: X3 X" j7 _- P return;
: O8 S0 W2 ?1 u& y5 c" e, A; }3 e" a; @
if ( ( error_code = UF_STYLER_create_dialog ( "ZGEAR.dlg",& ^% t- i! q5 U" N: ?% [
ZGEAR_cbs, /* Callbacks from dialog */
A4 ~" p- j# G: ~- O* O- ? ZGEAR_CB_COUNT, /* number of callbacks*/
% }" t9 H$ t* G3 f& w0 u NULL, /* This is your client data */0 J' U9 A T l
&response ) ) != 0 )
" K6 }* L- g0 X% s$ @. { {5 E( {6 P, _) W _& e+ {
char fail_message[133];
, F& l! v) j: X* ^: l& b( i2 ^* C0 l; _. g' j, {8 p/ F# D
/* Get the user function fail message based on the fail code.*/
9 p' y6 Z2 t. R* u3 `% m2 I% X UF_get_fail_message(error_code, fail_message);
2 A6 c; b" f. @3 v' D: [6 ~! M UF_UI_set_status (fail_message);
+ w. I& Z. {$ `4 s printf ( "%s\n", fail_message ); 4 R& B9 G& r6 B
}
+ t/ ^( K! i" a3 B8 d+ w; D7 z f" x* ^
4 B3 L( B/ V/ `# Z UF_terminate(); 4 K) b: _$ t! B2 b3 h2 P5 K
return;
# A. d: P; y7 U/ H1 ~/ w9 m}3 T$ T& I" x8 C5 r- F) A. }# l
9 A! z4 ?7 C- {' e. g x
1 c0 G: {5 u; B. X
4 g1 Y. U& B. p4 n7 a/ r
7 }) @! S, k* h7 p- N+ `
/*--------------------------------------------------------------------------5 E/ J, T8 H: b; o) B
This function specifies how a shared image is unloaded from memory 2 H9 B+ ]& {2 f" Y) H
within Unigraphics. This function gives you the capability to unload an ' i% O, L: r- O; C/ `) r o
internal NX Open application or user exit from Unigraphics. You can 9 a% b% G; a. u& S( n
specify any one of the three constants as a return value to determine N0 J) B3 _# s
the type of unload to perform: immediately after user function $ q5 V4 t' Y( m8 a0 V" q8 m, u
execution, via an unload selection dialog, or when Unigraphics terminates 4 W2 J/ B! f5 p1 ~
terminates. If you choose UF_UNLOAD_SEL_DIALOG, then you have the : C# O- I8 b/ I5 \+ Y5 n, L
option to unload your image by selecting File->Utilities->Unload Shared & G4 A: {" j R" o
Image.
5 n, ^ u8 F/ Q: ^; C! U+ z, K' B/ }) Q1 m( k+ w( O L
NOTE: A program which associates NX Open applications with the menubar ; k, n5 a9 ~, Y; h' L
MUST NOT use this option since it will UNLOAD your NX Open application image- v% U M" K8 H& L: G) V
--------) A k- e- R6 X/ R( f3 L+ x
from the menubar.
e/ {( Q/ B$ X$ X--------------------------------------------------------------------------*/+ h) T; w5 c/ T% I _: ^2 A
p( e! F7 t" }* L
extern int ufusr_ask_unload (void)6 g! i3 U! P# |. N. G& ~
{
8 z5 h X* O! ]0 `; u% T1 l. N /* unload immediately after application exits*/! k% D$ X1 E" L5 f! a q
return ( UF_UNLOAD_IMMEDIATELY );0 r' {0 T0 o0 ]- z' o r# }) q
/ L$ l4 D/ K8 k! Y9 y /*via the unload selection dialog... */7 A/ {! V- d( J# B5 T# u0 [
/*return ( UF_UNLOAD_SEL_DIALOG ); */
1 U0 ~8 n/ }) a, u8 B# i% ]1 s" w/ c/ H /*when UG terminates... */
8 R+ t$ S9 ] ~( J- F6 Q9 w /*return ( UF_UNLOAD_UG_TERMINATE ); */7 w; o( H8 x9 X |; T: L0 e
}4 ?$ e! W: j9 o$ J
& { W# X( w3 `3 e) o$ E: u u8 V1 {7 a& k' X' q- |" J2 G {
" I* }& z1 q/ y3 f' P9 l. f+ u
/*--------------------------------------------------------------------------
6 ~9 p x6 N r3 |3 xYou have the option of coding the cleanup routine to perform any housekeeping _; I7 B5 ?% a, G7 S3 m
chores that may need to be performed. If you code the cleanup routine, it is
2 l% f1 f) |& C( P9 m0 lautomatically called by Unigraphics.( H- A; h* Y6 F6 @! n
--------------------------------------------------------------------------*/
' I8 e) D+ E iextern void ufusr_cleanup (void)
( i! V' S: L5 r6 B6 a{/ x) B3 [/ H _' \' I! a5 C
return;
/ ^' e3 }: w( l- I}0 a% Y+ X: \( [* {
#endif /* DISPLAY_FROM_USER_EXIT */
$ u0 \+ }0 h$ r0 C- Q, y
* T. H& ^+ Q' @, t( c# K
2 k6 o- I4 b7 P% \/ v
# w6 k% v' M: a9 U* B0 M- o4 h. k' g" e( Q; S, I7 C( \8 d
) S& d; H- u2 e: x- @
& f. h9 K3 ^" B2 J& H7 `+ K/*-------------------------------------------------------------------------*/# f5 ^ k- ?8 A7 ]3 ^: P& }9 ]' B) D
/*---------------------- UIStyler Callback Functions ----------------------*/
4 F1 i m: E7 U7 T" S0 |/*-------------------------------------------------------------------------*/ B+ J, D' F, Q* E s
" O/ |0 w" V% {3 Hint ZGEAR_constructor ( int dialog_id,8 S4 Q! h: N; U; y# N0 g: _
void * client_data,
7 ^8 C% F, }& t UF_STYLER_item_value_type_p_t callback_data)
! O t6 K4 Q& H8 \* J7 m" u{7 W, f0 r$ W- L9 p2 A4 M& i
/* Make sure User Function is available. */
w; b/ B' k, _# f if ( UF_initialize() != 0) ( ^4 @% b! t3 d+ y! Y# T2 D
return ( UF_UI_CB_CONTINUE_DIALOG );
4 M/ j! u1 i( @4 _" o
! S1 K% Q( W8 t /* ---- Enter your callback code here ----- */
" E: ~9 \6 l+ y/ F+ s char dir[100];
8 w7 N- |2 g5 b: R/ E2 m const char env[255]="UGII_USER_DIR";
( t/ g s W5 Q0 P char *basedir=NULL;
/ ~$ @9 V% x$ r O8 s tag_t part; f$ b* O* _1 s8 J- ~+ _' X
UF_PART_load_status_t error_status;8 t2 _! q2 j5 ?5 s7 |& f) \
basedir=getenv(env);
$ e; V, B6 Z! q+ s. [
+ q8 m: o$ R1 j; R) M' V strcpy(dir,basedir);
8 u" N! U7 P! v) D8 @2 }! I8 m; q strcat(dir,"\\part\\ZGEAR_part.prt");
' Q4 I7 w/ y: `8 U/ x# v/ }" d& e+ D
if(UF_PART_open(dir,&part,&error_status)!=0) e" W8 `; m3 N& p6 F# R& m$ H7 v" v
{
* K' ~( i6 y+ S: Q9 y8 e6 F UF_free_string_array(error_status.n_parts,error_status.file_names);! U6 V- G5 Y0 D* g0 M
UF_free(error_status.statuses);
/ N! l( B0 ?- }# _/ A return(UF_UI_CB_CONTINUE_DIALOG);
8 z# M+ k9 M$ x5 ~/ s }- ~! t: Z+ t- D; G
UF_free_string_array(error_status.n_parts,error_status.file_names);& d7 W: e7 g& V
UF_free(error_status.statuses);4 L# ^! o4 p% b
9 U$ a# U! g& h# q) n6 ?8 N$ I4 Y2 T double arExpValue[5];% @0 Q b6 {, @
0 o/ v: B* S. O# i; h( t$ E
UF_MODL_eval_exp("Z",&arExpValue[0]);6 P. `; n0 ] l2 x5 j0 e* ~, c
UF_MODL_eval_exp("MN",&arExpValue[1]);! v# w' N5 C. A' [0 |
UF_MODL_eval_exp("YLJ",&arExpValue[2]);
) T( i* E9 a6 d UF_MODL_eval_exp("B",&arExpValue[3]);
: T5 t: i q+ i9 j' c: P2 x
0 I4 q4 v: y' B
1 U6 q& j) w/ V1 ]9 h; ~6 r) Q UF_STYLER_item_value_type_t data_set;
9 g) ?9 g M+ c! s0 G7 d3 U2 Q: r
data_set.item_attr=UF_STYLER_VALUE;- M: B# }, H( M# v" x! x6 n2 Q Q. K
data_set.item_id=ZGEAR_Z;
8 L5 q1 g! H- U- x: }. a data_set.value.real=arExpValue[0]*2;" x; S8 B) Y: x1 n0 x
UF_STYLER_set_value(dialog_id,&data_set);7 q$ ^& t% T1 [7 B/ b) o
UF_STYLER_free_value(&data_set);
* j& o, ]5 O6 m }5 K
& X$ E8 F* y2 G* W* T data_set.item_attr=UF_STYLER_VALUE;
5 {3 e# U/ h/ ^! I3 T data_set.item_id=ZGEAR_MN;
# f! k$ ~" S. Z: m9 p& b1 i" x data_set.value.real=arExpValue[1];
/ Y) t9 i# I. `) h2 o UF_STYLER_set_value(dialog_id,&data_set);9 Z& t% I6 Z. m" K+ Z& L
UF_STYLER_free_value(&data_set);) [; d* q" O6 J- N
* \, u, g7 u) h, y
data_set.item_attr=UF_STYLER_VALUE;. j! B9 F, E$ h
data_set.item_id=ZGEAR_YLJ;
. Z" y: ~7 I, _, m# l) e: E N data_set.value.real=arExpValue[2];! R8 [0 \, a) z$ |5 A" M( N
UF_STYLER_set_value(dialog_id,&data_set);( c$ U: ]/ d. K8 f. m) q) T- p% a- h
UF_STYLER_free_value(&data_set);6 H( M" Q% ?$ y- C4 K
0 I3 c1 C- l' J" i/ {0 s& K
data_set.item_attr=UF_STYLER_VALUE;
8 W9 o) D: D5 M1 Z8 T data_set.item_id=ZGEAR_B;5 `) d }1 d4 K
data_set.value.integer=arExpValue[3];
- Z+ a7 a" m% s$ @ UF_STYLER_set_value(dialog_id,&data_set);
. p7 i. Q/ q+ G; N UF_STYLER_free_value(&data_set);! \7 g* x( B( u1 w" h
% S. j5 `$ H6 }1 v7 }3 d
UF_terminate ();
2 X7 r+ I, S; |9 H( O- F5 d
( r7 t/ i5 Z5 d7 l/ s /* Callback acknowledged, do not terminate dialog */
) ]2 H! @- J6 M8 e6 p8 V, ^ return (UF_UI_CB_CONTINUE_DIALOG); 4 t- _$ @1 v( H5 t, E' G
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */8 \" h- ^4 W- W3 B8 Q" \, d$ l
/* for this callback type. You must continue dialog construction.*/$ @0 R, b% d' ^1 p" J" S% b. N
8 `5 a, R3 n% Q$ n* Q$ x; j}* U8 w8 K! D, s" b1 }
/ s3 O3 \% Y4 k H- N
! ^" ?( u8 T- c9 y' V/* -------------------------------------------------------------------------. S6 x7 O. L- P* G/ O' T
* Callback Name: SPLINE_destructor
: `& g- Q* H/ X. [# }- k * This is a callback function associated with an action taken from a4 ]& Y( [/ e: [
* UIStyler object. , O, K0 D7 c* ]0 Z
*
& A0 q. a1 q# u3 F3 u4 n2 I7 t- m * Input: dialog_id - The dialog id indicate which dialog this callback* X% V4 B) |2 M, ^
* is associated with. The dialog id is a dynamic,
$ j4 k- v- `$ t9 [4 G) u% `" \ * unique id and should not be stored. It is5 [* m( k# T. ?$ g4 y) `2 z6 r
* strictly for the use in the NX Open API:
' C5 Z! [% s7 c! Y * UF_STYLER_ask_value(s)
9 e0 [. H; Z7 F$ \; i3 a* y C: Y * UF_STYLER_set_value 9 ]% i# s" b9 [& e
* client_data - Client data is user defined data associated! o; ?% i1 R; t, c2 q2 Q3 B, q
* with your dialog. Client data may be bound
9 `; A" U, R# T( m5 Q# m/ @$ I * to your dialog with UF_MB_add_styler_actions' J- u% l h/ T$ f, C4 b9 f: x c
* or UF_STYLER_create_dialog. 6 ^+ w% c# J0 {
* callback_data - This structure pointer contains information2 b3 f6 b( q$ k( {% Q
* specific to the UIStyler Object type that
4 K" a! ~0 ~+ a: b, ] * invoked this callback and the callback type.
" K4 K/ s) L" O. N" e * -----------------------------------------------------------------------*/2 d2 O5 i+ K; ~. h6 q
int ZGEAR_destructor ( int dialog_id,
% c* R+ F/ x Z& E. H void * client_data,$ Z8 N7 K9 k; D
UF_STYLER_item_value_type_p_t callback_data)8 H1 r( H4 Z2 z5 i. ]6 C
{
8 l/ V& @3 ?. I5 {3 _ /* Make sure User Function is available. */ - A2 V! v7 ^5 X4 _# E" p
if ( UF_initialize() != 0)
# J& S" d" G8 c1 w/ ?5 a return ( UF_UI_CB_CONTINUE_DIALOG );" C1 [: @7 [+ {$ ?6 r
J5 I8 |. a0 M
/* ---- Enter your callback code here ----- */
+ z' d. k- n- _: o6 e( Y$ p4 L. h, Y0 H' f+ i" m' W
UF_terminate ();- C3 p1 v' h4 o4 E* V1 u V
% T* X$ R; E: U; j0 |6 w, U /* Callback acknowledged, do not terminate dialog. */0 U& J7 } r! N/ q8 p
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */3 |, T4 F, m8 q7 D- R; x$ U
/* for this callback type. You must continue dialog destruction*/
& v2 Y b- u2 ~/ t1 n return (UF_UI_CB_CONTINUE_DIALOG);
- I' q6 H" p0 [( H0 ~$ U
6 F# O2 S6 ]) ~}+ g3 [3 G$ h: j6 n
8 N5 t" C! k# |- k5 B8 N2 t
8 E: ~8 i) y( u7 ?; M/* -------------------------------------------------------------------------- Z' t& n+ k; |
* Callback Name: SPLINE_ok
) X% g8 e g6 o * This is a callback function associated with an action taken from a ~- P- t2 O8 y) [4 ~0 s1 D0 k2 O
* UIStyler object. 3 ]8 b) g. _9 Q2 T) _
*; S8 s1 z, }" m; l+ \. B+ a
* Input: dialog_id - The dialog id indicate which dialog this callback8 `; A" c# l0 h# |+ `" g) f+ [1 C
* is associated with. The dialog id is a dynamic,' Q) l% B+ y5 f, Z6 I2 G7 J
* unique id and should not be stored. It is2 ^2 t5 T/ P/ ]( Z
* strictly for the use in the NX Open API:
+ }1 O' `0 ], ~2 b% v& s * UF_STYLER_ask_value(s)
$ _7 S+ ^2 ]( g * UF_STYLER_set_value + Z, x0 N: c4 p& B* j7 x- ^
* client_data - Client data is user defined data associated, Q, @* ~' R: | Q1 T
* with your dialog. Client data may be bound/ i" E$ R: M2 G5 q \8 a0 J" ]" N
* to your dialog with UF_MB_add_styler_actions
" _# h/ r2 Q2 f * or UF_STYLER_create_dialog.
- }1 J) `, q; A4 e2 z! k * callback_data - This structure pointer contains information
+ V& `+ p# M N* e* n- N- ~- _ * specific to the UIStyler Object type that
} a- o& q7 e' P4 X" r * invoked this callback and the callback type.
) Q8 O: V4 t3 V# e9 o# S3 C* B * -----------------------------------------------------------------------*/5 l3 I \1 u* S' Z3 x$ K: j% \
int ZGEAR_ok ( int dialog_id,( n$ H. b" `$ Y; ^
void * client_data,
- r3 ]+ q e9 O+ P1 S UF_STYLER_item_value_type_p_t callback_data)
) |+ Y# h$ [, Q) R: ^2 V2 y{% L6 B+ r. V3 k% _4 l% ]
/* Make sure User Function is available. */
4 k7 I0 M0 G, {! s6 y* F3 e if ( UF_initialize() != 0) 9 _, |3 L" |9 K6 b/ s o
return ( UF_UI_CB_CONTINUE_DIALOG );2 B5 c0 M$ d8 V9 }& X
- i; x# ^8 T" ^/ N /* ---- Enter your callback code here ----- */1 n% L9 s2 z/ ~3 J% {4 H
int Z;$ X, L2 g+ Z. P7 H* Q) \
double MN;
}0 Z) ^; b7 L% [8 q; ? double YLJ;
, ?4 G5 f+ e# D# S! Q, V9 @ double B;6 X5 h7 K" J) n5 N0 I% `7 b3 s A/ y
$ h4 M3 K& [. Q( y/ E
: y$ B* g) c- Z: p& @6 W char exps_string[5][20];
1 A1 Q8 _2 v8 V2 P! g( \- M5 K& N8 S
UF_STYLER_item_value_type_t data[5];2 Z* g$ X; r! r6 I9 ?/ r+ l7 j
+ _3 Y, L9 B6 y7 v& k. e& h data[0].item_attr=UF_STYLER_VALUE;$ m& m) t% y: S
data[0].item_id=ZGEAR_Z;
9 d: e% i1 a0 ], y: X UF_STYLER_ask_value(dialog_id,&data[0]);
) g7 q+ H, u) q- Z* f
4 L2 k8 G% t- x* n" c/ H5 |; L data[1].item_attr=UF_STYLER_VALUE;% ]2 _# h" ? W) W/ j# l1 ]- e5 s9 @
data[1].item_id=ZGEAR_MN;4 M0 P& _$ d8 _: M- _, u. X
UF_STYLER_ask_value(dialog_id,&data[1]);6 Y; q" X+ l$ c/ T; S; [- H6 e* \
) c" s; W9 h2 S
data[2].item_attr=UF_STYLER_VALUE;9 F5 |+ S+ h1 d# N% A
data[2].item_id=ZGEAR_YLJ;
! m' D* K- M6 J/ C2 c UF_STYLER_ask_value(dialog_id,&data[2]);
! i. q, [8 J7 E8 @# K6 Y
; F% D( `2 U" N+ @& ^+ ]7 b8 ` data[3].item_attr=UF_STYLER_VALUE;$ {$ o1 n/ D3 S
data[3].item_id=ZGEAR_B;
( ~3 ?2 e" T4 D& Y- k# d, k* J: b& H UF_STYLER_ask_value(dialog_id,&data[3]);& ?: u) }4 }' n5 B- I+ t
; X* n8 B6 _" x1 J) t
! `4 p1 s; e6 u1 [' ^5 ` 2 f' z ?# H/ r3 L9 m
Z=data[0].value.real;
* X4 b/ B, B+ L: ~ MN=data[1].value.real;
. b$ X8 p7 \4 ~/ o* X YLJ=data[2].value.real;
' F: E6 u4 h7 l( B% p B=data[3].value.integer;( X0 Y/ v' p1 m L
1 K4 H0 c+ c; j) W7 b& r& b
" y/ f. W; g6 n2 p7 \* @: }6 x3 r; V for(int i=0;i<5;i++)+ V/ J/ e( L% U' A
{4 q/ i. B' B- Q
UF_STYLER_free_value(&data[i]);5 L3 `9 V2 M/ f2 v/ P
} F' I$ f3 N) z2 S3 O- _
9 \( ]6 V+ T' W* f0 J: a% Z if(Z==0||MN==0||YLJ==0||B==0)4 N* U5 W* }9 U# ~# @& E
{
0 _: u/ ]8 Y$ o* m' ~ Y uc1601("对话框中的数值不能为零!",1);
' z' z- F- G4 G return (UF_UI_CB_CONTINUE_DIALOG);
3 [; j0 y$ b# [$ ]$ X7 L- z* Y }
4 u% t6 U/ {& G7 r7 D" O: J7 v5 ^ % N: i* o, @4 }
% C- v6 i; ~( A* \6 p //修改表达式的值
6 a+ k8 ]& p" H1 R. I/ o sprintf(exps_string[0],"Z=%D",Z);
1 y Z1 A2 C/ ^4 _5 D4 _ sprintf(exps_string[1],"MN=%f",MN);- q, w( F4 R/ t# N) g
sprintf(exps_string[2],"YLJ=%f",YLJ);
' w G0 b# g9 G9 \6 w0 f sprintf(exps_string[3],"B=%F",B);
) o9 t; o( O0 |. v# H! ~. l 3 \/ Z8 a6 x2 H' T
7 k( R" b: x9 x; _ //更新模型
& I _1 p' y3 Z5 u0 z for(int j=0;j<4;j++)
. o) ]/ }+ L; ^. G/ ?0 g {
! f3 u; { Z+ L. E( a UF_MODL_edit_exp(exps_string[j]);2 z3 a; K$ e b# T6 `2 E. d# N! Y
UF_MODL_update();
/ P6 m, i# i3 O }
9 {' k; o( f/ h% N3 s8 q1 ^! I# r
( e' \- S7 j M, Y7 z$ Y1 C UF_terminate ();( r% q2 h0 m3 R, E2 p( @
7 c; x2 u4 w$ J" M /* Callback acknowledged, terminate dialog */
0 k& C- {& d; B, q /* It is STRONGLY recommended that you exit your */& m+ z/ H! M# y- `% q# J# @
/* callback with UF_UI_CB_EXIT_DIALOG in a ok callback.*/
) L2 C! p. |0 U* i! M! l2 F /* return ( UF_UI_CB_EXIT_DIALOG ); */# v/ @6 D# p6 ^
return (UF_UI_CB_CONTINUE_DIALOG); ( N2 T) y, D$ w, G0 Z8 V
H3 \( ~) ]. ~4 g* ~
}9 s! \5 L; R& B n: q5 d0 } w
5 p8 `7 u+ M2 { E
$ \- s9 d. k3 H& N" O8 O- a, `4 \/* -------------------------------------------------------------------------
% b$ C( j1 M% p * Callback Name: SPLINE_cancel
4 h, T& |/ M* o * This is a callback function associated with an action taken from a6 B% {2 E8 L2 O: o6 D) [" H! U
* UIStyler object. * g( K5 ]5 M* @+ m
*( h$ n- w3 p$ n6 [% K5 @" R
* Input: dialog_id - The dialog id indicate which dialog this callback; s6 b n$ `* L: o" ^
* is associated with. The dialog id is a dynamic,
: g- M( w- m+ \1 X) O * unique id and should not be stored. It is' {. F4 W) ]2 H5 t/ e! c
* strictly for the use in the NX Open API:/ K! L! V% _8 x! v
* UF_STYLER_ask_value(s) % `- f1 h' G! Q: \& d0 b' o
* UF_STYLER_set_value
* `2 c4 C$ m& @, v * client_data - Client data is user defined data associated# p4 O) f+ n# W6 y# l
* with your dialog. Client data may be bound; }+ L2 X6 k, `7 Z5 ^* q
* to your dialog with UF_MB_add_styler_actions, k( C! y1 p0 K
* or UF_STYLER_create_dialog.
" I0 j5 Q u2 A9 i9 u * callback_data - This structure pointer contains information
a0 o a ~4 [# h. ^ * specific to the UIStyler Object type that
' r! B( y( I: O' `& a8 r+ h9 t * invoked this callback and the callback type.
5 r. C, @. p3 L* H * -----------------------------------------------------------------------*/5 r- V6 @ r9 ?2 S+ b
int SPLINE_cancel ( int dialog_id,
3 g3 ]- g2 H/ d4 |. o( Y6 w void * client_data,
; z. a) C7 \) a7 Q) P, y, x% V UF_STYLER_item_value_type_p_t callback_data)
! ?, b2 }7 Q6 X) U9 n- b{3 ]$ [% I1 x2 ~5 o
/* Make sure User Function is available. */
! r2 e' C( P. n' [: F; X/ E9 \9 t, l if ( UF_initialize() != 0) , N) n7 ]3 X1 T% E5 a5 U% @0 \
return ( UF_UI_CB_CONTINUE_DIALOG );
5 D, s) {& }( h; \0 X( a$ G& o& j
; ]0 |6 |* Z) o% z F( _- L /* ---- Enter your callback code here ----- */
& |4 s( M8 Z! O C- [: z
- v( c! G5 [8 Q) f2 H UF_terminate ();4 Q# c1 e8 \7 K) E2 @6 t" H. \
' r1 \% ^: g" O3 m
/* Callback acknowledged, terminate dialog */
) z5 s$ `) i+ m) E /* It is STRONGLY recommended that you exit your */
1 i0 r( f6 Q9 g4 } /* callback with UF_UI_CB_EXIT_DIALOG in a cancel call */8 X# }6 s9 r, l% g8 n! }$ L
/* back rather than UF_UI_CB_CONTINUE_DIALOG. */8 ^4 d& `& X( X1 `1 c# G- G( O0 T
return ( UF_UI_CB_EXIT_DIALOG ); ' }/ u$ h1 l# F8 j, l8 Z
8 z' u# i0 u+ ]
} |
|