购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
//create_oper创建加工操作示例代码
//定义文件
#include <uf.h>
#include <uf_exit.h>
#include <uf_ui.h>
#include <uf_oper.h>
#include <uf_cam.h>
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
# include <strstream>
using std::ostrstream;
using std::endl;
using std::ends;
#else
# include <strstream.h>
#endif
#include <iostream.h>
#include "create_oper.h"
//用户程序
void do_open_api()
{
char *type_name="balda_cu_dia6";
char *subtype_name="CEM6R0_PLANE_FACE";
char opername[133+1];
tag_t oper_tag;
tag_t group=NULL;
char *filename="d:list.txt";
int ir3=1;
//生成一个加工操作

●●●请先
登陆 或
注册 后查看●●●
uc4400(8,filename,ir3);
UF_UI_write_listing_window(filename); //设置加工参数
//UF_OPER_set_machining_data (oper_tag);
}
// UG启动
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
{
/* Initialize the API environment */
int errorCode = UF_initialize();
if ( 0 == errorCode )
{
/* TODO: Add your application code here */
do_open_api();
/* Terminate the API environment */
errorCode = UF_terminate();
}
/* Print out any error messages */
PrintErrorMessage( errorCode );
}
extern "C" int ufusr_ask_unload( void )
{
return( UF_UNLOAD_UG_TERMINATE );
}
/* PrintErrorMessage
**
** Prints error messages to standard error and the Unigraphics status
** line. */
static void PrintErrorMessage( int errorCode )
{
if ( 0 != errorCode )
{
/* Retrieve the associated error message */
char message[133];
UF_get_fail_message( errorCode, message );
/* Print out the message */
UF_UI_set_status( message );
// Construct a buffer to hold the text.
ostrstream error_message;
// Initialize the buffer with the required text.
error_message << endl
<< "Error:" << endl
<< message
<< endl << endl << ends;
// Write the message to standard error
cerr << error_message.str();
}
}
//代码结束