Part *workPart(theSession->Parts()->Work());
GroupBuilder* groupBuilder1 = workPart->CreateGatewayGroupBuilder(NULL);
groupBuilder1->SetGroupName("123");//设置组的名字
groupBuilder1->SetGroupDisplayProperties(false);//设置应用组显示属性
std::vector<TaggedObject *> objectsTag = selection0->GetSelectedObjects();//获取选择的对象
NXOpen::Body *body = dynamic_cast<NXOpen::Body *>(NXOpen::NXObjectManager::Get(objectsTag[0]->Tag()));//tag_t转NXObject
bool added1;
added1 = groupBuilder1->ObjectsInGroup()->Add(body);
groupBuilder1->Commit();
groupBuilder1->Destroy();