|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
% i7 ^! ]! H) P' R* N S d; W8 q$ L#include <uf.h>
: {/ T. J/ G( i* n# t#include <uf_ui.h>
; a9 H" Y# |- l, C' I#include "UG_UI.h", n4 p- ] Z& k" r
#include <uf_mb.h>
8 S$ V, [+ z8 s0 W3 D. D5 |#include "UG_UI_calculate_dialog.h"1 U9 K8 v) p& X
6 ~2 P8 B1 X+ ` ~/*****************************************************************************
2 m$ I" l; e# V8 T0 H- i2 J** Activation Methods3 Z6 W' W/ I# b( y/ F4 V1 s3 c0 b
*****************************************************************************/
7 O) o9 b4 s+ P; P
6 T4 m$ I9 {$ L$ ?% N& H/* Unigraphics Startup( n7 W% b% d9 ^
** This entry point activates the application at Unigraphics startup */
: r4 a; t: D% d8 i/ d0 S8 Lextern DllExport void ufsta( char *param, int *returnCode, int rlen )
# |; f5 e( k9 W{4 X. _1 B6 I4 H8 A, g
/* Initialize the API environment */! w+ [+ P9 p5 r. q
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
- K2 b l8 B; {! [: G UF_MB_data_t,UF_MB_activated_button_p_t );# q) _4 t; z: n
static UF_MB_action_t actionTable[]=/ w, b0 _ \' v9 Y$ ]1 M
{4 Y4 \% N, K3 N. e6 q* t1 j
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},% U' }4 a N4 Q& W& T. e
{NULL,NULL,NULL}
& M# d: d/ L7 b% D };6 P3 c$ V" J* |2 |
int errorCode = UF_initialize();
* C8 o5 m% v5 R/ d7 x/ j if ( 0 == errorCode )
6 l( v. n4 ^2 U) r0 D: E- R6 E% W' p {' Q1 a0 u: W% X
UF_MB_add_actions(actionTable);
7 C- E5 I2 h& H d: y& C errorCode = UF_terminate();6 b- v8 u5 B6 z% O& `
}
* i9 N. P. Y9 y' i! [7 Y1 J1 c PrintErrorMessage( errorCode );
0 R& Y5 G/ @* k* I% S}
5 `- Q7 Z$ z8 j- s, F7 W
& d& F& L$ f0 ~% x( P! ^' k# }static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
3 t c; f) } P UF_MB_widget_t widget,; N! I5 Y) H* u. N c* [
UF_MB_data_t client_data,
9 n7 ~8 Q5 U, |+ E UF_MB_activated_button_p_t call_button( m. n( I6 L* m6 t! f! b
)
: @. b5 C. X/ k. Y' h{
: I0 p- r0 ~3 h& M% w% m UG_UI_calculate_data m_data;- r3 K" Z& P$ e% u# t
int response;
0 Y3 a6 E. V& R! n! k6 |3 P$ E% d6 T LaunchCalculateDialog( &response ,&m_data);
9 ]- a, R1 E* [4 M return UF_MB_CB_CONTINUE ;
- P; z0 D; l3 t( C7 u' n}; F: l$ M9 |% a4 @+ x: ^5 n- {
/*****************************************************************************
; H9 ^5 K8 L; S' ?3 J+ S; w** Utilities
( M2 B4 L- s9 Y: F" w*****************************************************************************// X% s5 j& r0 g( Y/ u
% C, t) f7 @# _' b
/* Unload Handler
, I8 c0 |9 B& I" T# C1 J. W** This function specifies when to unload your application from Unigraphics.! K, R' S5 X1 K5 L& S8 h
** If your application registers a callback (from a MenuScript item or a9 N5 ?) k. k/ |: {4 m
** User Defined Object for example), this function MUST return0 c! m0 X: z. n( t+ E' g9 a5 @
** "UF_UNLOAD_UG_TERMINATE". */
% H9 }7 {$ F& j M! }extern int ufusr_ask_unload( void )% j c& L# a1 E* H% [" I. m
{; C" b. u8 E( K+ _ ]7 _+ K
return( UF_UNLOAD_IMMEDIATELY );
" g4 B- _& @( i1 s}
) Q' m! U( r, p; `, i( a, }0 H5 b) w. D$ ^9 D
/* PrintErrorMessage4 Q5 X) G( C9 C% m
**/ T0 `0 | \" i' x8 q+ g
** Prints error messages to standard error and the Unigraphics status
! t$ |% z f7 X: S- L( ~** line. */
. W; i! h0 p/ S c. B5 Lstatic void PrintErrorMessage( int errorCode )
* G; c) F' X( P3 e/ J O3 q{) B! u$ j' s2 @- }: _" Q& _
if ( 0 != errorCode )* k9 f* N7 Y; y! L. z! W7 a
{
! [2 c# Y. K8 p$ w& C( g) q9 O /* Retrieve the associated error message */ n( O. w/ J' F
char message[133];
3 x/ ?% A2 d3 P- _: t& j" n" H UF_get_fail_message( errorCode, message );6 B2 _- }. p: B& C: D8 M
6 B0 A3 B& j8 ^7 ^: \" E /* Print out the message */8 S- u% g1 K& g' a O3 I
UF_UI_set_status( message );; L p p7 T. x# D* E. F: ~
9 z% V2 m+ r, o& h% u- G( o
fprintf( stderr, "%s\n", message );
; q, j* P/ A5 o8 k/ Y% S- }) L$ A6 z }+ l# X4 d; t7 n0 g1 {" L j5 A
}
* Y/ X' D }: c9 i以上代码编译之后显示) @2 c5 Z p! ~
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int4 ^$ Z! W$ L3 }4 K
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
) G$ _" ^: q# d- l. ^; s自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
2 E8 p! g1 q! Y/ t A
, \9 M( [+ g7 S6 p" Z6 } |
|