|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 I4 C* {. N3 O2 }% i
/*****************************************************************************
6 j( J2 x/ H; x! T3 Y1 \**
% @' @5 s+ G7 E** createfilebox.cpp* j; w1 j, O5 J$ E+ ]; |* e
**
$ ^6 Z& G' \: R# V5 V8 O** Description:
. T4 j1 G" f" P5 A** Contains Unigraphics entry points for the application.
! |+ a1 I: r( \" C' S! M8 }**- ?! l6 k% j: |/ m, Q4 v
*****************************************************************************/0 P0 [8 i% o- Z% {% ]6 ^* o* M
/* Include files */3 k1 B4 ^1 [& `
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )9 x- |4 k) g# w% B; M
# include <strstream>. ~9 ], U8 ^3 y8 I9 ?+ S
# include <iostream>& K8 b p# m' w/ I7 h* |: ?
using std: strstream;. S" c/ m9 X9 X+ k3 C. I
using std::endl;
- j7 r; |8 H# ]% V& {$ h using std::ends;
' {6 c8 {7 i: d6 a( @1 l& V+ S' m using std::cerr;
3 {% u9 t2 u% N- }#else
) U2 R% B% Q b) ]; w* B9 g# k% b# include <strstream.h>7 ]. T7 s" z0 Y6 z
# include <iostream.h>' U( E8 N8 m4 ~9 a# |1 C
#endif
* S# D2 Q# @9 Z6 Z7 I9 M#include <uf.h>
, w8 ^! X, q1 o' f, d9 p#include <uf_ui.h>' c1 j' T: R3 H3 b8 G' r) j# ]
#include <uf_exit.h>2 e+ v" @2 r6 I d6 R
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))% E7 g$ @ O* n& f! S
static int report_error( char *file, int line, char *call, int irc)% Q ]; \. q' k2 \3 H
{
- a4 x! {: k& w if (irc)# b- o# B; `7 m1 }( T3 |
{3 j: z* U. W0 |6 ^
char err[133],$ l) G7 K1 v2 D- O) `6 |" m1 j
msg[133];
' E# z7 `2 l# Z sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",8 v& L/ k7 j. D! g* J
irc, line, file);" c# z* U, I" H) N( [% G
UF_get_fail_message(irc, err);2 ~2 R$ v" \; p/ P7 m
UF_print_syslog(msg, FALSE);
0 Z- A3 A2 m: E0 {6 \0 f UF_print_syslog(err, FALSE);
0 b x- I, l e8 Q2 N2 }9 X UF_print_syslog("\n", FALSE);
2 a* X) b1 x0 X5 c, r UF_print_syslog(call, FALSE);
9 O+ ?) o+ H5 O' g0 E6 J% A# e UF_print_syslog(";\n", FALSE);8 O( L& l3 u6 B) i
if (!UF_UI_open_listing_window())* j, I7 q2 y; I' g- R
{
/ Z- Q- y0 C( ?( _) d3 t0 d UF_UI_write_listing_window(msg);0 X) n* J9 _- x+ ]& F! z
UF_UI_write_listing_window(err);
6 b+ d& P9 W8 x, L8 c UF_UI_write_listing_window("\n");
. p) L6 T8 n% r, Q UF_UI_write_listing_window(call);# w' C+ k1 w3 a/ w
UF_UI_write_listing_window(";\n");+ |# T8 E3 N+ s- p
}8 o, w0 F! n& g: x) v* X% [; }
}9 b T9 y" w% i1 i
return(irc);6 k8 \1 u1 v& j6 x. o
}
/ a% }$ Q8 d$ C* t9 z# I) s& f9 N5 Y5 e; m( N# z
/*****************************************************************************
% O# s5 U1 ]( |& E3 _** Activation Methods
9 ?3 e: ?+ O" B$ Q2 Z/ ^2 t2 u1 L8 M# x*****************************************************************************/4 u. q2 a3 l' H8 j. F. F
/* Explicit Activation% E# ~2 M% `6 g, h4 u
** This entry point is used to activate the application explicitly, as in/ Y. s$ _. ^% G5 Z' B; J t
** "File->Execute UG/Open->User Function..." */$ ^9 d; ~' z0 s4 M8 b4 ?& a, n5 p9 Q
extern DllExport void ufusr( char *parm, int *returnCode, int rlen ); U( H3 s2 a5 v! O" L ?
{8 A9 E9 {; P+ o! m- R/ M5 \$ Y) ^
/* Initialize the API environment */; t( T% S( X3 r- T1 ~
char prompt_string[]="open file";
6 z7 ~+ T9 E# Q4 Q- N! i# U char title_string[] = "select file";
, a0 F7 I/ E- K6 V char filter_string[] = "*.prt";
- t$ y5 @ U% U8 c char default_name[] = "my file";) r( M0 H. C; h4 k7 C
char filename[256];2 ^- t$ j9 \9 U) Q% P4 \
int response;6 d+ T, ~7 i( X" r. L+ Y# e
if( UF_CALL(UF_initialize()) ) ' u. D* C4 G: p" l. o
{0 B7 b, o- y- h7 Q' I; J6 N! m, \
/* Failed to initialize */8 R& Y: T% K$ j, m- }; v
return;
( C4 h) b5 d% B' ^" g8 O }
5 E ?. t1 {3 `% Q5 c6 o & M6 m6 d% {& n
/* TODO: Add your application code here */$ @( J& y2 @4 X7 n7 u
UF_UI_create_filebox(prompt_string,title_string,filter_string,default_name,filename,&response);//UF_UI_create_filebox3 _" [$ @/ n1 C' ~9 U5 a- `6 L
/* Terminate the API environment */
% ^/ p! s0 [4 w7 d9 M& s3 d UF_CALL(UF_terminate());
$ L6 |/ |1 z( O4 `6 d0 M6 ^" c}! x1 e+ O& d) d5 s& S, `! D6 K
/*****************************************************************************! O: O4 ^1 L; i: r h
** Utilities% Z1 Z5 ?# a$ [( ~4 K5 A' u' H1 t
*****************************************************************************/
2 ~( M# l: _7 {6 z2 r/* Unload Handler. z5 v* A. ~8 z' s6 W
** This function specifies when to unload your application from Unigraphics.
) }( k/ ~& S8 ~% M7 t** If your application registers a callback (from a MenuScript item or a8 @. Z0 D8 c4 u- a& d7 l
** User Defined Object for example), this function MUST return
) g! l, w0 ~' E7 Q; w9 Z* O* W) J** "UF_UNLOAD_UG_TERMINATE". */
1 e' z7 P4 n j5 Q( m+ p8 m" Bextern int ufusr_ask_unload( void )/ f- N. O) t. D, i9 G; |
{
5 r$ h6 a _* e- B return( UF_UNLOAD_IMMEDIATELY );
* R8 ?; x- E/ E9 i3 t8 N! f}/ Q$ k3 y$ J4 ~1 W" h' e( |
9 H. }5 e' w: v# h7 b
|
-
|