iCAx开思工具箱

标题: 有关装配的问题 [打印本页]

作者: tari    时间: 2004-5-14 16:00
标题: 有关装配的问题
将一个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 */
   &nbsprintErrorMessage( errorCode );
}执行时弹出错误信息:Internal error......
唉,我调了一个下午,还是没发现错在什么地方,指点一下吧
作者: zzz    时间: 2004-5-14 20:03
csys_matrix没有初始化?




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3