For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

'Select All' functionality, AddOrRemoveSelected()

Gernot's picture
Forums: 

Dear forum members,

I need help in implementing a function to select all actually displayed faces instead of selecting all single by mouse interaction.

I have the faces displayed correctly. Then I open a local context where selection with the mouse works. Also the method AIS_InteractiveContext::ClearSelected() works. But I don't know how to do the opposite, how to select all faces.

I tried something like this:

AIS_ListOfInteractive interactiveList;
GUIInterface::getAISContext()->DisplayedObjects(interactiveList);
AIS_ListIteratorOfListOfInteractive interactiveListIterator;
if(interactiveList.Extent() > 0)
{
for(interactiveListIterator.Initialize(interactiveList);interactiveListIterator.More();interactiveListIterator.Next())
{
if(interactiveListIterator.Value().IsNull() == false)
{
GUIInterface::getAISContext()->AddOrRemoveCurrentObject(interactiveListIterator.Value());
}
}
}

This works, but as I understood this selects all objects in the neutral point. I want to select all faces in my local context, similar to selecting all by mouse. I tried also AIS_InteractiveContext::SetSelected() but it doesn't works, I know AIS_InteractiveContext::AddOrRemoveSelected(), but I cannot use it because I don't know how to get the TopoDS_Shape or SelectMgr_EntityOwner from an AIS_InteractiveObject.

Thanks for any hints,
Gernot