源玛:$ ]! o( C' H- h; |- S' x; E- v
' j. w0 L" L! ^& h* U
//////////////////////////////////////////////////////////////////////////////
& J4 G% @8 x6 T$ ]- w//+ \ B! l- s/ ~4 ]! w
// create_oper.cpp# ?. U0 b+ L8 T/ g4 ]
//" ~" G/ Q8 u" }/ J; @+ ?+ E
// Description:% N5 q1 G S$ `
// Contains Unigraphics entry points for the application.: t4 E: A7 O) K' d H. |
//, V3 Z' n8 M5 r" U
//////////////////////////////////////////////////////////////////////////////4 B! B, v3 F5 o
$ ]& H- g/ Y7 @: p+ M0 M% e// Include files' l5 U3 Q" \6 g7 Y
#include <uf.h>* b0 Z$ f! A9 t# Q( c
#include <uf_exit.h>" v. C3 s( Q$ a
#include <uf_ui.h>
/ `" e" J5 b R# u9 k#include <uf_oper.h>
- V% Y$ a' s1 M#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )& b6 u, c+ r6 g" v& H" S
# include <strstream>$ w4 N2 @" F$ T1 ~$ i
# include <iostream>/ W, k! k; L: ~4 w! M3 [" K) p
using std: strstream;
$ U5 M/ K8 X2 c( i q- t+ E using std::endl;
) o1 K3 M8 ^) |- Q( R4 W, e { _0 ] using std::ends;: O! q6 U% u+ `0 }6 g5 W: K
using std::cerr;
* I' y( B& |& L8 w: s2 i" q! P# ?#else
+ E$ q0 P7 n0 `/ } x# include <strstream.h>3 V4 }( B. @+ F" d
# include <iostream.h>. l1 K9 }" `, b! F5 s
#endif
$ Y9 `# R* B8 k#include "create_oper.h"
' Z; x+ s0 U6 F) q/ r8 T0 ?
8 K3 n9 O9 C3 U6 J1 r//----------------------------------------------------------------------------
$ ^3 B" i0 W9 z// Activation Methods: @$ n& c3 o0 w$ Q$ H8 ^
//----------------------------------------------------------------------------
7 t, O, `. l$ R, P# D5 e
4 s6 I1 ]# B. {// Unigraphics Startup6 E: T' }, s* i, A; |
// This entry point activates the application at Unigraphics startup
( w0 L, i) c5 I& j% S0 Y! {) yextern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
; {4 I% a( V0 d/ \2 Z0 c{
) q9 n$ B; N2 k/ Q& Q& j /* Initialize the API environment */8 Y" A! v! }$ L1 b
int errorCode = UF_initialize();: r" c, p& j, B+ `( n5 h, P( B
& Q4 _/ P, S6 p if ( 0 == errorCode ). s6 P8 E! M' W
{
@( N% `7 z: n) r5 }) F" A$ H3 \ /* TODO: Add your application code here */+ R8 k+ T, E# E. B8 ^4 M0 n( q9 t
& f: w/ {: y# e; x7 b, O char *type_name="mill_planar";
/ }3 ~% t% _3 M1 G4 H6 J char *subtype_name="FACE_MILLING_AREA";
# ]' ~! Z* c' F9 l tag_t oper_tag;: Y' E" Q( }. c
- U) _" w j* V: N5 X7 G7 j0 h UF_OPER_create(type_name,subtype_name,&oper_tag);
- m! i( R( n% B8 r6 q7 {/ O* t0 s8 P8 O/ H8 w+ j
0 A1 O$ l! Y: j" T3 A
6 E" N' z- |$ n0 {$ K9 G
0 l' x9 M4 U) \8 x @) l /* Terminate the API environment */0 c) J, c; P. s0 \/ q
errorCode = UF_terminate();
" `8 Z3 h' Y* S7 y }# R7 ~" f, ^: M# X1 D
5 Z- ~9 E. D6 y+ t4 L% L% @
/* Print out any error messages */
9 S' |2 n5 j' j, s PrintErrorMessage( errorCode );
( z# @- @: h$ H B( j# _8 [}
J$ Z2 ~3 ~3 U$ n: `- \ J
% D& @- Z. C4 B% W- ]//---------------------------------------------------------------------------- i" h0 y0 p$ u' g9 }, r+ ]9 `; \
// Utilities' C w% p* U, V/ w" }. j7 i
//----------------------------------------------------------------------------
! I8 ]7 r9 b. m/ D( }+ ]6 r( k1 N9 @) q7 t( O* c
// Unload Handler
1 Y- T0 q4 t# |. I9 {+ J// This function specifies when to unload your application from Unigraphics.6 I3 a! F6 e6 V" j+ f
// If your application registers a callback (from a MenuScript item or a
' ]3 c; W9 e) x( H// User Defined Object for example), this function MUST return* @- r" C. V5 J' x, D; \- S1 g
// "UF_UNLOAD_UG_TERMINATE".. ?% }4 ~. h& p" R
extern "C" int ufusr_ask_unload( void ) c$ I# d9 ?- L' Z9 q7 J
{; V/ ]3 \; ^) `1 j, ^3 O c
return( UF_UNLOAD_UG_TERMINATE );7 g& |9 W" `3 S1 f! c% d
}: b$ J n/ Q2 B0 Z% o
* X5 Q# ^' z9 A9 o7 q+ S* Y3 k: e/* PrintErrorMessage
" |( O5 ^5 `% Y* A; M+ ?+ D2 C/ R**
' p. M* S$ V+ c** Prints error messages to standard error and the Unigraphics status) V, g! }8 D) _* O: [
** line. */. X" c2 Q7 k- i' ~2 F" l+ G' V: o1 i* D
static void PrintErrorMessage( int errorCode )# N2 n! A4 U% Y
{4 p% v& k! z [& T1 B a3 E& n9 V
if ( 0 != errorCode )5 k4 }4 z; }+ T
{
; a5 P1 `" |! N0 F /* Retrieve the associated error message */
+ A1 Q' D0 b5 s" {2 m char message[133];
- N2 o" Q2 k3 N1 w3 Y0 e) T( { UF_get_fail_message( errorCode, message ); w2 _7 W0 n2 {: }
: ?& E# W: b8 w$ Y9 D: O
/* Print out the message */6 [2 D' i1 z: z4 d% c6 n; T( R7 \
UF_UI_set_status( message );' K/ Y% H% i' J# z5 w7 k
0 u/ v' [8 o; M, Q5 c# x // Construct a buffer to hold the text.
/ g% R) T) Z3 f z! q$ D5 x. Z ostrstream error_message;
8 r) q v; K/ o; W$ o9 x9 ?
, d4 b1 U- ?1 o // Initialize the buffer with the required text.; ]" V5 C: r1 q) e
error_message << endl
$ \5 y; y @% Z/ |/ j. n: y << "Error:" << endl
- s0 z- I& ~. }) O+ [+ ^+ {8 J << message
& ^+ Z0 S7 {/ ? << endl << endl << ends;( w( q5 M4 q2 u
' z$ _5 v# y3 ]" i4 X8 @6 i: O" t // Write the message to standard error
4 D3 F$ Q9 d% p' r2 ?3 I- G2 ~' r/ n cerr << error_message.str();
3 i, ~: P& \9 a/ U8 j) X- n8 W" X }
0 D9 X5 Z! Q% {5 B6 b} |