感谢gao264!
目前"打开"的部件的body_tag获得了,但是"导入"的部件的body_tag依然不行```我的思路是对于导入的部件,先用UF_GROUP_ask_group_data获得group的数据,然后再用UF_OBJ_cycle_objs_in_part 遍历,但是不行``不知道错在何处,麻烦各位高手解答下```
{
char part_name[132]="c:\\pump.prt";
tag_t part;
UF_PART_load_status_t error_status;
UF_PART_open(part_name,&part,&error_status);
char file_name1[] = "c:\\electrode.prt"; //导入操作的源文件
UF_import_part_modes_t modes; //导入对象时的模式设置
double dest_csys[6]; //导入后对象所处的坐标系
double dest_point[3]; //导入后确定对象位置的基准点
double scale = 1.0;
tag_t group = NULL_TAG;
modes.layer_mode = 0;
modes.group_mode = 1;
modes.view_mode = 0;
modes.plist_mode = 1;
modes.cam_mode = FALSE;
dest_csys[0] = 1; //坐标系X轴的矢量
dest_csys[1] = 0;
dest_csys[2] = 0;
dest_csys[3] = 0; //坐标系Y轴的矢量
dest_csys[4] = 1;
dest_csys[5] = 0;
dest_point[0] = 0.0; //基准点设为原点
dest_point[1] = 0.0;
dest_point[2] = 0.0;
UF_PART_import ( file_name1, &modes, dest_csys, dest_point, scale, &group );
tag_t pump = NULL_TAG;
tag_t electrode = NULL_TAG;
tag_t *group_members;
int count_of_members = NULL_TAG;
UF_GROUP_ask_group_data(group,&group_members,&count_of_members);
int type = UF_solid_type;
int type1 = UF_solid_type;
UF_OBJ_cycle_objs_in_part(part,type,&pump);
UF_OBJ_cycle_objs_in_part(*group_members,type1,&electrode);
logical retain_target_body=TRUE;
logical retain_tool_body=TRUE;
tag_t electrode_pump_intersect;
UF_MODL_intersect_bodies_with_retained_options(pump,electrode,retain_target_body,retain_tool_body,&electrode_pump_intersect);
} |