Hiding Objects

Hi:
How can I get or search hiding objects? thanks a lot.

Best regards,
Shawn

Stephane Routelous's picture

Hi,

you can try AIS_InteractiveContext::ObjectsInside to get all the objects and AIS_InteractiveContext::DisplayStatus to get the display status of each object.

HTH

Shawn Yang's picture

Dear Stephane:
Thank you for your suggestion. Unfortunately, I couldn't get all objects. I did both Doc.cpp and View3d.cpp

AIS_ListOfInteractive aListOfIO;
GetDocument()->GetAISContext()->ObjectsInside(aListOfIO);
AIS_ListIteratorOfListOfInteractive itIO;
for (itIO.Initialize(aListOfIO); itIO.More(); itIO.Next())
{
if (GetDocument()->GetAISContext()->DisplayStatus(itIO.Value()) == AIS_DS_Erased)
{
//hiding objects
int j =1;
}
if (GetDocument()->GetAISContext()->DisplayStatus(itIO.Value()) == AIS_DS_Displayed )
{
//displaying objegts
int i = 1;
}
}

Did I do something wrong?

I try to see the value of variables as following:
aListOf IO
myFirst 0x00000000
myLast 0x00000000
itIO
current 0x00000000
previous 0x00000000

I think those meanings that are no data in them. Am I right? Thanks, again.

Best regards,
Shawn

Simeon's picture

Hello,

I am not 100% sure as I did not try your example verbatim, but I think you are missing two lines:

aListOfIO = AIS_ListOfInteractive();
itIO = AIS_ListIteratorOfListOfInteractive();

Regards

sergey zaritchny's picture

Hi,
Probably you should check your call of Erase() method.
It has third parameter PutInCollector : Boolean from Standard = Standard_True (by default).
And all erased objects will be put into collector with status = Erased. These objects can be retrieved with method ObjectsInCollector ().
If PutInCollector = Standard_False; objects are erased with status FullErased. These objects can be retrieved with method ErasedObjects ().
Hope it will help.
sergey