admin 发表于 2013-11-26 15:12:52

循环查找所有打开零件的特征并输出特征列表


循环查找所有打开零件的特征并输出特征列表

<p>static void do_ugopen_api(void)
{
// create block 1
double coner = {0,0,0};
char *edges = {"l=100","w=100","h=20"};
tag_t blk_tag;
UF_MODL_create_block1(UF_NULLSIGN,coner,edges,&blk_tag);
// create a hole
double dir = {0,0,1};
double coner1 = {50,50,0};
tag_t cyl_tag;
UF_MODL_create_cyl1(UF_NEGATIVE,coner1,"h","20",dir,&cyl_tag);
tag_t part;
char msg,msg1;
char part_fspec;
int num = UF_PART_ask_num_parts();
sprintf(msg,"the part num is %d",num);
uc1601(msg,1);
for(int num_part=0;num_part<num;num_part++)
{
part = UF_PART_ask_nth_part(num_part);
UF_PART_ask_part_name(part,part_fspec);
uc1601(part_fspec,1);
int count = 0;
int type = UF_feature_type;
tag_t feature = NULL_TAG;
UF_OBJ_cycle_objs_in_part(part,type,&feature);
char *name;
while(feature!= NULL_TAG)
{
    count++;
    UF_MODL_ask_feat_display_name(feature,&name);
    UF_OBJ_cycle_objs_in_part(part,type,&feature);
    sprintf(msg1,"the cyle result is the %d feature : %s",count,name);
    uc1601(msg1,1);
}

}

}</p>
页: [1]
查看完整版本: 循环查找所有打开零件的特征并输出特征列表