if (interactiveContext->HasDetected())
{
newHighlightedObject = interactiveContext->DetectedInteractive();
}
or the selected object like this
if (0 != interactiveContext->NbSelected())
{
for (interactiveContext->InitSelected(); interactiveContext->MoreSelected();
interactiveContext->NextSelected())
{
const Handle(AIS_InteractiveObject) object =
interactiveContext->SelectedInteractive();
...
}
}
Then you might want to check the owner of the selected object like this:
if (object->HasOwner())
{
const Handle(Standard_Transient)& owner = object->GetOwner();
if (owner.IsNull())
{
// Do nothing! This is a temporary visualization element.
}
else if (owner->IsKind(STANDARD_TYPE(TPrsStd_AISPresentation)))
{
Handle(TPrsStd_AISPresentation) presentation =
Handle(TPrsStd_AISPresentation)::DownCast(owner);
// Modify the presentation...
...
}
}
But it might depend on your document handling what the owner is and what you want to do with it. I hope that this gives you an idea. The rest I guess you would have to find out by trying...
Mon, 10/15/2018 - 10:29
Hi Mohammad,
you can get the highlighted object like this
Handle(AIS_InteractiveObject) newHighlightedObject;
if (interactiveContext->HasDetected())
{
newHighlightedObject = interactiveContext->DetectedInteractive();
}
or the selected object like this
if (0 != interactiveContext->NbSelected())
{
for (interactiveContext->InitSelected(); interactiveContext->MoreSelected();
interactiveContext->NextSelected())
{
const Handle(AIS_InteractiveObject) object =
interactiveContext->SelectedInteractive();
...
}
}
Then you might want to check the owner of the selected object like this:
if (object->HasOwner())
{
const Handle(Standard_Transient)& owner = object->GetOwner();
if (owner.IsNull())
{
// Do nothing! This is a temporary visualization element.
}
else if (owner->IsKind(STANDARD_TYPE(TPrsStd_AISPresentation)))
{
Handle(TPrsStd_AISPresentation) presentation =
Handle(TPrsStd_AISPresentation)::DownCast(owner);
// Modify the presentation...
...
}
}
But it might depend on your document handling what the owner is and what you want to do with it. I hope that this gives you an idea. The rest I guess you would have to find out by trying...
Benjamin