iCAx开思工具箱

标题: UF_MODL_ask_mass_props_3d [打印本页]

作者: enmybh    时间: 2003-8-11 04:55
标题: UF_MODL_ask_mass_props_3d
我用UF_part_open打开一个prt文件,然后打算用UF_MODL_ask_mass_props_3d输出实体的质量.但是程序运行时出错.
好象是tag of the object is wrong or ....
请高手看一下,特别是UF_MODL_ask_mass_props_3d这一句的&part是否正确?
{
        // TODO: Add your application code here
    //introduction-----------------------------------
    
    cout<<"*******open a part:\n";
      cout<<"*******D:\\HUANGC++\\sample0\\piston.part\n";
    char part_name[133]="D:\\HUANGC++\\sample0\\piston.prt";
    tag_t part;
    UF_PART_load_status_t error_status;
    UF_PART_open (part_name,[$part,&error_status )]
    if ( part != NULL )
    {
      
      int type = 1;
      int  unit = 3;
      int accuracy =  1;
      int  count = 1;
      int  zero = 0;
      int  i;
      double  acc_val[11] = {.01,0,0,0,0,0,0,0,0,0,0};
      double  density = 1.0;
      double  massprop[47];
      double  massprop_stat[13];
      
      UF_CALL(UF_MODL_ask_mass_props_3d(&part,
                     count,
                     type,
                     unit,
                     density,
                     accuracy,
                     acc_val,
                     massprop,
                     massprop_stat));
      
      for (i=0; i<47; i++)
      {
         printf("[%d] = %8.3f\n",i,massprop);
      }
      UF_free([$part)]  
    }
    else cout<<"no part opened!!\n";
  }
作者: enmybh    时间: 2003-8-12 03:30
跪求师兄帮忙,小弟我急需这个程序.
作者: spline    时间: 2003-8-12 10:37
The variable "part" is the file's tag, not the solid body tag. You should search the solid body in the part file after openning it.
作者: enmybh    时间: 2003-8-12 14:59
search?用什么函数?
作者: enmybh    时间: 2003-8-12 15:04
search "current" part?
作者: zzz    时间: 2003-8-12 16:04
就是要使用UF_OBJ_cycle_objs_in_part()把零件中的所有实体或者你想要的实体找出来。可以看前面《UG二次开发精华》中代码,我已经给出链接。
作者: enmybh    时间: 2003-8-13 05:20
thanks a lot.




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