|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
想写个程序实现装配里面的各部件的最大外形尺寸。我的想法是用UF_ASSEM_cycle_objs_in_comp遍历装配里面的对象获得对象的tag_t,然后用UF_MODL_ask_bounding_box()获得该对象的包容盒尺寸,部分内容如下:
tag_t part=UF_CALL(UF_PART_ask_display_part());//显示的是什么就是什么的tag_t
tag_t root=UF_ASSEM_ask_root_part_occ(part);
double bounding_box[6];
double w,l,h;
char wide[100];
char length[100];
char height[100];
char boundary[100];
tag_t object_occur=NULL_TAG;
do
{
UF_ASSEM_cycle_objs_in_comp(root,&object_occur);
UF_CALL(UF_MODL_ask_bounding_box(object_occur,bounding_box));
w=bounding_box[3]-bounding_box[0];
l=bounding_box[4]-bounding_box[1];
h=bounding_box[5]-bounding_box[2];
sprintf(wide,"%f",w);
sprintf(length,"%f",l);
sprintf(height,"%f",h);
strcpy(boundary,wide);
strcat(boundary,"X");
strcat(boundary,length);
strcat(boundary,"X");
strcat(boundary,height);
UF_UI_write_listing_window(boundary);
}while(object_occur!=NULL_TAG);
现在的问题是UF_MODL_ask_bounding_box(object_occur,bounding_box);获得的bounding_box[6]的所有值都是一样的,导致后面的所有部件的w、l、h都是0,而且调试时该函数的信息是“the first parameter passed in was invalid”。请各位帮帮忙应该怎么处理呢?
|
|