源玛:( X+ k7 |* u+ X k0 f/ M5 d0 \
! Q' \/ r' Q) j$ G, h0 w' r//////////////////////////////////////////////////////////////////////////////
, H; n9 r( Q, t. }( ]' v/ p8 u6 a//
: ]$ G! s, ]" W& ?* G$ X& @: H// create_oper.cpp: K* {+ b- l4 F
//' I7 F3 r- N `. C7 |
// Description:
, |1 k$ w6 D+ w0 v+ N n7 l u; g// Contains Unigraphics entry points for the application.( {8 b. C: R9 G; Z5 ]
//' x7 J: Z2 s4 G
//////////////////////////////////////////////////////////////////////////////6 A" [0 _. l* [1 H/ K
; S2 N! D3 ?# N# I
// Include files- Q$ Y/ l7 `# g8 N* K' k$ w* V
#include <uf.h>6 D7 c/ o. J; X: b1 ?' t# L8 h
#include <uf_exit.h>
$ _! ]) E5 w5 I9 B" }) K$ R#include <uf_ui.h>! |; T! Y8 t) |9 W4 n: Q; J
#include <uf_oper.h>' K S) e- R4 o9 T, k
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )) u$ W) e" Q& v; [
# include <strstream>1 \8 D, H$ F' b q" a/ Y8 i
# include <iostream>
, r' F8 o+ ?: b4 ~5 D& c) {* o using std: strstream;* V4 |0 R& Q: p2 ]
using std::endl;
7 w' j3 l/ m+ e! v( }9 j using std::ends;
- c# @ J, Y! L& R6 x using std::cerr;
4 p7 J8 T+ Z, U0 c- k$ G#else: @3 h7 V( a! ~2 I: g( x
# include <strstream.h>! Y4 B2 z1 Z# e/ C+ M
# include <iostream.h>
* T1 }- h( I# \) P2 I#endif
: b1 o, a; E/ _; s4 Y#include "create_oper.h"
3 r& Z" F; ^ ?8 G2 ^
. w# i, g/ I/ @. p//----------------------------------------------------------------------------
5 l; n$ p- z, b& }4 V: ?// Activation Methods
# u2 C7 l1 r' d, E# M//----------------------------------------------------------------------------
% H1 P' B( h& A. {
. o c. s( L. p0 G e O// Unigraphics Startup
1 u" p4 s! Q+ O3 Q& Z8 U n: `5 `$ Q// This entry point activates the application at Unigraphics startup
9 }" u, V7 p" R6 Q- E @* Z7 W1 cextern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )1 C" B: |; O9 \$ H
{
' I* q5 D: K/ g /* Initialize the API environment *// H* {3 @. h+ F4 R
int errorCode = UF_initialize();, X% ` I E2 i# r
; l$ F1 F* u1 Z* b, f if ( 0 == errorCode )) M/ L' L- p& w$ e0 U( s
{
! R x8 X, d2 c4 j, ~7 b# Q /* TODO: Add your application code here */
, y x/ i _% u6 Z( H: m' i7 b. B# t6 I" g
char *type_name="mill_planar";
( A1 e9 P/ E) C char *subtype_name="FACE_MILLING_AREA";5 |5 c, o% {4 b( I$ ?5 }, [
tag_t oper_tag;
" ^% M4 A2 a% x) \
, w' u: Z) _% C% o: [2 p/ C# U UF_OPER_create(type_name,subtype_name,&oper_tag);
8 S" o( c( _2 W. q( s+ B3 ~: |# {
+ L9 h3 Z3 T' r; V, U1 Y8 x5 E3 r( d% _" ?/ }& t
2 `+ K/ J% x! E3 f$ q, ]% O% o1 z8 ~! H
/* Terminate the API environment */
5 w1 D. l0 q# u% p errorCode = UF_terminate();
% f" K8 I; |6 I5 z& j2 Q& R3 W }
. ^) i2 V B% e
3 u% y# p' `9 w: j% b8 W* \ /* Print out any error messages */
8 _0 d6 Y7 d9 @( n PrintErrorMessage( errorCode );
/ a; h2 M) ]4 P# r% A, |}
& ]; Y) `; }2 v! ` r
: W0 b k+ J8 P# V, m! l! c//----------------------------------------------------------------------------
" \6 n9 x. x2 A& M3 B// Utilities
% W8 g7 @ A5 O1 J; m//----------------------------------------------------------------------------! o1 U* g' k- l4 G( L
( y, u& O# B9 n8 T- C1 Z4 F// Unload Handler' P% e- ^. r2 Y, Y4 M" L
// This function specifies when to unload your application from Unigraphics.4 O8 W3 D/ R3 k# r
// If your application registers a callback (from a MenuScript item or a
: d" v% b( x4 e9 ^// User Defined Object for example), this function MUST return% h! L& D. q; y$ K
// "UF_UNLOAD_UG_TERMINATE".1 ?+ \4 D) w9 `5 P. {9 L
extern "C" int ufusr_ask_unload( void )
) h; Y4 y, P% {4 F0 [{: f. X& P) h {- N j# `( D
return( UF_UNLOAD_UG_TERMINATE );
( {5 c, ]; l) m}
4 H" L; q! e! ^; } M' o
. \ Z: Q( ]1 y/* PrintErrorMessage% R$ I* s5 b+ I, m$ k5 ~
*** `* z4 T' e) F8 e& N+ m. b
** Prints error messages to standard error and the Unigraphics status
! Q, e, M% P% a/ u; |7 M+ S** line. */' P1 }0 {. v8 M9 F9 \' R4 x
static void PrintErrorMessage( int errorCode )
. P6 m9 p1 f# l! E# Q6 s3 i{
# Z, k$ w {0 s7 p5 |3 J; } if ( 0 != errorCode )$ |( V, s8 ~( a4 K7 I2 u
{# Y) m" N0 L8 n- h" |6 p- V/ G
/* Retrieve the associated error message */) k" l. w% @+ d! T0 @
char message[133];
( V! p- T ?7 Y3 V8 P% T0 O2 t& U UF_get_fail_message( errorCode, message );( E/ u4 h( W5 d4 @9 o! s9 A# X
$ a" R, H' l# H( J+ t' x* | F# j/ N /* Print out the message *// w0 I5 O: n! m. a7 d
UF_UI_set_status( message );
2 x$ p) i0 \8 G8 R4 c: I* t* M+ H" X* s; J1 |
// Construct a buffer to hold the text.2 a4 ?9 y: S m3 L
ostrstream error_message;
& b" j3 e) L" } X" S' v/ X& d
! W8 Q; t5 Q. Q3 h& M // Initialize the buffer with the required text.9 J# B; q$ v$ Y' Z! h: Q( g
error_message << endl* Y( C& O6 ~9 W
<< "Error:" << endl
( t7 k* }, N' y% @ << message4 |% G* c+ F2 W7 V
<< endl << endl << ends;- h# l9 ?- A- q0 g7 K' \5 _4 {; v# q
2 `' {: q5 N6 `+ }) r
// Write the message to standard error+ w4 b( [7 w% z4 m4 S( b" k: T* N
cerr << error_message.str();
* o" B% Q6 h- Z+ T }
8 T$ O4 i0 k6 Y2 G. }6 |+ Y/ h} |