马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
这是我写的一段代码:
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_list_p_t *face_list=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)]
UF_MODL_ask_body_faces(instance,face_list);
/* Terminate the API environment */
errorCode = UF_terminate();
}
/* Print out any error messages */
 rintErrorMessage( errorCode );
}
调试没问题,但执行时弹出一个窗口:Internal error:memory access violation,各位高手指点一下吧 |