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

📄 pro_design.c

📁 基于UG的压块参数化设计
💻 C
字号:
/*****************************************************************************
**
**  pro_design.c
**
**  Description:
**     Contains Unigraphics entry points for the application.
**
*****************************************************************************/

/*  Include files */
#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_part.h>
#include <uf_mb.h>
#include <stdio.h>
#include "pro_design.h"
#include "pro_design_dialog.h"

int PRO_DESIGN_check_part()
{
	tag_t   part_tag;
	char    part_fspec[256],*pdest;
	char    temp_name[50],part_name[50];
	char    ch='\\';
	int     i,len;

	part_tag=UF_PART_ask_display_part();
	if(part_tag==NULL_TAG)
		return 1;
	UF_PART_ask_part_name(part_tag,part_fspec);
	for(i=0;i<50;i++)
	{	
		part_name[i]='\0';
		temp_name[i]='\0';
	}
	pdest=strrchr(part_fspec,ch);
	len=strlen(pdest);
    strncpy(temp_name,pdest+1,len-1);   
    len=strlen(temp_name);
    strncpy(part_name,temp_name,len-4);
	strupr(part_name);
	if(strcmp(part_name,"YAKUAI")==0)
		return 0;
	else 
		return 1;


}

/*****************************************************************************
**  Activation Methods
*****************************************************************************/
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
{
    /* Initialize the API environment */
	static UF_MB_cb_status_t pro_design_yakuai( UF_MB_widget_t,UF_MB_data_t,UF_MB_activated_button_p_t  );
	
	static UF_MB_action_t actionTable[]=
	{
		{"PARAMETER_DESIGN_YAKUAI",pro_design_yakuai,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 );
}

static UF_MB_cb_status_t pro_design_yakuai(
	UF_MB_widget_t                  widget,
    UF_MB_data_t                    client_data,
    UF_MB_activated_button_p_t      call_button)
										
{
	int resp;
    int errorCode = UF_initialize();
	if ( 0 == errorCode )
    {
		if(PRO_DESIGN_check_part())
		{
			uc1601("当前显示模型不是压块部件,不能进行参数化设计",1);
			return UF_MB_CB_CONTINUE;
		}
        LaunchProDesignDialog( &resp);
        errorCode = UF_terminate();
    }
	return UF_MB_CB_CONTINUE;

}

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

⌨️ 快捷键说明

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