#include <uf_defs.h> #include <uf_ui_types.h> #include <uf_drf.h> #include <uf_obj.h> #include <uf_part.h> #include <uf.h> #include <uf_modl.h> #include <uf_ui.h> #include <string.h> #include <uf_object_types.h> #include <uf_ui_types.h>
设置过滤
selection0->GetProperties()->SetString("LabelString", "选择注释");//设置文字 selection0->GetProperties()->SetString("Bitmap", "note");//设置图标 selection0->GetProperties()->SetEnum("SelectMode", 1);//多选模式 //设置过滤只选注释 Selection::SelectionAction object = Selection::SelectionActionClearAndEnableSpecific; std::vector<Selection::MaskTriple>masks(1); masks[0] = Selection::MaskTriple(UF_drafting_entity_type, UF_draft_note_subtype, 0); selection0->GetProperties()->SetSelectionFilter("SelectionFilter", object, masks);
UF_initialize(); //对象收集器控件 PropertyList* FaceSelectProps = selection0->GetProperties(); std::vector<NXOpen::TaggedObject *> notes = FaceSelectProps->GetTaggedObjectVector("SelectedObjects"); delete FaceSelectProps; FaceSelectProps = NULL; //获取字符串内容 NXString str = string0->GetProperties()->GetString("Value"); char ch[133]; strcpy_s(ch, 133, str.GetLocaleText()); char cp4[][133] = { 0 }; strcpy(cp4[0], ch); if (strlen(ch) != NULL) { for (int i = 0; i < notes.size(); i++) { //更改注释 uc5566(notes[i]->Tag(), 1, 1, cp4); } } else { uc1601("没有输入内容", 1); } UF_terminate();