Selectable / Unselectable objects

Pawel's picture

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

OCCT 7.0.0 Version

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?

kgv's picture

Re: disable selection

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

Using overloaded AIS_InteractiveContext::Display()

Yes, thanks!

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

www.opencascade.com

Copyright 2011-2017
OPEN CASCADE SAS
Contact us