Topological Naming

Could any one kindly provide me some code for topological naming using OCAF? Specifically, I want record the face/edge picked, and do some operations on them later.

Thanks in advance,

Min

Svetlozar Kostadinov's picture

//=======================================================================
//function : Select
//purpose : Performs the topological naming of theShape belonging to theContext
//=======================================================================
Standard_Boolean BTISelection::Select(const TopoDS_Shape& theShape,
const TopoDS_Shape& theContext)
{
TDF_Label aResultLabel = myTreeNode->Label().FindChild(RESULTS_TAG);
TDF_Label aContexLabel = myTreeNode->Label().FindChild(ARGUMENTS_TAG).FindChild(CONTEXT_TAG);
Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(theContext, myTreeNode->Label());

if(aNS.IsNull() || !aNS->Label().Father().IsAttribute(TFunction_Function::GetID())) return Standard_False;

TNaming_Selector aSelector(aResultLabel);
Standard_Boolean aStatus = aSelector.Select(theShape, theContext);

TDF_Reference::Set(aContexLabel, aNS->Label().Father()); //Set a argument of function (theContext)

return aStatus;
}

I hope this helps.