void SEModifyAttX::delAtt() //删除实体或者部件事例属性
{
try
{
//获取UI界面的属性
//获取选择对象TAG
PropertyList *blockxuanzhePros = bodySelect0->GetProperties();
std::vector<NXOpen::TaggedObject*> theblockxuanzhe = blockxuanzhePros->GetTaggedObjectVector("SelectedObjects");
delete blockxuanzhePros;
blockxuanzhePros = NULL;
UF_initialize();
for (int i = 0; i < theblockxuanzhe.size(); i++)
{
tag_t bodyTAG = theblockxuanzhe[i]->Tag();
if (UF_ASSEM_is_occurrence(bodyTAG))//判断是否为部件事例标识(occurrence)
{
UF_ATTR_delete_all(bodyTAG, UF_ATTR_any); //删除部件事例标识
bodyTAG = UF_ASSEM_ask_prototype_of_occ(bodyTAG); //覆写TAG
UF_ATTR_delete_all(bodyTAG, UF_ATTR_any); //删除对象事例标识
}
else
{
UF_ATTR_delete_all(bodyTAG, UF_ATTR_any); //删除对象事例标识
}
}
UF_MODL_update();
theDialog->PerformApply();
UF_terminate();
}
catch (exception& ex)
{
//---- Enter your exception handling code here -----
SEModifyAttX::theUI->NXMessageBox()->Show("删除实体或者部件事例属性", NXOpen::NXMessageBox::DialogTypeError, ex.what());
}
}