Disable automatic hilighting... for real


I've been trying to disable hilighting of shapes when using AIS*, but none of the methods have worked.

Methods I've tried:
* AIS_InteractiveContext::SetAutomaticHilight(Standard_False)
* AIS_InteractiveObject::UnsetHilightMode()
* AIS_InteractiveObject::SetHilightMode(a_mode_without_presentation)

Am I missing something here? Maybe there's an "action" (for example: calling a method) that may re-enable it?

Paul Jimenez's picture

Old post I would like to bump.

Once again I am trying to remove the highlighting of detected shapes, but nothing seems to work.

P Dolbey's picture


Just trying to understand what your requirement is - still at work at the moment, so can't test.

If your just trying to stop highlighting in mouse move events, you could just try putting a boolean flag around the MoveTo call in your viewer, as you have to explicitly call this function to get your highlights under the mouse. I'm not sure what your requirement is around Select() or ShiftSelect() calls.


Paul Jimenez's picture

I don't mind OCC highlighting my shapes when the mouse moves, but, once a shape is Detected and I have worked on it, I do not need the highlighting anymore. The problem is the highlighting remains until another shape is detected by moving the mouse.

In the following image you can see that there is an edge still highlighted, an edge that is no longer there. It would be fine if at least moving the mouse made it disappear, but it only disappears when the mouse touches another shape (an edge in this case).


Your comment gave me an idea that seems to work, though: once I get the shape, I force a selection, then clear it (no need to update the viewer). It's a hacky solution, but it gets the job done.

What I would like to know is how to effectively get highlighting completely disabled while still being able to query detected shapes.

P Dolbey's picture

Back at work again, so still can't test, but I have seen that effect on the MFC example that demonstrates creating fillets, where the line selected to fillet stays highlighted after the fillet is applied. If you're using local contexts in the same way, I wonder if ClearLocalContext(), or even closing the context with CloseLocalContext() might help.


Paul Jimenez's picture

I am using a local context, and closing it did not help. I recall changing selection mode (which closes all local contexts and opens a new one) and a highlighted edge still being there in the view.

Anyway, that issue has been worked around. The real bet is being able to completely disable it, which does not occur when using the methods that seem to do that from the description. There is another mechanism I can think of, but it would require quite a lot of changes in the code: use another EntityOwner for ComputeSelection that knows about the InteractiveObject, but that does not draw in Compute.

Paul Jimenez's picture

SetHilightMode(non-existent mode number);

Calling that in the constructor of my own AIS_Shape derived class and ignoring that mode in Compute effectively removes automatic highlighting.