源玛:; O0 y! D& D. F! V% E
, H( U1 ^* A/ @+ s) C
//////////////////////////////////////////////////////////////////////////////
+ z0 i" X5 f+ m q s* y0 T//( o3 C) Q0 `; g! q6 ~
// create_oper.cpp
) c4 J8 Q) p7 w+ _( I8 m2 W4 b//5 ?5 l4 E7 M% K Y: S
// Description:5 \5 O+ _; n; `) d( S
// Contains Unigraphics entry points for the application.
3 k2 T7 ^$ b; _//
* ~6 j' q; v! J6 E//////////////////////////////////////////////////////////////////////////////! N2 i4 v' @! h1 ?! X) |
1 r) V& G% m" c3 c! i6 K// Include files% O* i4 Y6 L/ l" R L; Y
#include <uf.h>
. @! _+ ^0 V8 z5 N2 d#include <uf_exit.h>
: Z+ W$ ~; x5 l! q& F3 Q#include <uf_ui.h># d4 I0 m4 B$ s& G
#include <uf_oper.h>
) t0 u& K, E; ~' A1 c#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
* k- j3 W& }; [+ p0 p# include <strstream>
8 `) M, a* @5 s E/ q# w8 l& r# include <iostream>2 [* M( L# @3 D
using std:strstream;
1 l9 q4 m9 B- B( P7 O using std::endl;
# z9 i. T) B6 `8 \4 k% ^9 J2 f using std::ends;
1 v- S/ H! q. y! n" s$ v using std::cerr;' U E u/ g, u
#else) _( J& ?1 k* ^' ?& e
# include <strstream.h>
$ _2 ?; S, q- A6 o; ^! L+ ?/ C# include <iostream.h>
- G2 O4 z+ b" P$ q! O9 n) v#endif
; Z( ^' x) x; e/ N+ ~3 t$ h+ `#include "create_oper.h"
4 G% n }0 u G% o
/ m) v* _ |" B. w& [. I( W8 o//----------------------------------------------------------------------------
! q3 ~4 e7 K3 ?+ v! P// Activation Methods
+ {; G5 D" g, _6 |//----------------------------------------------------------------------------
& ?% j/ W; f5 ~7 o1 @- u4 N/ h0 ?* A! g
// Unigraphics Startup
' n$ }2 r8 Z. g1 t5 E// This entry point activates the application at Unigraphics startup1 q5 w! a: c8 F) C
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )' m s6 l7 |( l
{
Q- H& m+ }& k2 v* }8 ?, ^5 a /* Initialize the API environment */3 G, d8 P0 r1 N8 j* Q
int errorCode = UF_initialize();
( P; j7 N$ O( B [) I0 h$ {- q) x
3 v% i5 c2 {4 z! m1 h; w5 y if ( 0 == errorCode )& [* H; ]' M6 e4 c4 f( X
{
( i, c) d) w5 u5 U& v7 V3 D /* TODO: Add your application code here */' b9 K2 V q$ R2 X
8 V' v! U* @! P" q char *type_name="mill_planar";
) q6 t. t, p, t$ x2 t7 e, h char *subtype_name="FACE_MILLING_AREA";
0 M K1 k" Q3 V! F tag_t oper_tag;" Z! C/ L7 c. C$ j6 Z( F
! V; S3 \5 c+ N1 b7 v, h' n
UF_OPER_create(type_name,subtype_name,&oper_tag);8 {8 U. v, j) W5 S6 n8 ^: L7 I
' H! `) H' J3 b) [! V! Z2 P" _9 j" c; \1 U* P# m* M7 b- o
# r! l7 L ]) K X$ T& f! x4 w( b
. `" k5 a; R. R# u, \% O I7 M /* Terminate the API environment */) T7 t6 A9 y% y8 d
errorCode = UF_terminate();
- M+ I9 v" a/ e }, Y+ C7 m2 ]) f) ?+ L% Y
8 b1 \# y; r2 N8 t7 G i/ m5 S7 N
/* Print out any error messages */
" b; y: U! T6 M! G PrintErrorMessage( errorCode );
9 P" ~' x' s7 N2 n' h}# p+ Q; \" Y: P5 N" J8 f
$ z8 ~" r1 [1 n/ Q; {6 v/ C//----------------------------------------------------------------------------) ?, Q8 c8 [$ M. ?+ Q
// Utilities0 M4 l' c' d& @% |& F8 u. A
//----------------------------------------------------------------------------+ C" c: h1 L$ K" W: }
/ ?. U" L+ v6 w% b6 X- J
// Unload Handler
K1 |* k8 e: z- u% X, X% q// This function specifies when to unload your application from Unigraphics.+ m, }6 e6 p) r7 S: \/ d
// If your application registers a callback (from a MenuScript item or a" X8 Y! p* T% P( R6 K
// User Defined Object for example), this function MUST return
7 |$ p! Z* b6 u, V: B// "UF_UNLOAD_UG_TERMINATE".
7 W* i$ _. C+ G/ G- aextern "C" int ufusr_ask_unload( void )
, s. L5 p. }0 r3 B0 f/ g& h{0 t" l) E7 j; e) D
return( UF_UNLOAD_UG_TERMINATE );: H6 R& F% D. k8 u
}* ~: G$ X% v; ^
1 {8 i5 Y$ e2 Y2 q7 L' D# l4 V' m/* PrintErrorMessage* N+ B3 V0 w* s4 b
**4 r* i6 Z3 `0 ^" J4 ~' L) Y
** Prints error messages to standard error and the Unigraphics status( b, b* ]* d" l! e% `: X
** line. */
1 o& h# b, ]% r& H7 s- N M7 e nstatic void PrintErrorMessage( int errorCode )
* n+ `, N Y! @! w{
( b6 F, o) t" R# n if ( 0 != errorCode )
, B; T5 ]7 W0 |. {2 C {
0 V! R B b7 p- G& `$ R /* Retrieve the associated error message */
6 r0 J7 D# t8 F* g! Q: c char message[133];
6 p8 T1 C9 |( I7 v& ~ UF_get_fail_message( errorCode, message );& |* L% J( r, m2 O) ~
) v$ l p) ?" `% g) l8 a9 m /* Print out the message */! E/ p- Q' S4 M( o5 p
UF_UI_set_status( message );- ^0 b6 ?% k6 I, k& G! t. A2 C
; s+ } G% o' l+ f9 d
// Construct a buffer to hold the text.
, H7 L) ~5 A+ \; D1 E* w! Z P ostrstream error_message;
6 G! Y$ V5 o7 D. R! V& I5 ~
! u: b; _( p1 y8 v8 K // Initialize the buffer with the required text.: g6 i5 E- J% ~' M: K# X
error_message << endl) k; X3 q8 t0 t3 [* p
<< "Error:" << endl- G% c e; X2 T% \) o
<< message n! a/ r A$ S$ Y- G
<< endl << endl << ends;) B: r8 o' u l) E3 n! {( {
" O4 }8 F" h/ N9 E; L& U
// Write the message to standard error
# I5 x! P) N& w) T+ }/ p cerr << error_message.str();$ T* C& M' T$ l: @7 d
}
" a# J* d: J* o( t4 q. I, m6 D} |