//==============================================================================
// WARNING!! This file is overwritten by the Block UI Styler while generating
// the automation code. Any modifications to this file will be lost after
// generating the code again.
//
//==============================================================================
//==============================================================================
// 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 UI 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 "HY_Edit_ToolAxis.hpp"
using namespace NXOpen;
using namespace NXOpen::BlockStyler;
//------------------------------------------------------------------------------
// Initialize static variables
//------------------------------------------------------------------------------
Session *(HY_Edit_ToolAxis::theSession) = NULL;
UI *(HY_Edit_ToolAxis::theUI) = NULL;
//------------------------------------------------------------------------------
// Constructor for NX Styler class
//------------------------------------------------------------------------------
HY_Edit_ToolAxis::HY_Edit_ToolAxis()
{
try
{
// Initialize the NX Open C++ API environment
HY_Edit_ToolAxis::theSession = NXOpen::Session::GetSession();
HY_Edit_ToolAxis::theUI = UI::GetUI();
theDlxFileName = "HY_Edit_ToolAxis.dlx";
theDialog = HY_Edit_ToolAxis::theUI->CreateDialog(theDlxFileName);
// Registration of callback functions
theDialog->AddApplyHandler(make_callback(this, &HY_Edit_ToolAxis::apply_cb));
theDialog->AddOkHandler(make_callback(this, &HY_Edit_ToolAxis::ok_cb));
theDialog->AddUpdateHandler(make_callback(this, &HY_Edit_ToolAxis::update_cb));
theDialog->AddInitializeHandler(make_callback(this, &HY_Edit_ToolAxis::initialize_cb));
theDialog->AddDialogShownHandler(make_callback(this, &HY_Edit_ToolAxis::dialogShown_cb));
}
catch(exception& ex)
{
//---- Enter your exception handling code here -----
throw;
}
}
//------------------------------------------------------------------------------
// Destructor for NX Styler class
//------------------------------------------------------------------------------
HY_Edit_ToolAxis::~HY_Edit_ToolAxis()
{
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=$UGII_ROOT_DIR\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 UI 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)
{
UF_initialize();
HY_Edit_ToolAxis *theHY_Edit_ToolAxis = NULL;
try
{
theHY_Edit_ToolAxis = new HY_Edit_ToolAxis();
// The following method shows the dialog immediately
theHY_Edit_ToolAxis->Show();
}
catch(exception& ex)
{
//---- Enter your exception handling code here -----
HY_Edit_ToolAxis::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
}
if(theHY_Edit_ToolAxis != NULL)
{
delete theHY_Edit_ToolAxis;
theHY_Edit_ToolAxis = NULL;
}
UF_terminate();
}
//------------------------------------------------------------------------------
// 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::LibraryUnloadOptionExplicitly;
return (int)Session::LibraryUnloadOptionImmediately;
//return (int)Session::LibraryUnloadOptionAtTermination;
}
//------------------------------------------------------------------------------
// 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 -----
HY_Edit_ToolAxis::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
}
}
int HY_Edit_ToolAxis::Show()
{
try
{
theDialog->Show();
}
catch(exception& ex)
{
//---- Enter your exception handling code here -----
HY_Edit_ToolAxis::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
}
return 0;
}
//------------------------------------------------------------------------------
//---------------------Block UI Styler Callback Functions--------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Callback Name: initialize_cb
//------------------------------------------------------------------------------
void HY_Edit_ToolAxis::initialize_cb()
{
try
{
label0 = dynamic_cast<NXOpen::BlockStyler::Label*>(theDialog->TopBlock()->FindBlock("label0