标签:alt mina 实体 图片 img isp == spl rtt
1 NX11+VS2013 2 3 #include <uf.h> 4 #include <uf_obj.h> 5 #include <uf_modl.h> 6 #include <uf_part.h> 7 8 9 UF_initialize(); 10 11 //方法1:UF_OBJ_cycle_objs_in_part 12 std::vector<tag_t> 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 UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType); 20 if (SubType == UF_solid_body_subtype) 21 { 22 UF_MODL_ask_body_type(ObjectTag, &Body_Type); 23 if (Body_Type == UF_MODL_SOLID_BODY) 24 { 25 UF_OBJ_set_color(ObjectTag, 186); 26 SolidVector.push_back(ObjectTag); 27 } 28 } 29 UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag); 30 } 31 32 sprintf_s(msg, "当前有%d个实体", SolidVector.size()); 33 lw->Open(); 34 lw->WriteLine(msg); 35 36 /* 37 //方法2:UF_OBJ_cycle_all 38 std::vector<tag_t> SolidVector1; 39 tag_t WorkPartTag = UF_PART_ask_display_part(); 40 tag_t Next_Tag = NULL_TAG; 41 int Type1, SubType1, Body_Type1; 42 char msg1[256]; 43 do 44 { 45 Next_Tag = UF_OBJ_cycle_all(WorkPartTag, Next_Tag); 46 if (Next_Tag != NULL_TAG) 47 { 48 UF_OBJ_ask_type_and_subtype(Next_Tag, &Type1,&SubType1); 49 if (Type1 == UF_solid_type && SubType1 == UF_solid_body_subtype) 50 { 51 UF_MODL_ask_body_type(Next_Tag, &Body_Type1); 52 if (Body_Type1 == UF_MODL_SOLID_BODY) 53 { 54 UF_OBJ_set_color(Next_Tag, 200); 55 SolidVector1.push_back(Next_Tag); 56 } 57 } 58 } 59 } while (Next_Tag != NULL_TAG); 60 61 sprintf_s(msg1, "当前有%d个实体", SolidVector1.size()); 62 lw->Open(); 63 lw->WriteLine(msg1); 64 */ 65 UF_terminate();
NX二次开发-UFUN遍历函数UF_OBJ_cycle_all
标签:alt mina 实体 图片 img isp == spl rtt
原文地址:https://www.cnblogs.com/nxopen2018/p/10957347.html