源玛:6 i( }* S/ R0 Y2 b
5 B+ P% K7 }% a7 X! U3 `- @
//////////////////////////////////////////////////////////////////////////////1 L1 _! K! R" h8 a$ Z- E. |$ e: a
//0 d2 V) y0 W+ G# `9 k( c5 a4 `" m
// create_oper.cpp
1 o9 v8 q& o. \//
; k7 p4 v2 q `0 \6 M/ @// Description:
: K i( p, A$ j( t, x6 }// Contains Unigraphics entry points for the application.
, P+ }" q/ q0 ^9 M9 {; i7 R, v# k//
$ V' S, M4 C1 o% H8 R//////////////////////////////////////////////////////////////////////////////6 P' _9 W! t3 {: _+ A1 c: ~' K/ v
+ p: ^+ U. q7 e; V
// Include files
' [) x3 |& g1 m#include <uf.h>
| y& d9 i, o; J$ \#include <uf_exit.h>& Z' z& M5 o0 v/ B2 H' C
#include <uf_ui.h>! U5 {4 e* v$ p6 i
#include <uf_oper.h>
+ [: V( z v! w! ?7 ]#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun ): X0 x( d6 {# g# W, x/ a- o- ~
# include <strstream>/ a2 S: p2 `- t. v
# include <iostream>
9 a3 u! u4 F" z& D) R6 z using std: strstream;8 ]8 M1 \0 B, j9 N0 A4 V" w/ l7 o
using std::endl;
( P) W! v5 `7 [( y1 C using std::ends;: F2 j+ ]$ e9 ?; x" B
using std::cerr;
% k( ^' B/ Q; H G* j0 ]#else
4 |5 I/ z" |! q1 H6 i8 M# include <strstream.h>
$ b7 A. V. G4 {# include <iostream.h>, C2 f- Z9 Q. E" _! P e4 }3 w% Y
#endif+ M& J: a I6 \6 }; ^" u$ ~4 m C8 m
#include "create_oper.h"
1 x; ~. G8 K% o/ O4 L5 S) A( P5 w+ T( ~% x4 E% r
//----------------------------------------------------------------------------
5 |, e1 F" C+ R( `, c. ^// Activation Methods
0 y, f$ H% o9 Z+ R* z: m' K6 b+ ]6 m//----------------------------------------------------------------------------
" f9 ~0 @) l2 l' g* m" w. W+ B) o7 o5 _5 v
// Unigraphics Startup D) V' k1 V( P/ ~$ d4 |2 u
// This entry point activates the application at Unigraphics startup
2 r) X) s, M8 S% U$ Y& r) a8 y! H# Xextern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )# J o/ [/ x- m V
{$ @4 f9 d- R( t- r3 \6 M! b5 \
/* Initialize the API environment */
* ~/ z* e( ^ a' M$ L2 a int errorCode = UF_initialize();
) K7 ~4 H7 z$ i" S! e, Y2 |/ C9 A0 d; `3 ~7 B* s* c) o6 i
if ( 0 == errorCode )
7 x G" X0 W( z8 R8 x {
. d: f1 \4 H5 l8 s, Q0 ?( N8 z' K/ S /* TODO: Add your application code here */
6 k9 q) l: w' w$ P! O3 R$ K b0 {) d( r: n
char *type_name="mill_planar";
( i; ]! a; ?3 `/ ^$ L$ }2 y char *subtype_name="FACE_MILLING_AREA";2 }! Z( g) x2 k2 ~% R7 T. E
tag_t oper_tag;
' G9 W) v9 N: U c
* E$ ]1 M7 I% l+ a$ v: ~; h% T# ]+ R UF_OPER_create(type_name,subtype_name,&oper_tag);, ~/ v, @8 d3 L
; l' S# _+ Q0 ~: F
, c) L. [ d; w" w$ C! d% y. Y+ u, J4 W! S! M9 L( d
C) ]5 P# ?- N7 y5 D9 f. z
/* Terminate the API environment */: Y7 E. Q9 P' {0 @7 z
errorCode = UF_terminate();0 w. w! [9 K4 J
}) Q6 D) Y- M( z4 z9 u, m, B
6 d7 O2 l; \4 Z4 I7 _# C /* Print out any error messages */" `: o9 n' ^: W/ Z- U6 T
PrintErrorMessage( errorCode );" `, B; X- }$ d8 z) r! r& E6 G
}$ i: C) A) I! y; x; E' j
( I, j3 @; b" d2 a( m
//----------------------------------------------------------------------------
4 G2 Y' b' x8 ^! D/ K& ]. X1 p: l// Utilities
% R# L, L) N; M" y//----------------------------------------------------------------------------
# |. `) e; t- D/ Y+ r& q8 D( H
% a' q2 a' T0 `9 C6 S// Unload Handler8 j# G: g" H0 I) v$ G, d
// This function specifies when to unload your application from Unigraphics.
/ W6 V4 l$ H2 {% ` T' O// If your application registers a callback (from a MenuScript item or a: h" z2 l# ~$ t, x+ X4 Y/ J7 r6 G7 t
// User Defined Object for example), this function MUST return
% x, j1 r& D" ~// "UF_UNLOAD_UG_TERMINATE".
8 _' u# |& z4 t: y2 E% b0 Wextern "C" int ufusr_ask_unload( void )
6 P9 ^' v" l5 M0 R) F( C{: t* G" u3 y% V! Z& N0 |: F
return( UF_UNLOAD_UG_TERMINATE );
9 R* J' c" o+ E' D" I) b) F7 E}
8 U" Q! B; W! K5 U0 k x8 f# V# x7 i5 M+ X0 M- Y2 k
/* PrintErrorMessage+ |4 P, @$ \; m5 s. k2 _' W
**4 i' c, ?; B/ n% L
** Prints error messages to standard error and the Unigraphics status; Y- q* ?4 o' o# A
** line. */* y5 ?$ o, ?* ]
static void PrintErrorMessage( int errorCode )
! u7 a! ]# s8 I" _: D2 `{
+ ?7 E, J* }4 s/ M8 M9 f if ( 0 != errorCode )1 Q5 V+ |( N5 f$ x
{: q" ?) i4 P W9 Q9 [
/* Retrieve the associated error message */# C3 q& i' p2 k2 l
char message[133];
( v9 j! Z5 }' G% ?7 L UF_get_fail_message( errorCode, message );! e; k7 l$ A# ~/ w
9 Y$ g4 A( Y1 F b$ b
/* Print out the message */4 u9 E2 }- U" u. o" ?+ \
UF_UI_set_status( message );* h$ j, `' L! h, ]
' P0 \* V9 c4 V1 F- a // Construct a buffer to hold the text.
' I8 P% i% S. q8 e4 v& g/ E ostrstream error_message;
% }/ K" `' P( P: T: G j8 S( }* W# C9 [. i% `1 r3 {$ t( m/ h( t% `
// Initialize the buffer with the required text.
" k( o, P' Y) x* r/ T% x error_message << endl& G. E/ K. c& J+ ^2 r J2 w
<< "Error:" << endl# y% R4 ?( g- I1 f3 c3 J0 k
<< message
+ y7 e/ [' \3 S5 c% c# n << endl << endl << ends;, }: t8 H" ^$ e5 }0 D% l
0 d! e3 U! I$ r0 E8 d
// Write the message to standard error; i5 |( |8 I# x+ q
cerr << error_message.str();
3 A& H) t+ a$ p3 I* ^. E, Y8 ^ }
# W0 A6 x- i( D: O0 F} |