源玛:2 \9 K4 @2 g2 o2 {
7 S4 i( F/ ^1 n
//////////////////////////////////////////////////////////////////////////////
" m' W+ A$ O. ~$ u//
2 ]6 D6 v! X: q/ Q( a// create_oper.cpp& `' z7 I6 c. `2 n2 Y" J
//
; M( y, h7 C8 g: S1 _# X// Description:
5 f5 U7 k/ \- [' Q5 l7 W" t% P// Contains Unigraphics entry points for the application.
* e7 E8 n c- A9 y% K//
+ u+ g0 C# ?& x8 E; B" H//////////////////////////////////////////////////////////////////////////////
" P# G @# A3 O
' D* M z- J- T5 x$ U) _// Include files
4 ?8 H$ K; y% s$ ~3 Y8 I( B0 Z#include <uf.h> K# ~ r+ m& [0 R; d, W' T& X' q/ U
#include <uf_exit.h>
: n# H# {( {( S, l2 [' v#include <uf_ui.h>! E1 B/ ?% B1 Z) a
#include <uf_oper.h>
6 o( {1 U- U) q! m' ~# m#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun ). D& }- ?. w- \1 @; j
# include <strstream>+ E0 G( t# }/ h% f
# include <iostream>
/ Q3 s6 a$ V" x" m& i using std: strstream;. i* \$ u f9 N) _) Y( B
using std::endl; 5 x# b* ?7 J) w+ l/ W+ e% r! P1 n
using std::ends;
! ^8 N0 K$ v0 s* C9 y using std::cerr;
3 R$ Q' g9 ?( K7 X2 j#else
7 L4 ^; d! {0 P( X! \, H" d1 W# include <strstream.h>8 S, Q& E5 C! ~. \4 S
# include <iostream.h>3 A7 E! ]1 [. }
#endif. F. Y( u; p( b* ?+ W4 B; k1 g
#include "create_oper.h"
+ R$ u& N) D9 [
! ?% \' D6 Q; G9 J8 G4 K6 _- F }0 }1 n# v//----------------------------------------------------------------------------! x2 T( |$ L: y/ C) c9 L+ g
// Activation Methods
M, S9 w8 h3 X, L/ k//----------------------------------------------------------------------------0 _5 B5 A% w+ l& [+ d' k
& _- W9 s }' d4 O// Unigraphics Startup+ K3 x9 s8 U: s- B
// This entry point activates the application at Unigraphics startup
0 g$ V8 n7 N. \5 @extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
" C/ {: N1 j2 P7 z! O9 D8 L- H{
: H' g# E+ ~. a; Z# I5 ~ /* Initialize the API environment */
/ z# M' ^9 D$ }# s int errorCode = UF_initialize();
" d/ q$ y$ T& v; w3 o2 l; @3 q2 h' d- Y8 X4 H
if ( 0 == errorCode )" \7 e: A7 T& y( L. W
{4 _' ^0 L2 @9 u! _" X
/* TODO: Add your application code here */4 x/ S! h' b3 \9 \* v$ g
. _7 M, z# Q) h {8 R char *type_name="mill_planar";
d: P5 f C! Y' z1 X char *subtype_name="FACE_MILLING_AREA";7 d: w& Z# G$ B& S' J. S% x
tag_t oper_tag;
1 [9 ~( \- |9 j H
4 U0 [- `5 n6 p+ V. V! y) n/ n UF_OPER_create(type_name,subtype_name,&oper_tag);
% Y* l A3 t y* b7 V$ A1 G
; s: K& w0 U. X4 V" b
1 l) B" ?- ]! h' J
6 Z! B7 V1 t. ^! O# o$ Y
5 ?2 [8 C/ q" v7 [7 k9 a /* Terminate the API environment */
^' V5 p$ K+ V/ ` errorCode = UF_terminate();
/ Q4 y/ x6 z9 E8 Y. T9 W# S' H1 u: E }
3 z% Q4 h9 p. w: x3 ~( H: R' e5 m( v
/* Print out any error messages */
$ z4 T6 g: w. c1 e1 _' n& t0 u+ @ PrintErrorMessage( errorCode );
f) u" c+ j1 h. D" [}
C$ {$ X7 G" g, K8 v& q( ^$ j0 v, Y" ]" n8 \1 ]6 y
//----------------------------------------------------------------------------
7 P1 x0 |' v7 j' Z( ?& k$ h// Utilities) b1 h3 [5 x, o4 s6 X6 L8 _! [% K
//----------------------------------------------------------------------------
( W9 W1 I; O& a6 Q1 [# W
. b* y( O! P: m% d) ]' o// Unload Handler
, z l) K1 x% s. s7 h+ N5 }/ V' i// This function specifies when to unload your application from Unigraphics.
7 T, ]4 p, I/ h/ c4 n2 P7 e% A// If your application registers a callback (from a MenuScript item or a
) H1 l' m" U4 x# x// User Defined Object for example), this function MUST return/ s/ s/ E' K$ a3 l6 M
// "UF_UNLOAD_UG_TERMINATE".& ~1 h4 V7 q6 t9 q6 a
extern "C" int ufusr_ask_unload( void )
2 d$ y p9 G' A4 T; p, D% S# F{# Y* c R/ y" r+ p1 N" c
return( UF_UNLOAD_UG_TERMINATE );& C1 }: e' i' `6 t$ T
}
' T5 S6 W! u2 T5 a5 E) u' x% J, K+ I
/* PrintErrorMessage
/ _. L! B$ v5 O1 }$ w0 k B+ s0 M**
# [" q7 A# {8 }4 T2 u** Prints error messages to standard error and the Unigraphics status
4 p3 \. D$ {$ h* X$ x** line. */% [, ~. c+ U% Z
static void PrintErrorMessage( int errorCode )
* K6 A7 G3 p% _{
- v" k0 i4 Q+ e D ] if ( 0 != errorCode )( U* }# K2 p* l; K
{
; l' _+ P+ z+ D /* Retrieve the associated error message */
1 {( F+ n7 G8 ?- H% M( @! z- e char message[133];1 j0 F, U0 O; t9 y: M4 _: }+ i+ @
UF_get_fail_message( errorCode, message );
4 [, f! {9 e9 ]: ~6 g5 c$ P" ?# K6 ]. Y0 w
/* Print out the message */7 b: W, F( T9 d2 M1 v5 n
UF_UI_set_status( message );1 H1 h* Q b" U, T4 s1 h
9 }0 O; y" D. w5 _2 X( F // Construct a buffer to hold the text.4 |, z8 M4 [9 P7 k/ {) u- r5 C
ostrstream error_message;: f; n' I" Y- p& _. [
( i' Y& i( G& F! R' D6 K9 u // Initialize the buffer with the required text.
/ o2 I% v6 L; ]) U error_message << endl' ]& y+ ?' u3 }! O
<< "Error:" << endl
1 ~" I2 U1 [# D" v << message7 J* m' Q3 M0 `. O) l6 X) H
<< endl << endl << ends;9 \/ z% G. |0 m& `6 c5 W/ b. }
7 z0 R; Z4 p& H/ `$ m
// Write the message to standard error" `! G" z8 o5 T3 z1 F9 \% g
cerr << error_message.str();
- }% P& c# K* p }
# Z0 V1 D0 e- |5 Q" t; ?- E/ O} |