源玛:+ c2 N5 b* l! |/ j9 @9 N% H7 n
- x, y7 z' G$ i* [) @2 Q//////////////////////////////////////////////////////////////////////////////
1 R- r1 k: P7 Y9 |0 H- s$ L4 q//7 e( k- f# r! j1 W8 T1 a7 M
// create_oper.cpp% z" l" Z0 d W! v/ r
//
9 O' c' D2 R0 v5 u! p+ x+ b// Description:
- u0 z! L$ [) U# [; t( v// Contains Unigraphics entry points for the application.
6 Y: A- Q+ Y2 }8 x//
" P5 H% e, ]9 x! ~) N* F//////////////////////////////////////////////////////////////////////////////8 {% w7 v& r' h' O' P, {4 u
" G5 j6 V0 k5 O2 j0 C// Include files
4 o" w/ a3 l. Q1 W- C, \+ `3 a#include <uf.h>
8 b6 l6 C7 u$ d, H* @$ _, X#include <uf_exit.h>
2 d% \, L9 H; _, G: q, y& D#include <uf_ui.h>
. @: x9 S! k" {1 }# `#include <uf_oper.h>+ q9 u0 @ X- f) g9 B
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
5 }' U. P$ m4 W7 o3 e3 K2 K# include <strstream>7 _% s: }5 d5 ^, ^& \; l; M3 h" c \
# include <iostream>
. n( p+ g3 I: S; A# K using std: strstream;
. I# _0 a4 e% m- }5 L using std::endl; 6 H! L1 I8 k. S) c |
using std::ends;3 [6 m* n% E7 c
using std::cerr;( _$ x6 [' k& V$ P( s4 n
#else' Y- ]# o3 q3 M' `1 y, h/ l
# include <strstream.h>/ r" v T& e# t+ w- e" g- S
# include <iostream.h>8 h2 ^ C$ l# A9 T' h2 e
#endif
: E' R I- E2 h' b$ O8 p) v#include "create_oper.h"! D8 ~6 d9 `& ?
" p$ m a0 W7 C; b, O
//----------------------------------------------------------------------------5 z3 h. H" S& w. v3 V; q- T0 d! ^
// Activation Methods; [3 C; A( Z: E( a" c( i4 d4 i
//---------------------------------------------------------------------------- y! ^9 u$ K* D' P2 c6 d1 v* U
$ @" Y) ]9 M% G" d# m0 g$ u// Unigraphics Startup9 E2 x( [3 Q$ M4 |4 |( k0 Z1 q a% U
// This entry point activates the application at Unigraphics startup
' T! a' i' e% Z# _: a* Qextern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
1 _. a! X. T5 v# u{* W' A% V% m5 y$ H9 l. {
/* Initialize the API environment */% {4 O8 g0 f' b: O& k/ b
int errorCode = UF_initialize();
- s' y7 l- l' P. K4 m; i0 |# g( q# `( T' S2 a: I8 W
if ( 0 == errorCode ), N. t: b! x# a4 `
{8 y6 r7 m8 H$ B W! E2 ~% S* w
/* TODO: Add your application code here */. C; l6 `: R- e+ K0 ?+ K
- p$ D, F$ Y$ u' Q# H
char *type_name="mill_planar";
0 K# S/ x* I% M1 P) M& [, h char *subtype_name="FACE_MILLING_AREA";
. }, Y# S2 D! } tag_t oper_tag;5 |$ H! ?1 A t- T8 u U. r
& S% n$ P Y* f! M UF_OPER_create(type_name,subtype_name,&oper_tag);
( O: R4 c! k0 g( s4 z& u3 D5 {4 V% L W
( ]& p: P- i# l0 u. x1 t
( \( U, ?( J% N2 r! f
7 k+ h: \) q u /* Terminate the API environment */! B) p7 R8 k, R4 h9 ^+ b
errorCode = UF_terminate();7 w, s: s4 M; R5 L2 m/ D
}8 s0 z; B+ x% T% r' g
- ] s. a U: b% E' j
/* Print out any error messages */7 a" h& A' B: C- G! @9 F& |1 ~, D
PrintErrorMessage( errorCode );$ L: F+ `) T( [7 X
}. h+ ^; ]/ R) l4 t/ ]' _
* N4 S; _' \% A6 u
//----------------------------------------------------------------------------
- H* n, b: o0 T7 {" f* ^3 [# M// Utilities# l& ? b4 J: ]) O* ]4 Z$ a6 m
//----------------------------------------------------------------------------
+ F8 ^) s6 `8 @- @4 C
4 N8 x& y3 d9 ^4 E. J// Unload Handler
! W) r, T3 Y ~, R6 I* C# J1 E// This function specifies when to unload your application from Unigraphics.0 T6 A4 {& |; v$ x+ c
// If your application registers a callback (from a MenuScript item or a
. D4 S3 Q( ?, J4 S9 Y) K// User Defined Object for example), this function MUST return r+ o- c) |# y3 D; h' {3 R1 d
// "UF_UNLOAD_UG_TERMINATE".& V+ l) h! S+ w+ D
extern "C" int ufusr_ask_unload( void )! u q/ E8 g# R' g
{
2 m+ |( q. T+ d1 b9 I return( UF_UNLOAD_UG_TERMINATE );
- W5 Z, B/ I" J t+ b}
7 C% t* O( M+ N) n) @4 \) a% p5 D7 c1 s u* t; N ?
/* PrintErrorMessage
/ R% T6 k& L- H0 i**' `3 q, W; y' W
** Prints error messages to standard error and the Unigraphics status
9 z& J$ S' Q2 P7 S3 B" \** line. */) A" M& Q/ ~) I1 B# I- Y7 ^
static void PrintErrorMessage( int errorCode )
1 `& ~" W* ~! M& i* }3 G{% g) n; `; @" }
if ( 0 != errorCode )1 r0 ]& _9 c3 q8 o
{4 {* g9 r2 h- j! e! ~( B7 T8 V
/* Retrieve the associated error message */
7 R+ C8 |+ ~* Y2 [ char message[133];# B, N" ]6 N/ Q) Z$ m
UF_get_fail_message( errorCode, message );; {- ]8 D- ]; ~) k3 { |* u
6 i" L# l3 S+ c0 k /* Print out the message */
8 n& Z9 o" J# j UF_UI_set_status( message );
t( E4 Q0 R7 y, w, n c. I1 }' h
// Construct a buffer to hold the text. X5 a; K1 W% r; p# k
ostrstream error_message;& Y X) [, \+ A2 \$ [$ ?1 w# B/ s
$ c; z8 W! u- H
// Initialize the buffer with the required text.
5 d1 ~& [3 v& ?7 e error_message << endl
' K2 o& ]! z" v- t$ @ << "Error:" << endl- }9 {; m* g9 P' x
<< message% n$ N8 C! r6 K& B
<< endl << endl << ends;
3 [$ r% B$ P1 _1 ?! L F' R
+ j; o0 Y2 t' j5 ?1 B // Write the message to standard error
) Z. b! H$ q, D6 F4 J cerr << error_message.str();
+ o" Q& \; }' A }
+ c( [9 e0 m! N0 ]} |