源玛: Y$ W6 D! z2 x) |/ y! N* d( Q
6 L: Z# d$ l% |0 ]- t//////////////////////////////////////////////////////////////////////////////
; {( K w+ K9 o8 I! V. j//$ n5 b' i. Z u4 `" W5 t
// create_oper.cpp
B$ V0 E7 B. Q; G; q0 e7 |//
0 y- g, u* }! i+ f/ B// Description:. _/ p2 E) G% l" U1 I
// Contains Unigraphics entry points for the application.
1 j5 n6 x- k; N$ N0 K" R//1 G/ ]7 r7 b ]$ N; ]
//////////////////////////////////////////////////////////////////////////////* a$ {7 U% N& }
' T8 |8 l( j' k5 D1 Z
// Include files
* X0 E: k) @0 I x#include <uf.h>/ ~( D& D% M+ e0 \5 U+ m( t: p
#include <uf_exit.h>
6 k5 [3 M+ ]( R8 D#include <uf_ui.h>
. a) m3 U7 F% T I* o#include <uf_oper.h>
4 {, N8 T j% L0 w, `#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
/ }8 u1 w- m$ p5 p. A# U1 o" c& W9 g# include <strstream>
( D$ ?* @; ^: b- c# include <iostream>4 ? |" ~( l; s9 `1 ?% y- @, a, R
using std:strstream;% w1 D8 f) u" i
using std::endl; # B$ L4 b; a, l: N0 x! @
using std::ends;
6 O" P% T' E5 e) E5 U9 C) k using std::cerr;
r% J0 ?+ ]" x3 s#else
# U! a" X2 F/ J/ @8 I: J) a1 ?# include <strstream.h>' u8 c9 [4 I+ D( y1 l
# include <iostream.h> v) _/ C7 w( d# N+ i5 S
#endif) ~2 E/ f: O/ k4 i
#include "create_oper.h"
9 r( v0 {8 o+ M' ?( e. r7 j+ W# }0 }) d: C' o. [
//----------------------------------------------------------------------------# |( f$ G: x( j* C7 \7 o
// Activation Methods
- @( V& m4 L$ D# `# e2 ], |//----------------------------------------------------------------------------. m5 D$ ~: F) |5 U) j# h
0 `5 t( P) e2 L* c
// Unigraphics Startup
& v9 l6 x/ V' y `// This entry point activates the application at Unigraphics startup! I) x! Y2 @# b& U' N! Y( U
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )5 m9 j7 r8 M% E; ~! \0 t- E' X. D
{
" r1 n) F( F6 X2 R /* Initialize the API environment */3 A% {* F! Y6 Q m* Q& C
int errorCode = UF_initialize();- q& A9 @! J |
6 U/ ^6 x* N; m2 x1 y) W( ~" q if ( 0 == errorCode ), N3 z. U. y$ Z* W
{
8 `+ C" R6 s1 b7 W: k, p( o( L: ^+ z /* TODO: Add your application code here */. R7 C$ C8 u% L* p2 @, q; W
& T0 Q* Z# Y U4 T' e char *type_name="mill_planar";9 {# X" ^, k5 {1 q, z8 T
char *subtype_name="FACE_MILLING_AREA";
( F, E4 b, y% ^! t% C tag_t oper_tag;
( g$ w+ S$ o' L
3 B, D4 r5 ]4 M2 W UF_OPER_create(type_name,subtype_name,&oper_tag);
/ t% ^( R, s5 t2 o5 P
7 T, \6 T- v" v5 m; b. `" q. t( S
% G( ^( {/ D1 Y) W% }" ^8 Q
3 K7 q4 W# K, E' t( e# Z2 c
/* Terminate the API environment */
) k) l, K. ~5 o6 n$ B. M/ u errorCode = UF_terminate();5 U9 }- I+ i& U; B
}
6 D: {* F1 S$ h$ v. ?# U1 }. e9 Y/ M, Y; ~- U
/* Print out any error messages */
9 T$ Z2 _2 W, I0 {3 u PrintErrorMessage( errorCode );" g, u" {" y1 x# _ d q
}
- ?) v6 F. H0 u6 B( p, L
; R- z$ }8 h( a5 }$ k2 t//----------------------------------------------------------------------------
4 v- j+ G4 t0 s) @1 q5 G# Z8 r// Utilities! G$ y% n" x9 }& T. Q, w- @3 p
//----------------------------------------------------------------------------' F: c& h) h n# A5 N7 h* x- B* E$ u8 M
, n! |; U+ U2 Z. W; k// Unload Handler+ t; g) \/ _* z( b) @9 n4 c+ M
// This function specifies when to unload your application from Unigraphics.
" t0 w2 O! f6 b9 k( s5 F& k// If your application registers a callback (from a MenuScript item or a
1 Y# H6 M/ F9 G! A% ]9 i2 P// User Defined Object for example), this function MUST return
! I* P% i d* g& L// "UF_UNLOAD_UG_TERMINATE".
1 d% } P* ^8 N" T" L& lextern "C" int ufusr_ask_unload( void )
7 W( J3 x" j! `. R5 ~2 A{9 G( o/ K* |- G) k/ V% I
return( UF_UNLOAD_UG_TERMINATE );
1 r/ ^; C8 f8 @2 \3 ]* ^}* n6 J2 S! Q. _, H/ E1 K% Y! V! ]* |: R
4 q a# l& p* N) [1 S4 r# u6 u
/* PrintErrorMessage: m2 B; B9 }* A9 A. u6 u
**! Y) G- R: i3 H! k R1 R$ `
** Prints error messages to standard error and the Unigraphics status" G% z( c5 u4 @2 G o
** line. */
- K$ U! N- P. ~, K5 {$ _" Istatic void PrintErrorMessage( int errorCode )
0 v: a: J& @& J1 g, E) e{; n( F9 ]( {3 [4 S. U
if ( 0 != errorCode )
9 N6 g: H: y$ E8 C; C& @& S0 c {
" ~' E7 }# ]3 z/ l( @ /* Retrieve the associated error message */2 P( L2 G* U* K. _7 B$ Z$ K1 K; d
char message[133];+ m2 l: s7 T3 m: a3 Q" h
UF_get_fail_message( errorCode, message );
, _8 R/ {& E v9 _1 n" ^8 l$ r& f* u4 t+ ]9 D$ S4 P
/* Print out the message */& U+ G: v. d9 U1 u; I! L8 o
UF_UI_set_status( message );
- X0 f' Z0 |- O5 ]( `# T& o* h! x5 X/ f& ?: g
// Construct a buffer to hold the text.
) t' w. n1 J4 a! E ostrstream error_message;' H) j% O3 l* I
: k0 Z/ ~1 H# O" K. M1 z
// Initialize the buffer with the required text.
: D' y- V3 A& H) w0 J2 S& p% L3 |) k error_message << endl
4 ~. ]/ l* A% v% G: b << "Error:" << endl
. p! T9 m+ `3 K) Z) k << message
: h# G: A. b! \" k* `! c) J$ Z3 H8 M << endl << endl << ends;" M: ]6 o8 m$ p. y
' B, Z5 f6 o- J3 {7 m" ]( R
// Write the message to standard error1 l* V2 y6 B2 L4 U) \$ B. u$ k* U
cerr << error_message.str();! J/ L: W7 _* H* b6 k3 D, R
}+ Y. c/ E4 n3 N+ m$ L/ V* ]
} |