马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我写了一个创建长方体的函数,但是在ug里面调用的时候没有出现长方体
怎么回事啊?能够编译通过
函数如下:
#include <uf.h>
#include <uf_exit.h>
#include <uf_ui.h>
#include <uf_modl_error.h>
#include <uf_modl_types.h>
#include <uf_modl.h>
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
# include <strstream>
# include <iostream>
using std:strstream;
using std::endl;
using std::ends;
using std::cerr;
#else
# include <strstream.h>
# include <iostream.h>
#endif
#include "creatPart.h"
//----------------------------------------------------------------------------
// Activation Methods
//----------------------------------------------------------------------------
// Unigraphics Startup
// This entry point activates the application at Unigraphics startup
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
{
/* Initialize the API environment */
int errorCode = UF_initialize();
if ( 0 == errorCode )
{
/* TODO: Add your application code here */
/* 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 "C" int ufusr_ask_unload( void )
{
return( UF_UNLOAD_UG_TERMINATE );
}
/* 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 );
// Construct a buffer to hold the text.
ostrstream error_message;
// Initialize the buffer with the required text.
error_message << endl
<< "Error:" << endl
<< message
<< endl << endl << ends;
// Write the message to standard error
cerr << error_message.str();
}
}
static void do_ugOPen_api(void)
{
UF_FEATURE_SIGN sign = UF_NULLSIGN;
UF_FEATURE_SIGN sign1=UF_POSITIVE;
double block_orig[3]={0.0,0.0,0.0};
double block_orig1[3]={0.0,0.0,2.5};
char *block_len[3]={"1","2","3"};
char *block_len1[3]={"1","1","1"};
tag_t blk_obj;
tag_t blk1_obj;
int i_ret;
//新建长方体
i_ret=UF_MODL_create_block(sign,NULL,block_orig,block_len,&blk_obj);
i_ret=UF_UI_open_listing_window( );
if(i_ret==0)
UF_UI_write_listing_window("成功创建block\n");
else
{
UF_UI_write_listing_window("创建block失败\n");
return;
}
//创建长方体,并与blk_obj长方体进行并操作
i_ret=UF_MODL_create_block1(sign1,block_orig1,block_len1,&blk1_obj);
if(i_ret==0)
UF_UI_write_listing_window("成功创建block\n");
else
{
UF_UI_write_listing_window("创建block失败\n");
return;
}
} |