马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
下边这个是我的程序,我是求出实体的重心,然后把坐标系的原点移动到重心处,怎么不行呀?还有,就是我在把int display_status=1;改成int display_status=0;来不显示坐标系,怎么还是能看到坐标系呀?请各位大侠指点!多谢过目!!
UF_UI_selection_options_t opts;
UF_UI_mask_t mask = {UF_solid_type, 0, UF_UI_SEL_FEATURE_BODY};
tag_t *solbody = NULL;
int response = 2;
int type = 1;
int unit = 3;
int accuracy = 1;
int count = 0;
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];
char pt[12];
tag_t * wcs_id ;
double origin[ 3 ];
double origin1[ 3 ]={1,2,3};
int display_status=1;
opts.num_mask_triples = 1;
opts.mask_triples = [$mask]
opts.scope = UF_UI_SEL_SCOPE_WORK_PART;
UF_CALL(UF_UI_select_by_class("Select solid bodies",&opts,&response,
[$count,&solbody))]
/* if sheet bodies were selected */
if ( solbody != NULL )
{
UF_CALL(UF_MODL_ask_mass_props_3d(solbody,
count,
type,
unit,
density,
accuracy,
acc_val,
massprop,
massprop_stat));
for (i=0; i<47; i++)
{
printf("[%d] = %f\n",i,massprop);
}
for(i=3;i<6;i++)
{
sprintf(pt,"%d",massprop);
UF_UI_open_listing_window();
UF_UI_write_listing_window(pt);
UF_UI_write_listing_window("\n");
}
UF_CSYS_ask_wcs ( wcs_id);
origin[0] =massprop[3];
origin[1]= massprop[4];
origin[2]= massprop[5];
UF_CSYS_set_origin (*wcs_id, origin1);
int UF_CSYS_set_wcs_display (display_status );
UF_MODL_update ( );
for (i=0; i<count; i++)
{
UF_CALL(UF_DISP_set_highlight(solbody,zero));
}
UF_free(solbody); |