iCAx开思工具箱

标题: 难道没有人作过装配吗? [打印本页]

作者: 刘煜    时间: 2004-11-19 14:51
标题: 难道没有人作过装配吗?
请高手们指教,这可是最基本的操作啊!
请问在向装配中添加零部件时,必须的步骤是什么?我的部分代码如下:  
displayed_part=UF_PART_ask_display_part();  
root_tag=UF_ASSEM_ask_root_part_occ(displayed_part)if(root_tag==NULL_TAG)  
      return(UF_UI_CB_CONTINUE_DIALOG);  
UF_ASSEM_add_part_to_assembly(root_tag,"F:\\ly\\UGData\\LuoMu.prt",NULL,"LuoMu_1",origin  
   ,csys_matrix,0,[$instance_tag,error_status)]  
调试到UF_ASSEM_add_part_to_assembly时出现访问违例,这个函数使得程序无法正常调试,无法得到 error_status,也不知错在那里?
作者: dreamerwj    时间: 2004-11-19 19:43
extern int UF_ASSEM_add_part_to_assembly (
tag_t parent_part,  
const char * part,  
const char * refset_name,  
const char * instance_name,  
double origin[ 3 ],  
double csys_matrix[ 6 ],  
int layer,  
tag_t * instance,  
UF_PART_load_status_t * error_status );
你的参数类型能与上面的要求不符合,比如说第一个参数就错了,root_tag是Occurrence类型,而要求是part型。
作者: 刘煜    时间: 2004-11-21 20:03
还是不对啊,修改后的代码如下,请dreamerwj多多指教
displayed_part=UF_PART_ask_display_part();  
UF_ASSEM_add_part_to_assembly(displayed_part,"F:\\ly\\UGData\\LuoMu.prt",NULL,"LuoMu_1",origin  
   ,csys_matrix,0,[$instance_tag,error_status)]
作者: dreamerwj    时间: 2004-11-22 08:20
   如果你知道display_part的part name,直接利用UF_PART_ask_part_tag()得到其part tag。
    另外我怀疑double csys_matrix[ 6 ]会不会是double csys_matrix[ 9 ]。
利用int err=UF_ASSEM_add_part_to_assembly()获得err再用
     if(err)
     {
     char message[133];
     UF_get_fail_message( err, message );
     AfxMessageBox(message);
     }  
查错。
作者: 刘煜    时间: 2004-11-22 15:16
我要疯了,由于UF_ASSEM_add_part_to_assembly()无法被执行,得不到返回值,运行时,系统提示的错误是:memory access violation.调试时运行到该函数汇编代码中第一行就错了。dreamerwj能不能把你作的成功的代码拿来看看,非常感谢!!
作者: dreamerwj    时间: 2004-11-22 17:41
我这里没有编好的代码,你把你的程序和模型文件发到zhouhaifeng_2001@163.com,我看一下,看能不能帮上忙。
作者: fzw6666    时间: 2004-11-22 17:58
如果这样来做装配那么所有的老板都要倒过来养你.
作者: liberty000    时间: 2004-11-22 18:54
dreamerwj wrote:
    如果你知道display_part的part name,直接利用UF_PART_ask_part_tag()得到其part tag。  
     另外我怀疑double csys_matrix[ 6 ]会不会是double csys_matrix[ 9 ]。  
  利用int err=UF_ASSEM_add_part_to_assembly()获得err再用  
      if(err)  
      {  
      char message[133];  
      UF_get_fail_message( err, message );  
      AfxMessageBox(message);  
      }   
  查错。

  
肯定是double csys_matrix的问题!用double csys_matrix[ 9 ]。
作者: 刘煜    时间: 2004-11-22 20:36
uf_assem.h里面写的是double  csys_matrix[6]应该不是这里出错。
extern UFUNEXPORT int UF_ASSEM_add_part_to_assembly(
    tag_t parent_part ,        /* <I>
                                  tag of part to add instance to
                               */
    char   *part,              /* <I>
                                  name of part to instance. The part name can
                                  include a directory path.  This can not  
                                  exceed UF_CFI_MAX_PATH_NAME_LEN characters.
                               */
    char   *refset_name,       /* <I>
                                  Name of reference set to use from component
                                  parts. The refset_name cannot exceed 30
                                  characters, cannot include a directory path,  
                                  and should not have a file extension.
                               */
    char   *instance_name,     /* <I>
                                  Name of new instance  The instance_name cannot
                                  exceed 30 characters, cannot include a  
                                  directory path, and should not have a file  
                                  extension.
                               */
    double  origin[3],         /* <I>
                                 &nbsposition in <parent_part> where the instance  
                                  is to be created
                               */
    double  csys_matrix[6],    /* <I>
                                  Orientation of the instance
                               */
    int     layer,             /* <I>
                                  -1 Means use the original layers.
                                  0 Means use the work layer
                                  1-255 Means use the specified layer.
                               */
    tag_t  *instance,          /* <O>
                                  Tag of the new instance in the work part
                               */
    UF_PART_load_status_t *error_status    /* <OF>  
                                           User allocted structure consisting of
                                           names and associated error codes. The
                                           allocated arrays must be freed with  
                                           UF_free_string_array and UF_free.
                                           See the description of the  
                                           UF_PART_load_status_t structure for
                                           details on freeing this structure.
作者: liberty000    时间: 2004-11-22 21:44
我用的是double csys_matrix[ 9 ]怎么没有问题?不大明白!
作者: 刘煜    时间: 2004-11-23 11:08
liberty000 wrote:
我用的是double csys_matrix[ 9 ]怎么没有问题?不大明白!

  
能不能把你的代码拿来看看!
作者: dreamerwj    时间: 2004-11-23 14:06
已发送到你的邮箱。
作者: zzz    时间: 2004-11-23 22:10
最后的error_status要用引用,不能输指针进去。




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