iCAx开思网

标题: 用UF_MODL_ask_mass_props_3d求体积的问题 [打印本页]

作者: shaoxjin    时间: 2005-8-12 09:26
标题: 用UF_MODL_ask_mass_props_3d求体积的问题
用UF_MODL_ask_mass_props_3d求一个正方体(边长100)的体积时,返回值是61~~!
mass_props[1]是volume~~!
  
下面是代码:
  int rcode = UF_UI_lock_ug_access(UF_UI_FROM_CUSTOM);
   if(rcode != UF_UI_LOCK_SET)   
   {     
     AfxMessageBox("failed to lock");     
     return;   
   }      
   char *message = "请选择实体";   
   char *title = "选择实体";   
   int response,sel_count;   
   tag_p_t sel_objects;   
   int retn = UF_UI_select_with_class_dialog(message,title,UF_UI_SEL_SCOPE_NO_CHANGE,
     NULL,NULL,[$response,&sel_count,&sel_objects)]
  
   if(retn == 0)   
  {     
     if(response == UF_UI_OK && sel_count>0)     
     {       
       objects = sel_objects;
       count = sel_count;     
     }   
   }   
   else     
       AfxMessageBox("ret != 0");
  
   rcode = UF_UI_unlock_ug_access(UF_UI_FROM_CUSTOM);
   if(rcode != UF_UI_UNLOCK_SET)     
      AfxMessageBox("failed to unlock");   
   //计算体积
  
   int type = 1;//solid body     
   int units = 1;     
   double density = 1;     
   int accuracy = 1;// Use Accuracy     
   double acc_value[11] = {1.0,0,0,0,0,0,0,0,0,0,0};     
   double  mass_props[47];//output     
   double  statistics[13];//output      
   int ret = UF_MODL_ask_mass_props_3d(objects,count,type,units,density,       
     accuracy,acc_value,mass_props,statistics);      
   if(ret == 0)     
   {       
     CString volume ;       
     volume.Format("%.1f",mass_props[1]);       
     SetDlgItemText(IDC_VOLUMEEDIT, volume);  
  
   }     
   else       
     AfxMessageBox("计算体积错误!");
作者: 深夜摔键盘    时间: 2005-8-12 09:40
int  units Input Units of mass and length
1 = Pounds and inches
2 = Pounds and feet
3 = Grams and centimeters
4 = Kilograms and meters
作者: shaoxjin    时间: 2005-8-12 09:59
非常感谢键盘大哥~~!




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3