点击查看详细介绍

NX OPEN API 创建加工操作示例代码 create_oper

nxopen 11年前 13920 82

购买与咨询 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();
    }
}

//代码结束

1

最新回复 (82)
  • yy1986 11年前
    1

    不知道能不能看懂

  • 278976702 11年前
    2

    謝謝大大用心的整理

  • pyh2014 11年前
    3

    正有这个需要 呵呵 谢谢了

  • zcdong86 11年前
    4

    好东西,就是看不到呀,抓紧时间挣银元

  • 360204003 11年前
    5

    我很学一下UG二次开发。

  • qinchuang1 11年前
    6

    求助 :如何获取加工参数并修改

  • qinchuang1 11年前
    7

    谢谢分享,学习一下,哈哈哈哈

  • qinchuang1 11年前
    8

    希望能看懂

  • qinchuang1 11年前
    9

    谢谢分享,学习一下,哈哈哈哈

  • qinchuang1 11年前
    10

    我很学一下UG二次开发。

  • lzc123321 11年前
    11

    银元不够,看不完,555555555555

  • daianchang 11年前
    12

    谢谢分享,学习一下,哈哈哈哈

  • kevin 11年前
    13

    学习的好地方,顶起来了!

  • Hevvnet 11年前
    14

    有了这样的资料,可以省去很多麻烦

  • Murry 11年前
    15

    非常感谢楼主的分享

请登录后发表新帖