How do i set an interactive object stays visible or invisble?

Hi everyone!
How do i set an interactive object stays visible or invisble?
Like SolidWorks, Show/Hide object(s) command.

Danis's picture

I think you need to use OCAF to do that!

Roman Lygin's picture


RTFM :-)

AIS_InteractiveContext::Erase(), ::EraseAll()
AIS_InteractiveContext::DisplayFromCollector(), ::DisplayAll().

Nothing to do with OCAF, by the way.

Good luck.

ngoctn's picture

Thanks Roman.

JuryS's picture

Hi, Roman. It's not work for me. I don't know why, but I make my code with OCAF
And It's work.

void DocumentCommon::UpdateFilter()
TDF_Label LabSat = myOCAFDoc->Main();
TDF_Label L;
TDF_Label level0;
Handle_TPrsStd_AISPresentation prs;
bool isFound;
Handle_TDataStd_Integer CurInt;
int FilterValue;

for (TDF_ChildIterator it(LabSat); it.More(); it.Next())
L = it.Value();
if (!L.FindAttribute(TPrsStd_AISPresentation::GetID(),prs)) continue;

level0 = L.FindChild(0,Standard_True);

isFound = level0.FindChild(20).FindAttribute(TDataStd_Integer::GetID(),CurInt);
if (!isFound) continue;
FilterValue = CurInt->Get();
if ((FilterValue<1)||(FilterValue>21)) continue;
if ( == false)
myContext->UpdateCurrentViewer(); //Îáÿçàòåëüíî îáíîâèòü ýêðàí

JuryS's picture

Also, CurrentViewFilter is QBitArray