马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
用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("计算体积错误!"); |