源玛:* v0 b7 n) _" {9 m/ q. ?$ t& F4 t6 r
; O! a4 r% d) C C3 ]) a//////////////////////////////////////////////////////////////////////////////5 @# Z' D* O1 A% I' P6 m
//
+ }8 n. v2 Y0 \, Z, Y// create_oper.cpp0 h! Y1 {9 H6 b0 c M
//0 h0 \. M7 l3 o. E/ {/ \9 h
// Description:
/ y5 l1 j! g! m// Contains Unigraphics entry points for the application.
5 U( p4 F- J; \4 u x//; b) G9 A/ d: `; @
//////////////////////////////////////////////////////////////////////////////6 }! T' S- h9 e/ S
' y, c$ r+ Y7 S# ~0 j// Include files9 j+ y" v) u- t: k: }
#include <uf.h>
* c; f( y! D) @- Y9 W; M% V0 L#include <uf_exit.h>* k) h0 \5 g! Z, O
#include <uf_ui.h>
7 f/ t* C9 M8 }- k" }#include <uf_oper.h>( R) a0 T7 d( q, J
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )8 f: y% M/ ^, B' ?0 {
# include <strstream>8 z7 {! o, [" H1 y. ~+ J
# include <iostream>
$ ~9 h7 S/ r" p# i6 h using std: strstream;
; A" G L8 B) D9 ]" q% @6 e using std::endl;
# z" j m: X7 Q4 Y% S1 U: P9 X, r7 K using std::ends;
0 R" A& b: u$ d7 s- w, } using std::cerr;
+ O- f+ p ?! w- _0 b0 M#else
2 `1 t6 v* c" j# include <strstream.h>
2 y- M/ R6 C9 B9 v# include <iostream.h>+ r6 ]8 \+ w2 P- @# O6 N
#endif
, g/ q0 Z# L! I" J#include "create_oper.h"
$ w5 F4 S) D% w0 o9 A0 Y$ c6 C" Y& |
//----------------------------------------------------------------------------
! D7 w; [; F- A) T8 U) G// Activation Methods' G, n4 p2 b" T4 K7 c6 m. @7 f
//----------------------------------------------------------------------------
3 p) w4 @( Z, |9 T5 F% g! Q/ m" q% x) q+ p2 ]
// Unigraphics Startup
! [ z" Z$ R2 H' J+ t3 }// This entry point activates the application at Unigraphics startup- b/ k w$ `) E/ R- E8 G
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
; k, Z$ I# o& |4 ?1 U{, O$ }0 [) M5 i+ l
/* Initialize the API environment */" K3 t+ D. V( k1 F
int errorCode = UF_initialize();0 m7 P) o. R- g/ b0 ~0 n
2 u4 |8 E% T! B* W7 [+ P- e
if ( 0 == errorCode )$ V% M" d4 d! P. A" @
{1 c' h# j, \( X5 J5 p- P
/* TODO: Add your application code here */% d1 L$ `1 x) R- r+ q# i
- j7 C2 h4 p7 h$ a( n& U/ U
char *type_name="mill_planar";
+ ~6 A" }# H# v8 R( ` char *subtype_name="FACE_MILLING_AREA";
# ]( T, {: R$ r tag_t oper_tag;3 x/ w# j0 a$ ]+ X' }& Q% T! N9 F0 Q
5 B, F+ ~4 l% s$ n) z UF_OPER_create(type_name,subtype_name,&oper_tag);6 G x! t" {6 m$ P
& s9 }# J* C5 z2 g! A" |4 B
7 Y c# u+ u" p3 s) c
' K* B0 q' c4 ^" u
$ a; ~0 s y% ~1 s5 p! \2 U/ z5 X0 H /* Terminate the API environment */5 _: s: t6 X. {- y/ k# ^
errorCode = UF_terminate();. ~/ l) E- i7 w. E* o$ |
}
! [4 T$ l8 Z: J& a4 `7 v( Q
/ X/ r8 h. ?" O* g: o$ k /* Print out any error messages */& {, _, \! ]3 K6 I. Y
PrintErrorMessage( errorCode );
7 B2 f# r( |( @, p6 [: j$ k}! ]! n& k( B7 t9 i5 M/ `# T
( X1 I' ]1 |9 x9 s" D- V//----------------------------------------------------------------------------
( a1 M% E* U9 [7 R" ?5 x" v- F// Utilities$ Y4 S- B/ b( N- j- {* L! m: ~
//----------------------------------------------------------------------------
5 ?' k/ y9 \- Z3 n- _# |' i" @
5 c% U* C! n+ v Z0 F1 u {// Unload Handler$ Z! n9 Z, R# H' p# `7 M
// This function specifies when to unload your application from Unigraphics.
m* d% G8 \! t3 x// If your application registers a callback (from a MenuScript item or a5 r. N7 X3 `3 m/ d! z2 F! E
// User Defined Object for example), this function MUST return
( Q7 q% p" l6 K1 c5 E) n! H// "UF_UNLOAD_UG_TERMINATE".
# x) d3 p6 U3 D9 ]1 o' Dextern "C" int ufusr_ask_unload( void )8 D; }9 |; w, L9 t2 E
{
' A5 }- P1 p$ O9 A* A/ x0 F return( UF_UNLOAD_UG_TERMINATE );, ^' u# E& {4 E
}
9 y+ @( \( f8 z7 U
5 [# ?4 ]1 [0 V6 u$ z4 P/* PrintErrorMessage! m9 V) t E" \6 y' ]; ]
**! E7 @; }9 M3 T0 a' V: s
** Prints error messages to standard error and the Unigraphics status- S. G% }5 M! T
** line. */) { G) b. j) p5 t4 r) j- {
static void PrintErrorMessage( int errorCode )
; [ H, F/ n) L C0 n* F{+ G1 V7 p. N% p7 R J$ v
if ( 0 != errorCode )7 _7 {; i5 @4 f" `) G4 \8 K5 L
{) v `* l& X/ t% v# B4 }' f: w
/* Retrieve the associated error message */ `- G+ M( A5 C% b8 c% R$ y
char message[133];- Z' e& `5 U( T/ ?: y
UF_get_fail_message( errorCode, message );5 V% q' V( a, R
# Q3 h+ M( K3 a8 } /* Print out the message */
0 \" s3 F- m; ? UF_UI_set_status( message );
/ w+ b, I, ^1 r$ @$ j; r% B2 N$ b' i3 K& v) F0 ]
// Construct a buffer to hold the text.. k6 u6 l( Y' M' |! u2 r) Y4 O* K
ostrstream error_message;
/ q- n: v X: f/ z' c, Z, i
1 F0 `$ g5 ^( y( H // Initialize the buffer with the required text.: v$ u' b( T0 X. G& w, x( {
error_message << endl
. y, O8 U1 Y. _' L0 x0 @2 ?8 T, a << "Error:" << endl: I1 F/ {# c( u1 X ], Z6 R
<< message, v. u8 j Y; I+ T9 Q6 |6 C% M
<< endl << endl << ends;3 T2 I5 \: ?5 _$ ^& \4 ?/ ^! J
% ?# N) J! h$ M) S$ I3 h) p
// Write the message to standard error' b8 g- P. c' m0 @2 a
cerr << error_message.str();9 P* \4 P. n* @# p4 I
}; b/ a# _% o8 Z/ {$ K# u
} |