⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fam_test.c

📁 UG程序源代码
💻 C
字号:
/*****************************************************************************
**
**  fam_test.c
**
**  Description:
**     Contains Unigraphics entry points for the application.
**
*****************************************************************************/

/*  Include files */
#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_mb.h>
#include "fam_test.h"
#include "fam_test_dialog.h"
#include "fam_test_fun.h"

/*****************************************************************************
**  Activation Methods
*****************************************************************************/
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
{
    /* Initialize the API environment */
	static UF_MB_cb_status_t FAM_TEST_mian_menu( UF_MB_widget_t,UF_MB_data_t,UF_MB_activated_button_p_t  );
	
	static UF_MB_action_t actionTable[]=
	{
		{"STANDARD_PART_ACTION",FAM_TEST_mian_menu,NULL},
		{NULL,NULL,NULL}
	};
    int errorCode = UF_initialize();
    if ( 0 == errorCode )
    {
        /* TODO: Add your application code here */
		UF_MB_add_actions(actionTable);
        /* Terminate the API environment */
        errorCode = UF_terminate();
    }
    /* Print out any error messages */
    PrintErrorMessage( errorCode );
}
/*****************************************************************************
**  Utilities
*****************************************************************************/

/* Unload Handler
**     This function specifies when to unload your application from Unigraphics.
**     If your application registers a callback (from a MenuScript item or a
**     User Defined Object for example), this function MUST return
**     "UF_UNLOAD_UG_TERMINATE". */
extern int ufusr_ask_unload( void )
{
    return( UF_UNLOAD_IMMEDIATELY );
}

/* 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 );

        fprintf( stderr, "%s\n", message );
    }
}

static UF_MB_cb_status_t FAM_TEST_mian_menu(
	UF_MB_widget_t                  widget,
    UF_MB_data_t                    client_data,
    UF_MB_activated_button_p_t      call_button
										)
{
	FAM_TEST_data_struct    m_target_data;
	int						resp;

	UF_initialize();	
	LaunchStandardPartDialog(&resp,&m_target_data);
	if(resp!=UF_UI_OK)
		return  UF_MB_CB_CONTINUE;
	if(m_target_data.m_environment==0)//装配环境
	{
		resp=FAM_TEST_insert_in_assembly(&m_target_data);
		if(resp!=0)
		{
			uc1601("在装配环境中插入标准件失败",1);
			return   UF_MB_CB_CONTINUE;
		}
	}
	else//零件环境
	{
		resp=FAM_TEST_open_in_part(&m_target_data);
		if(resp!=0)
		{
			uc1601("在零件环境中打开标准件失败",1);
			return  UF_MB_CB_CONTINUE;
		}
	}
	return UF_MB_CB_CONTINUE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -