AIS_InteractiveContext::RemovelAll() on OCCT 6.8.0

Hello,

I would like to clear my view window without deleting the objects presented in it. On OCCT 6.7.9, AIS_InteractiveContext::RemovelAll() did the trick, but now on 6.8.0 I get the following exception:

00007FFD7E7B0 : Standard_NoSuchObject: TCollection_DataMap::Find

Any clues as to why this is happening?

Thanks in advance,
Rodrigo

Rodrigo Castro Andrade's picture

Just an update:

I tested AIS_InteractiveContext::Remove(const Handle(AIS_InteractiveObject)& aniobj) instead of RemoveAll(), in particular using an argument of type Handle(AIS_Shape), to clear the view from the only object in it.
The problem repeats itself, though the number code on the exception is different:

00007FFB3457E7B0 : Standard_NoSuchObject: TCollection_DataMap::Find

Forum supervisor's picture

Dear Rodrigo,
To say something definite a complete scenario to reproduce the issue should be provided, because there are no problems to remove AIS_Shape from context in Draw Harness.
For now it looks like an application bug.

Best regards
FSR.

Rodrigo Castro Andrade's picture

Thank you for the reply, FSR. I will continue my investigation of the issue, as you are probably correct.

Rodrigo Castro Andrade's picture

Just closing this issue, I managed to track it down to the following:

// Part 1
handle_modelo3D = new AIS_Shape(t_shape);
myAIScontext->Display(handle_modelo3D, AIS_Shaded, TopAbs_FACE);

// Part 2
myAIScontext->CloseAllContexts();
myAIScontext->OpenLocalContext();
myAIScontext->ActivateStandardMode(TopAbs_FACE);
myAIScontext->SelectionColor(Quantity_NOC_RED);

// Part 3
myAIScontext>RemoveAll();

After some teste, I noticed the problem only ocurred after issuing OpenLocalContext() on Part 2, which exists because it is the only thing that worked (I wanted a single face of my model to highlight when the mouse cursor moved over it).
So I've made the following changes to part 3. I don't even know if removing an AIS_Shape from closed contexts does anything, but it solved my problem.

// Part 3
myAIScontext->CloseAllContexts();
myAIScontext->Remove(handle_modelo3D);

I am leaving this here in case other people have the same issue. Thanks again!