SELECTION OF OBJECTS

Hi, ı have a problem with selection of objects and highlighting them.

For selection in a mode ı do the following code

myContext->Deactivate(shapes[i].shape);
myContext->Activate(shapes[i].shape, mode);
myContext->MoveTo(x, y, myView, true);
myContext->Select();

When i choose a mode for example Vertex mode(for a box). I can only choose vertexs but the highlighting always for edges. if i click mouse and choose the object selected object is edges. What i am saying is selecting part is working true but the result (highlithing and selected object == ALWAYS EDGES) is wrong. How can i fix this?

Please help!!

Kirill Gavrilov's picture

Your description doen't make sense:

  • AIS_InteractiveContext::Deactivate() deactivates all selection modes in object.
  • AIS_InteractiveContext::Activate() activates a single selection mode in object.

So that if quoted sequence of calls is all that you have:

Handle(AIS_Shape) theShape;
myContext->SetSelectionModeActive (theShape, AIS_Shape::SelectionMode (TopAbs_VERTEX), true, AIS_SelectionModesConcurrency_Single, false);
myContext->MoveTo (x, y, myView, false);
myContext->SelectDetected (AIS_SelectionScheme_Replace);
myContext->UpdateCurrentViewer();

then there is no way selection could highlight any Edge of this Shape.
There is either some bug, or scenario description is incomplete.

emirhan.y2073_167553's picture

Submitted by emir yılmaz on 16 February, 2021 - 08:30

Hİ, thanks for your answer. But still ı have a problem.

myContext->SetSelectionModeActive and myContext->SelectDetected this funcitons does not appear in my library. There is setSelectionMode (not active) and Select()  not SelectDetected()  . What can ı do to use this funcitons? 

Kirill Gavrilov's picture

That code wasn't meant to propose any solution - it is the same logic as yours, just ported to the latest OCCT version.
AIS_InteractiveContext::SetSelectionModeActive() has been introduced by OCCT 7.3.0, so you are using some older release.

emirhan.y2073_167553's picture

Okay ı got it but what should i do to select face vertex, edges and to highlight them?

emirhan.y2073_167553's picture

Okay ı got it but what should i do to select face vertex, edges and to highlight them?