源玛:9 i _) Z; C. o( {) ^
2 f5 M( n/ H0 r) v4 R8 S
//////////////////////////////////////////////////////////////////////////////) v$ }5 a0 N* f( E3 G& H1 N* k
//9 T0 q/ Y' [- Z+ p' d1 s( x }
// create_oper.cpp
. ]0 ] K7 ~' Q* Y3 r8 {) G//" a& e5 }: ~( X( J8 X0 K: V
// Description:
; o# k a9 e- N9 _" v6 q% G3 Y7 r// Contains Unigraphics entry points for the application.
1 }6 X: ~5 O6 g6 N//
; x4 h: n% i, w//////////////////////////////////////////////////////////////////////////////
" F; i6 s" k1 o# T0 A7 k5 @( t& j2 x; p+ f( ~0 ^
// Include files/ N {& b. ]' _% a9 d
#include <uf.h>! _6 w) J( J! Q
#include <uf_exit.h>& ]# R6 t/ L( @- }' h, w" N. D
#include <uf_ui.h>
, G) D; Y0 a4 g. M# {2 A$ B#include <uf_oper.h>
8 N/ u0 b. e* _8 u3 z8 S4 J* J#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )! y2 V3 T( X) @6 v: }( y; C
# include <strstream>
7 L7 p8 K8 U0 K( ^7 r4 w# include <iostream>& E8 n% U$ a$ l" s5 g! m
using std:strstream;8 _ W2 ]5 Y, j7 L6 ]' ^& g
using std::endl; , V, J, t7 o0 N! f
using std::ends;1 R0 i1 `8 x/ d* d% f; \4 T
using std::cerr;0 i# n6 d' x+ \
#else
% M" t: r! I4 V- N O# include <strstream.h>
U1 c% P! o \! ^+ N# include <iostream.h>
$ u- G% @% B, p, }) v- [#endif4 o: w# Q! s% H+ A1 V& A
#include "create_oper.h"
. j% J5 o3 C6 h5 w9 x6 I$ Q9 F. G# p
//----------------------------------------------------------------------------8 c3 F8 I7 d5 ]6 F+ ?
// Activation Methods
2 x' h( m- B) b! `0 c6 W//----------------------------------------------------------------------------+ E) E4 b! Y' _* `& Y d0 {
! U2 o9 C J2 F0 a// Unigraphics Startup
2 c( n+ W7 p+ k" I# W& `// This entry point activates the application at Unigraphics startup+ p1 _0 j: h6 a8 D7 X l/ P8 v: H
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )0 r* l8 x. j; ~: }9 J( k* |
{* M9 Z, B, ]# {: [" C+ L
/* Initialize the API environment */& v! J! {% I/ i- }6 w3 w
int errorCode = UF_initialize();
7 I; c3 z5 J: {* `- m3 ]9 V8 A& p( O$ ]4 j" y/ w2 r% T
if ( 0 == errorCode )
- j* D4 D4 n8 E7 Q# m2 l" h& f0 p {8 T* ^" E% q0 L+ p( ~
/* TODO: Add your application code here */
1 n; w7 z; y$ _8 u% v( }
8 o' D! s* I3 s8 p+ l char *type_name="mill_planar";
% l+ N+ [ W) D6 o8 v: q$ P8 j+ q char *subtype_name="FACE_MILLING_AREA";- X' ?5 m) d- ^; o
tag_t oper_tag;
2 k3 v7 ?9 X+ V8 v. D9 g: s7 |" O# O' J5 @# H! `' Q) |! L
UF_OPER_create(type_name,subtype_name,&oper_tag);" S$ b7 h7 I$ l# X
& |" g% M. i7 g2 H# }" m6 U$ Y% F
! J/ |( q& H; d
# c( ?) y9 z' z9 i* j
; z: v! w/ C, c
/* Terminate the API environment */
* \( [4 u, d5 v6 D+ k: @( Y errorCode = UF_terminate();4 {6 V" s- G9 y# b6 P, r F) S
}
! i# T% W2 M7 q* k& Q# Q7 {8 y9 ~- i F
/* Print out any error messages */
6 P; n( S2 p5 n( ?) z4 N PrintErrorMessage( errorCode );
# o, e7 M7 I! m5 p. z+ w$ Q ]}
/ Z6 e; V- O8 D% ]" i- \5 I: ]9 s) o
//----------------------------------------------------------------------------/ _ x* ~3 ^# o: J, n" d0 y
// Utilities6 j5 G I# ~. [ l1 ]( E7 M
//----------------------------------------------------------------------------
5 b$ S% q/ n' q4 I
! {/ V6 ^( w& H) w1 o+ }, ]// Unload Handler5 d s, [1 L" m1 f' V: m! K
// This function specifies when to unload your application from Unigraphics.3 i! L3 p9 ]8 k: X; g. ]! y
// If your application registers a callback (from a MenuScript item or a
+ l, \( W) A1 l( _3 S// User Defined Object for example), this function MUST return
3 H* l. J( w7 B4 I5 |( { z// "UF_UNLOAD_UG_TERMINATE".
, C8 m# `, ^8 \+ [extern "C" int ufusr_ask_unload( void )
& a" {, X8 E- B. b t0 C' v: d{
3 ^9 `6 W. t: s0 W2 D2 C- @ return( UF_UNLOAD_UG_TERMINATE );
4 F- W+ ]$ O4 R* D}3 U+ h g3 C* H* Q! Z0 X
! }: Y1 J$ P; M/ d4 y1 Q/* PrintErrorMessage
# D* C& y3 ?" v8 x5 {: |**2 t4 W e* t S" |
** Prints error messages to standard error and the Unigraphics status1 f. v: F; S8 H! Z9 x4 d
** line. */
3 {$ g3 O$ R, d+ @: Q/ O+ W( pstatic void PrintErrorMessage( int errorCode )5 I3 T f- X5 b% `4 }! [
{
! J" F& b, Z; F2 ?) b if ( 0 != errorCode )( G \3 ^& K9 p& j: s' m% _$ T) _5 m
{
5 m Y3 B2 n) p' b+ `/ k+ o /* Retrieve the associated error message */
4 k$ Q7 {/ [: Q, Q char message[133];* H" U2 x, D0 P
UF_get_fail_message( errorCode, message );# V' y- X) W1 Y$ V4 d4 s; G
- k5 t- @ S# A- e' x
/* Print out the message */
2 [5 ~4 r2 _" c6 k UF_UI_set_status( message ); j" F- I, q2 X6 G& n
. z" `* v* i* X
// Construct a buffer to hold the text.8 B q9 m; E$ K
ostrstream error_message;& |# n; \0 X. N% [5 ~0 C6 P0 y
5 U, \- g1 K$ [, @; P
// Initialize the buffer with the required text.- N: u0 r! d4 P8 ?
error_message << endl
* f0 ~+ ?' e* Z$ A1 e- C; v9 A9 e << "Error:" << endl
% Z4 R4 `$ a1 T4 u* F+ k << message
) i" _. e d8 L \ << endl << endl << ends;5 G9 G, ~- E3 K* M: T! u) m
# @2 j% E8 U1 h3 E // Write the message to standard error" e& f1 @% Z; q/ z% G) d- |& p
cerr << error_message.str();! G, l. V* V( ^1 p
}& o! S, _6 q0 \) C" @3 d
} |