iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 26328|回复: 1
打印 上一主题 下一主题

NX Open 对话框编译错误

[复制链接]
跳转到指定楼层
楼主
发表于 2011-7-26 11:51:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
我使用NX7.5 Block Style创建的对话框,生成语言为C++, 可是在代码编译时在
  30      TextDlg::theUI = UI::GetUI();
  31      theDialogName = "TextDlg.dlx";
  32      theDialog = TextDlg::theUI->CreateDialog(theDialogName.c_str());
在32行出现如下错误
error C2059: syntax error : ',' c:\program files (x86)\ugs\nx 6.0\ugopen\nxopen\ui.hxx 117 1 NxOpen
Error 6 error C2059: syntax error : ',' d:\project\nxopen\nxopen\textdlg.cpp 65 1 NxOpen
其中textdlg.cpp自动生成的代码,
求救,谢谢各位大侠,小弟感激万分。
生成cpp代码如下:
//==============================================================================
//  WARNING!!  This file is overwritten by the Block Styler while generating
//  the automation code. Any modifications to this file will be lost after
//  generating the code again.
//
//       Filename:  D:\project\MFCDll\Dialog\TextDlg.cpp
//
//        This file was generated by the NX Block Styler
//        Created by: user
//              Version: NX 6
//              Date: 07-26-2011  (Format: mm-dd-yyyy)
//              Time: 10:04 (Format: hh-mm)
//
//==============================================================================
//==============================================================================
//  Purpose:  This TEMPLATE file contains C++ source to guide you in the
//  construction of your Block application dialog. The generation of your
//  dialog file (.dlx extension) is the first step towards dialog construction
//  within NX.  You must now create a NX Open application that
//  utilizes this file (.dlx).
//
//  The information in this file provides you with the following:
//
//  1.  Help on how to load and display your Block Styler dialog in NX
//      using APIs provided in NXOpen.BlockStyler namespace
//  2.  The empty callback methods (stubs) associated with your dialog items
//      have also been placed in this file. These empty methods have been
//      created simply to start you along with your coding requirements.
//      The method name, argument list and possible return values have already
//      been provided for you.
//==============================================================================
//------------------------------------------------------------------------------
//These includes are needed for the following template code
//------------------------------------------------------------------------------
#include "stdafx.h"
#include "TextDlg.hpp"
#include "string.h"
using namespace NXOpen;
using namespace NXOpen::BlockStyler;
//------------------------------------------------------------------------------
// Initialize static variables
//------------------------------------------------------------------------------
Session *(TextDlg::theSession) = NULL;
UI *(TextDlg::theUI) = NULL;
//------------------------------------------------------------------------------
// Declaration of global variables
//------------------------------------------------------------------------------
TextDlg *theTextDlg;
//------------------------------------------------------------------------------
// Constructor for NX Styler class
//------------------------------------------------------------------------------
TextDlg::TextDlg()
{
    try
    {
        // Initialize the NX Open C++ API environment
        TextDlg::theSession = NXOpen::Session::GetSession();
        TextDlg::theUI = UI::GetUI();
        theDialogName = "TextDlg.dlx";
        theDialog = TextDlg::theUI->CreateDialog(theDialogName.c_str());
        // Registration of callback functions
        theDialog->AddApplyHandler(make_callback(this, &TextDlg::apply_cb));
        theDialog->AddOkHandler(make_callback(this, &TextDlg:k_cb));
        theDialog->AddUpdateHandler(make_callback(this, &TextDlg::update_cb));
        theDialog->AddInitializeHandler(make_callback(this, &TextDlg::initialize_cb));
        theDialog->AddDialogShownHandler(make_callback(this, &TextDlg::dialogShown_cb));
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        throw ex;
    }
}
//------------------------------------------------------------------------------
// Destructor for NX Styler class
//------------------------------------------------------------------------------
TextDlg::~TextDlg()
{
    if (theDialog != NULL)
    {
        delete theDialog;
        theDialog = NULL;
    }
}
//------------------------------- DIALOG LAUNCHING ---------------------------------
//
//    Before invoking this application one needs to open any part/empty part in NX
//    because of the behavior of the blocks.
//
//    Make sure the dlx file is in one of the following locations:
//        1.) From where NX session is launched
//        2.) $UGII_USER_DIR/application
//        3.) For released applications, using UGII_CUSTOM_DIRECTORY_FILE is highly
//            recommended. This variable is set to a full directory path to a file
//            containing a list of root directories for all custom applications.
//            e.g., UGII_CUSTOM_DIRECTORY_FILE=<NX install directory>\ugii\menus\custom_dirs.dat
//
//    You can create the dialog using one of the following way:
//
//    1. USER EXIT
//
//        1) Create the Shared Library -- Refer "Block Styler programmer's guide"
//        2) Invoke the Shared Library through File->Execute->NX Open menu.
//
//------------------------------------------------------------------------------
extern "C" DllExport void  ufusr(char *param, int *retcod, int param_len)
{
    try
    {
        theTextDlg = new TextDlg();
        // The following method shows the dialog immediately
        theTextDlg->Show();
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
    delete theTextDlg;
}
//------------------------------------------------------------------------------
// This method specifies how a shared image is unloaded from memory
// within NX. This method gives you the capability to unload an
// internal NX Open application or user  exit from NX. Specify any
// one of the three constants as a return value to determine the type
// of unload to perform:
//
//
//    Immediately : unload the library as soon as the automation program has completed
//    Explicitly  : unload the library from the "Unload Shared Image" dialog
//    AtTermination : unload the library when the NX session terminates
//
//
// NOTE:  A program which associates NX Open applications with the menubar
// MUST NOT use this option since it will UNLOAD your NX Open application image
// from the menubar.
//------------------------------------------------------------------------------
extern "C" DllExport int ufusr_ask_unload()
{
    //return (int)Session:ibraryUnloadOptionExplicitly;
    return (int)Session:ibraryUnloadOptionImmediately;
    //return (int)Session:ibraryUnloadOptionAtTermination;
}
//------------------------------------------------------------------------------
// Following method cleanup any housekeeping chores that may be needed.
// This method is automatically called by NX.
//------------------------------------------------------------------------------
extern "C" DllExport void ufusr_cleanup(void)
{
    try
    {
        //---- Enter your callback code here -----
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
}
int TextDlg::Show()
{
    try
    {
        theDialog->Show();
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
    return 0;
}
//------------------------------------------------------------------------------
//---------------------Block Styler Callback Functions--------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Callback Name: initialize_cb
//------------------------------------------------------------------------------
void TextDlg::initialize_cb()
{
    try
    {
        group0 = theDialog->TopBlock()->FindBlock("group0");
        button0 = theDialog->TopBlock()->FindBlock("button0");
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
}
//------------------------------------------------------------------------------
//Callback Name: dialogShown_cb
//This callback is executed just before the dialog launch. Thus any value set
//here will take precedence and dialog will be launched showing that value.
//------------------------------------------------------------------------------
void TextDlg::dialogShown_cb()
{
    try
    {
        //---- Enter your callback code here -----
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
}
//------------------------------------------------------------------------------
//Callback Name: apply_cb
//------------------------------------------------------------------------------
int TextDlg::apply_cb()
{
    try
    {
        //---- Enter your callback code here -----
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
    return 0;
}
//------------------------------------------------------------------------------
//Callback Name: update_cb
//------------------------------------------------------------------------------
int TextDlg::update_cb(NXOpen::BlockStyler::UIBlock* block)
{
    try
    {
        if(block == button0)
        {
        //---------Enter your code here-----------
        }
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
    return 0;
}
//------------------------------------------------------------------------------
//Callback Name: ok_cb
//------------------------------------------------------------------------------
int TextDlg:k_cb()
{
    try
    {
        apply_cb();
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
    return 0;
}

小弟拜谢了。

NxOpen.rar

3.45 KB, 下载次数: 4, 下载积分: 贡献 -2

生成对话框代码

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
发表于 2013-12-5 22:46:03 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-11-23 17:27 , Processed in 0.014957 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表