源玛:5 L0 t. E* h% k C
5 g. a h) u$ |//////////////////////////////////////////////////////////////////////////////
3 u' ^7 e; V! C5 E7 m//
9 Z4 U' v( A: c4 Y K// create_oper.cpp. ^9 ^+ Z$ D. p
//
- b" \! k+ N: D ~: O# s2 |* L// Description:) ~3 A5 u2 L/ S1 Q
// Contains Unigraphics entry points for the application." R6 O. t" a3 t
//
8 A b# ?6 z- N//////////////////////////////////////////////////////////////////////////////" s% g2 |- A- c n
, W' K' e8 N, {
// Include files
; k- n7 @+ r, {9 D#include <uf.h>
# u0 N) c0 @. W0 I ?# v+ o#include <uf_exit.h> i, }2 N, ]) L* |6 ~& U4 j
#include <uf_ui.h>
6 y5 Y* y. I# o) d Y D+ r#include <uf_oper.h>5 @% |, l0 m3 J# v9 f! X7 k
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )0 m" {$ D0 X' x0 |
# include <strstream>
" |) L7 x& E8 s, E# include <iostream>3 k( ?$ ]# A$ s* g6 T
using std: strstream;) E: q1 n2 L$ k. ~& {
using std::endl;
" S5 ^9 m( _- Z2 F+ y using std::ends;
! A% S$ a/ `/ K( {3 b6 n using std::cerr;" {( p& G5 h: K' N
#else
' ^: k" l5 {( j/ }# include <strstream.h>
, }, h6 w7 [) |* Y3 }4 G# include <iostream.h>
/ S& K" y2 C# Y, B" @8 o#endif
6 G# r# u% Z. R: T7 G* e' x#include "create_oper.h"
! e% z/ g: w6 b. P% V- C V7 t
2 _4 N3 V, a' ]' K; D//----------------------------------------------------------------------------: o# p% h6 \ Y g* L, U- u& a4 |! b
// Activation Methods
2 y: D2 G2 M* p8 S//----------------------------------------------------------------------------
4 S, r3 V' o" h1 l9 O
& o* x% K5 @6 S# M( S9 T// Unigraphics Startup' |) k, D# z9 X
// This entry point activates the application at Unigraphics startup
G: ], g2 c( b: o9 K" |' kextern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
, K8 I I7 j/ _ n7 ~! [; z6 e, a) m{
. f+ U, h# y8 B' i" N9 p3 A1 ?' Y /* Initialize the API environment */
8 [. Z; t% o3 O' B6 W int errorCode = UF_initialize();, N" ^8 |; }1 |3 Y* k6 w
7 N0 v& ]6 n5 \$ n& v7 A8 A( y; n if ( 0 == errorCode )) h* v* {1 Y+ L' q& T, G7 n
{* E4 P( f! Z& R/ _& ]
/* TODO: Add your application code here */
; C# o' p- G, A" S* K6 I7 c, ]) ~, N, L, b l, F
char *type_name="mill_planar";/ K: A; R* q) ]( j6 E& D
char *subtype_name="FACE_MILLING_AREA";
: q. d" O) w( N; Z; U7 `5 v# r+ O tag_t oper_tag;0 g# F2 U2 O6 _, Y
( E8 L- Q7 y9 B* s. g1 t
UF_OPER_create(type_name,subtype_name,&oper_tag);% P( `% k- b% X% R
5 M+ X4 x T7 O9 S' g) W% F- j! }* x2 j" H5 ~7 K. B
0 x f. K" V" X1 V. w1 H
% c! z- ?* p7 R1 h' S /* Terminate the API environment */2 h* t* _: g& @/ l3 e
errorCode = UF_terminate();; l- E/ t$ V' H3 c3 U& M
}7 Q0 A& t o+ g; f4 L, E
# N+ o9 H5 B1 H. ?4 a
/* Print out any error messages */; r% L4 X% [' k1 d# @' F
PrintErrorMessage( errorCode );& L1 Z$ d& d! L6 J9 t
}
5 I7 ?( q- k& H9 X$ S- Q4 `
9 e: Y0 }9 W5 U! ]. d: m0 L0 ~7 \8 Z//----------------------------------------------------------------------------
4 B7 V4 }% Z X+ L" _2 e: `// Utilities
' m9 ^6 K% r3 u# E; a5 _2 O//----------------------------------------------------------------------------) f% c# X& M x0 q0 \: N; u F
0 f! e. g* _; M. b4 R* Q( K) w// Unload Handler& M: f z/ F6 n4 T: a$ ]2 a
// This function specifies when to unload your application from Unigraphics.8 R% U9 C- {' A, w9 y
// If your application registers a callback (from a MenuScript item or a
$ n" b2 e; V) t// User Defined Object for example), this function MUST return, E e# o1 e5 C% d
// "UF_UNLOAD_UG_TERMINATE".
0 j% t2 s( I+ _! v; A: x; rextern "C" int ufusr_ask_unload( void )0 u7 i1 `( S" d5 |2 k- [# A* F6 G% `2 Q
{
, I- I+ Y( z- b3 ~8 r0 Q8 A return( UF_UNLOAD_UG_TERMINATE ); C9 d; P) R* e
}# X, Z7 m1 ^: s3 n
8 B* n- K3 W/ L0 Y! B: J/ u, R+ l/* PrintErrorMessage. Y6 n: W' s2 p+ }+ L( U: h8 X" e, P# n
*** H) v+ D& t* N0 ~/ p8 G4 l8 K
** Prints error messages to standard error and the Unigraphics status
! `3 C! R5 y& }' }/ R** line. */
/ N4 X& c6 R. \- }6 Z' A7 }, Vstatic void PrintErrorMessage( int errorCode )
" v x! v$ }3 l$ g' G1 y{
) o x# r7 P4 N/ u6 ] if ( 0 != errorCode )
. M6 V/ t0 o3 v& ]4 v0 x1 u {3 u8 X" y9 z3 E; \3 D. U' U
/* Retrieve the associated error message */$ @3 R3 W7 {+ p& C4 Z8 d
char message[133];5 `6 v! q" |( X1 p/ {- b: O" S
UF_get_fail_message( errorCode, message );
0 O: Y! R& \% t, E* ~& H: r; C% o% V1 o4 u, n8 }" F+ @% \, t
/* Print out the message */# V: X" I+ a% d$ x* ^- ^
UF_UI_set_status( message );8 Q+ G- \8 S5 j8 |+ c. a
3 Y+ `. p$ O% ?( D! n // Construct a buffer to hold the text.
; K$ J: q0 s+ r- [4 C ostrstream error_message;9 k+ Z! ]: L) `' i4 ]3 @1 `
7 H' n- ^: T( k; ]4 s4 F& I
// Initialize the buffer with the required text.
; U3 u2 y+ y% G. X! T% @ error_message << endl
( [$ X0 @/ F/ U0 d6 Z << "Error:" << endl
6 m( a- B% N G" x# k+ r << message, z. v' p! K4 b
<< endl << endl << ends;& N6 ?" n3 C, a
6 I) K: z( w5 a // Write the message to standard error
" H6 R( x0 L, g) @- O4 O( A* |5 L cerr << error_message.str();
! ]1 ?# G o$ W }# F) d# \& m- Y6 u
} |