马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
将一个part文件添加到装配体中,下面是我的代码:
#include "uf_modl.h"
#include "uf_assem.h"
#include "uf_part.h"
#include "uf_object_types.h"
//----------------------------------------------------------------------------
// Activation Methods
//----------------------------------------------------------------------------
// Unigraphics Startup
// This entry point activates the application at Unigraphics startup
tag_t UF_open_part()
{
char filter_string[132]="*";
char filename[132];
int response;
int rc=0;
char msg[132];
tag_t part1;
rc=UF_UI_create_filebox("Open File","打开文件",filter_string," ",filename,[$response)]
if(rc)
{
UF_get_fail_message(rc,msg);
printf("error=%s\n",msg);
}
if(response==UF_UI_OK)
{
char partname[132];
UF_PART_load_status_t error_status;
strcpy(partname,filename);
UF_PART_open(partname,[$part1,&error_status)]
if(part1==NULL_TAG)
{
uc1601("打开part错误",1);
UF_PART_close_all();//退出之前关闭所有part
UF_terminate();
}
else
{ UF_PART_save();
UF_PART_set_display_part(part1);
}
}
return part1;
}
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 */
tag_t parent_part;
parent_part=UF_open_part();
const char *child_part="E:\\my_first_UG\\application\\bb.prt";
const char *refset_name=NULL;
const char *instance_name=NULL;
double origin[3]={0,0,0};
double csys_matrix[6];
int layer=0;
tag_t instance=NULL;
UF_PART_load_status_t *error_status=NULL;
UF_ASSEM_add_part_to_assembly(parent_part,child_part,refset_name,instance_name,
origin,csys_matrix,layer,[$instance,error_status)]
/* Terminate the API environment */
errorCode = UF_terminate();
}
/* Print out any error messages */
 rintErrorMessage( errorCode );
}执行时弹出错误信息:Internal error......
唉,我调了一个下午,还是没发现错在什么地方,指点一下吧 |