|
马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我用 UF_UI_select_with_class_dialog()和 UF_MODL_ask_mass_props_3d()来得到零件体积,能够零件进行交互选择,但是老实得不到体积值~~!
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 ret = UF_UI_select_with_class_dialog(message,title,UF_UI_SEL_SCOPE_NO_CHANGE,
NULL,NULL,[$response,&sel_count,&sel_objects)]
if(ret == 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 retn = UF_MODL_ask_mass_props_3d(objects,count,type,units,density,
accuracy,acc_value,mass_props,statistics);
if(retn == 0)
{
CString volume;
CString test;
volume.Format("%f",mass_props[1]);
test = volume;
AfxMessageBox("test~!");
SetDlgItemText(IDC_VOLUMEEDIT, volume);
}
else
AfxMessageBox("计算体积错误!"); |
|