源玛:* R! r9 S% Z* Z+ o+ B: b
4 \2 H' y% ], Z% `) P//////////////////////////////////////////////////////////////////////////////) A! E" |$ d' y: B* ^2 ^ v# p
//4 E, [7 J# M, w$ S( U
// create_oper.cpp6 j7 v/ @& I+ _6 L5 I; J; E
//
+ c: J/ ~, X1 z9 t0 d9 r// Description:% o! r' L; B1 g7 L8 d
// Contains Unigraphics entry points for the application.$ k8 Y; d' j, Q) e
//
1 Z9 K0 F- D9 i% a! d//////////////////////////////////////////////////////////////////////////////
+ ]4 Z& S) U ?) v
, d2 N* R0 B+ R& q, f8 w// Include files
; T+ N) i1 t) L- @#include <uf.h>& H2 N7 Y, ?4 p& F
#include <uf_exit.h>
. q9 ]7 U8 W: W: V; O; O4 p+ a#include <uf_ui.h>
- `+ z( n w+ ]$ G#include <uf_oper.h>' o3 p5 n9 c, P- @" A0 O
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
' D5 Q& z. G2 M. \$ J4 z# include <strstream>2 Y# r9 {: C1 ^: Y
# include <iostream>
' t- D* o/ h5 d& R- R using std: strstream;1 |7 \& b) _ N5 C; N4 J
using std::endl; k8 t/ E! Z+ }# a3 R$ i. ?. K$ W
using std::ends;
* M: {6 j3 Y7 ?: s% w& C4 f using std::cerr;/ `( ^! R2 b3 {8 M/ q
#else- Z* X: f( b! Y6 N3 [! S
# include <strstream.h>
9 a9 E1 Y J3 g9 C6 D/ c% ]# include <iostream.h>6 G( @3 B3 {% o, ^; G- h3 O
#endif' I n9 \' E0 E2 I
#include "create_oper.h"
& K' J. p; Z! w6 o
1 S; C2 p h3 R+ l s//---------------------------------------------------------------------------- c0 K3 e$ p& g- b: Y( {
// Activation Methods+ I* ]+ s; K+ Y7 Q
//----------------------------------------------------------------------------. F" u4 i" ^# S
9 R% ^2 j/ e }; D$ T9 U// Unigraphics Startup1 g7 q. k1 N, F! ~ t
// This entry point activates the application at Unigraphics startup
# M' t: J- ~) Z6 r1 q" c- K! y b3 uextern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
; N. ~" ]5 @7 d9 B! }5 l{
7 C3 y! s5 |1 w: c /* Initialize the API environment */
" L$ d. U$ h$ d% {+ `, d" G int errorCode = UF_initialize();
) A0 k- n/ [4 m/ l; T/ o& F0 V1 }$ Q7 n; v
if ( 0 == errorCode ) E7 J( l! w9 c
{
5 j0 Z1 A8 t1 g& B4 o/ A4 |8 r* J' X /* TODO: Add your application code here */! Q! j7 p4 l, f- E. k
' V: v6 l" ?, V' T char *type_name="mill_planar";6 G9 q1 Z) \: X* w& ^
char *subtype_name="FACE_MILLING_AREA";
! z& q2 \2 K$ r% `9 F( b8 m8 ? tag_t oper_tag;1 I* I9 o) Y4 j: D$ G
2 _1 A* a) i! i0 j+ } UF_OPER_create(type_name,subtype_name,&oper_tag);& I5 ~ C4 i7 r! b: S) o8 v1 O; D
$ B1 ~/ D o4 u5 e8 V
% ?* t5 D! w6 L: R" h& m7 w, {! L/ A( r& I0 K
9 Q8 p+ _# {5 s% \" i" N
/* Terminate the API environment */
% U# ^" f8 t) V errorCode = UF_terminate();3 e& ]( k, [4 A n d& K5 q7 f
}- C: ]+ m. k& e$ x; E
- z. p1 | @* h9 R% u/ Q
/* Print out any error messages */
1 P9 S' F+ }+ P" I3 _. ` PrintErrorMessage( errorCode );
. E& j$ A+ N! @5 p% F}$ d. V% d4 A( w I( H: S% U3 X0 O
4 o' D. G, S( K% k//----------------------------------------------------------------------------4 h Y2 w/ p8 {" _# u z$ T8 }2 S$ G
// Utilities8 P" n. w4 C. V# e" b% ?
//----------------------------------------------------------------------------' @6 \/ f: y! F2 u6 p
Q3 T7 X* S5 o! S6 H
// Unload Handler
( c8 ~7 k2 o6 @0 s; _; F$ f// This function specifies when to unload your application from Unigraphics.! p# \6 _' J+ m0 [% {! u
// If your application registers a callback (from a MenuScript item or a, ~/ n* j4 }- R1 [7 G: K
// User Defined Object for example), this function MUST return
9 @: k8 ^6 n5 d. D( h! ?8 l* i% R// "UF_UNLOAD_UG_TERMINATE".
* H5 X! w$ h J( ]) Aextern "C" int ufusr_ask_unload( void )
: d5 a' P" z1 P5 S* ~2 `{
- \* Y" i- a5 E4 j return( UF_UNLOAD_UG_TERMINATE );
! ^1 U6 A* C( W}& @+ ^9 w$ l' u U j' V5 }) W
( i2 j4 N/ q5 A1 L
/* PrintErrorMessage
6 u' B5 x5 a+ @- n3 D**
X0 c+ r( z! Z$ N1 Q* v; i# y** Prints error messages to standard error and the Unigraphics status
; ^% O/ A# ]3 |* L; B( {$ E" m4 J# ]** line. */! _/ o b3 C/ s- n
static void PrintErrorMessage( int errorCode )) u6 q7 K7 K" `& A1 G2 i
{+ V k: }' e( N% m
if ( 0 != errorCode )- \5 |% C8 u8 S6 m
{
' W# i) l. l6 o( {! \ /* Retrieve the associated error message */
1 m4 r, h8 |' n char message[133];
, \) l) s. U. n; h) a, ] UF_get_fail_message( errorCode, message );) ]4 ^) V" A9 [
' |' u* l- x8 j [ /* Print out the message */) ^, V& u* W: [, Q
UF_UI_set_status( message );
0 H3 ?. |8 R* L2 E( e
% C# y9 h( m# v" q // Construct a buffer to hold the text.! `2 Q: y) e5 p' u4 u
ostrstream error_message;
( Z2 v* }' c! ]9 U" |! D* a' B' C U @) @- r% L
// Initialize the buffer with the required text.
) G' ]9 F) C5 `! E" T, [2 ] error_message << endl
* Z+ V+ I" q$ Q9 d << "Error:" << endl5 H" p8 G, d8 ?, q: Y% F) x
<< message
6 y8 C Q- }+ `4 i8 p* V4 g << endl << endl << ends;& B8 V" ~, I _
; [* |! Z/ h- i: w2 i$ D // Write the message to standard error
+ m" @1 u6 t6 `- O4 y! Z5 C$ L' C cerr << error_message.str();5 v! Z2 G* C" Y% \, a
}
; }/ y% e+ n; ~9 a- u; r6 C& ^( o} |