点击查看详细介绍

UF_ROUTE_exit_custom_app() 函数的参数解释说明、函数详细用法,以及实例代码演示

misnn 6年前 898 0

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


函数结构:
UF_ROUTE_exit_custom_app
函数说明:
退出自定义路由的应用程序。

UF_ROUTE_exit_custom_app函数实例代码演示:
下图是一个示例程序,可在UG /打开样品目录,其中演示了如何使用UF_ROUTE函数来创建一个UG /路由定制应用。示例文件被命名为ufd_route_cu??stom.c。这是添加自定义UG /路由应用的一个例子Unigraphics的。除了此源文件中,两个菜单文件:add_custom_route.men,需要和custom_route.men。请参阅UG /打开程序员指南的MenuScript章对于本实施例的详细说明,所需MenuScript环境变量和目录的正确位置共享库和菜单文件。这些文件的目的是提供一种可改性的模板通过重命名文件和重命名变量和例程包含在这个C文件,允许你创建自己的应用程序。在MenuScript更多信息可以发现:在UG /打开MenuScript用户指南在UG / Open API的参考手册在UG / Open API的程序员手册在UG /打开MenuScript快速参考卡在UG /打开MenuScript菜单文件参考卡
[quote]
#include <stdio.h>
#include <uf_defs.h>
#include <uf.h>
#include <uf_exit.h>
#include <uf_mb.h>
#include <uf_route.h>
#include <uf_ui.h>
#include <uf_ui_xt.h>
static void RTCUST_APP__enter( void );
static void RTCUST_APP__init( void );
static void RTCUST_APP__exit( void );
static void print_error( char *fun, int status );
static UF_MB_cb_status_t RTCUST_APP__action1(
UF_MB_widget_t widget,
UF_MB_data_t client_data,
UF_MB_activated_button_p_t call_button );
static int app_id = 0;
static UF_MB_action_t actionTable[] =
{
{ "RTCUST_APP__action1", RTCUST_APP__action1, NULL },
{ NULL, NULL, NULL }
};
extern void ufsta( char *param, int *retcod, int param_len )
{
UF_MB_application_t appData;
char name[] = "ROUTE_CUSTOM_APP_1";
int status;
UF_initialize(); /* Initialize User
Function */
status = UF_MB_add_actions( actionTable );
print_error( "UF_MB_add_actions", status );
/* Initialize application data */
appData.name = name;
appData.id = 0;
appData.init_proc = RTCUST_APP__init;
appData.exit_proc = RTCUST_APP__exit;
appData.enter_proc = RTCUST_APP__enter;
/* Initialize application support flags */
appData.drawings_supported = FALSE;
appData.design_in_context_supported = TRUE;
/* Register the application with UG */
status = UF_MB_register_application( &appData );
print_error( "UF_MB_register_application", status );
/* Register the application as a UG/Routing custom app
*/
status = UF_ROUTE_register_custom_app( appData.id );
print_error( "UF_ROUTE_register_application", status );
app_id = appData.id;
}
/*-----------------------------------------------------------------
-----------*
* print_error
*
* Print the error message corresponding to the status code
specified if
* the status is non-zero.

*------------------------------------------------------------------
----------*/
static void print_error( char *fun, int status )
{
if ( status != 0 )
{
char msg[133];
UF_get_fail_message( status, msg );
printf( "%s failed with error = %d\n %s\n", fun, status,
msg );
}
}
static UF_MB_cb_status_t RTCUST_APP__action1(
UF_MB_widget_t widget,
UF_MB_data_t client_data,
UF_MB_activated_button_p_t call_button )
{
int curr_app_id = *((int *) client_data);
printf( "Application ID = %d\n", curr_app_id );
return( UF_MB_CB_CONTINUE );
}
UF_ROUTE_application_view_p_t RTCUST_APP__app_view;
/*-----------------------------------------------------------------
-----------*
* RTCUST_APP__enter
*
* Enter the application

*------------------------------------------------------------------
----------*/
static void RTCUST_APP__enter( void)
{
static loaded = FALSE;
int error;
printf( "Entering application\n" );
/* Place code to enter application here */
if ( ! loaded )
{
error = UF_ROUTE_load_app_view( "piping.apv",
&RTCUST_APP__app_view );
if ( error == 0 )
{
UF_ROUTE_set_current_app_view( RTCUST_APP__app_view );
loaded = TRUE;
}
}
UF_ROUTE_enter_custom_app( );
}
/*-----------------------------------------------------------------
-----------*
* RTCUST_APP__init
*
* Initialize the application

*------------------------------------------------------------------
----------*/
static void RTCUST_APP__init( void )
{
printf( "Initializing application\n" );
UF_ROUTE_init_custom_app( );
/* Place code to initialize application here */
}
/*-----------------------------------------------------------------
-----------*
* RTCUST_APP__exit
*
* Exit the application

*------------------------------------------------------------------
----------*/
static void RTCUST_APP__exit( void )
{
printf( "Exiting application\n" );
UF_ROUTE_exit_custom_app( );
/* Place code to cleanup for application and exit here */
}

/*
Sample menu file - custom_route.men
Shown below is a sample UG/Menuscript file used by the UG/Routing custom application sample
program, ufd_route_custom.c.
VERSION 120
EDIT UG_GATEWAY_MAIN_MENUBAR
AFTER UG_APP_ROUTE
SEPARATOR
APPLICATION_BUTTON ROUTE_CUSTOM_APP_1
LABEL Custom...
LIBRARIES libcustom
MENU_FILES add_route_custom.men
END_OF_AFTER
*/


[/quote]

0

最新回复 (0)
请登录后发表新帖