Object Color Picker(对象颜色拾取器)控件的获取
1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_obj.h> 5 6 7 UF_initialize(); 8 //获取体收集器控件 9 PropertyList* BodySelectProps = bodySelect0->GetProperties(); 10 std::vector<NXOpen::TaggedObject *> Bodys = BodySelectProps->GetTaggedObjectVector("SelectedObjects"); 11 delete BodySelectProps; 12 BodySelectProps = NULL; 13 14 //获取颜色值控件 15 PropertyList *blockColorProps = colorPicker0->GetProperties(); 16 std::vector<int> color = blockColorProps->GetIntegerVector("Value"); 17 delete blockColorProps; 18 blockColorProps = NULL; 19 20 //得到的是int类型,存在vector数组里,使用时取数组里的第一个值[0]。 21 //控件为多选 22 for (int i = 0; i < Bodys.size(); ++i) 23 { 24 //设置颜色 25 UF_OBJ_set_color(Bodys[i]->Tag(), color[0]); 26 } 27 28 UF_terminate();