
Mon, 06/19/2023 - 09:37
Forums:
I am trying to determine the best way to highlight a section of the model programmatically using the name. I can iterate through the shapes and read the names of the nodes. So I can determine at match on the label but I cannot figure out how to highlight said label. When I find the match, I have tried getting the location and it is returning 0,0,0. So it doesn't seem like the shape that I am matching is displayed.
My current code:
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (myDoc->Document()->Main());
TDF_LabelSequence aLabels;
aShapeTool->GetShapes(aLabels);
for (Standard_Integer aLabIter = 1; aLabIter <= aLabels.Length(); ++aLabIter)
{
const TDF_Label& aLabel = aLabels.Value (aLabIter);
TCollection_AsciiString aName;
{
Handle(TDataStd_Name) aNodeName;
if (aLabel.FindAttribute (TDataStd_Name::GetID(), aNodeName))
{
aName = aNodeName->Get(); // instance name
}
if (aName.IsEmpty())
{
TDF_Label aRefLabel;
if (XCAFDoc_ShapeTool::GetReferredShape (aLabel, aRefLabel)
&& aRefLabel.FindAttribute (TDataStd_Name::GetID(), aNodeName))
{
aName = aNodeName->Get(); // product name
}
}
}
if (aName.IsEqual("Seat")) {
// add select here
// need to figure out how to get the corresponding ais_interactiveobject to highlight
myContext->AddSelect(????);
}
}
myContext->HilightSelected(Standard_True);
What is the best way to highlight based on passing in the name of the section of the model?