Selectable / Unselectable objects

Hello,

after porting to OCCT 7.0.0 I came upon the following problem. The method 'UnsetSelectionMode' in my old code:

Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron(aTrihedronAxis);
aTrihedron->UnsetSelectionMode();
myAISContext->Display(aTrihedron);

is invalid and had to be removed.

The problem is 'SelectMgr_SelectableObject::setGlobalSelMode' is declared as protected and 'AIS_InteractiveContext::SetAutoActivateSelection' seems to influence all displayed AIS_InteractiveObjects. Displaying objects always uses the global value and I'm not sure how to cope with that.

So how can I make some objects selectable and others not?

Thanks!
Pawel

Pawel's picture

OK, I got one workaround:

Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron(aTrihedronAxis);
myAISContext->Display(aTrihedron);
myAISContext->SelectionManager()->Remove((const Handle(SelectMgr_SelectableObject)&)aTrihedron);

The problem is that the selection is computed first and then removed... so I would probably have to do this the other way round:

AIS_InteractiveContext::SetAutoActivateSelection(Standard_False)
Add selector.

Does that sound reasonable?

Kirill Gavrilov's picture

I'm not quite understand your question - if you don't like the object to be selectable you should either disable auto-enabling selection by mentioned method AIS_InteractiveContext::SetAutoActivateSelection() or by passing invalid selection mode in extended version of AIS_InteractiveContext::Display().

Pawel's picture

Yes, thanks!

Using an overloaded version of AIS_InteractiveContext::Display() solves the problem.