NX二次开发-UFUN查询体的类型为实体还是片体UF_MODL_ask_body_type

 1     NX9+VS2012
 2     
 3     #include 
 4     #include 
 5     #include 
 6     #include 
 7 
 8 
 9     UF_initialize();
10 
11     //遍历当前显示部件
12     std::vector SolidVector;
13     tag_t ObjectTag = NULL_TAG;
14     int Type, SubType, Body_Type;
15     char msg[256];
16     UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);//遍历体
17     while (ObjectTag != NULL_TAG)
18     {
19         //查询对象的类型和子类型
20         UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType);
21         if (SubType == UF_solid_body_subtype)
22         {
23             //查询体的类型
24             UF_MODL_ask_body_type(ObjectTag, &Body_Type);
25             if (Body_Type == UF_MODL_SOLID_BODY)//为实体
26             {
27                 UF_OBJ_set_color(ObjectTag, 186);
28                 SolidVector.push_back(ObjectTag);
29             }
30         }
31         UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
32     }
33 
34     sprintf_s(msg, "当前有%d个实体", SolidVector.size());
35     lw->Open();
36     lw->WriteLine(msg);
37 
38 
39     UF_terminate();

NX二次开发-UFUN查询体的类型为实体还是片体UF_MODL_ask_body_type_第1张图片

你可能感兴趣的:(NX二次开发-UFUN查询体的类型为实体还是片体UF_MODL_ask_body_type)