SetDisplayMode() not changing mode

I've built a Visual C++ MFC application to import IGES files and then display the imported model in wireframe or shaded. My problem is that I can't change the display mode. Without selecting each shape, I want to change the display mode for all the shapes using AIS_InteractiveContext::SetDisplayMode(). The following code segment is a summary of how I do this:

AIS_Shape importedShape = ...; m_myAISContext->Display (importedShape); m_myAISContext->SetDisplayMode (AIS_Shaded);

The above method for setting the display mode for all the shapes was borrowed from one of the MFC sample applications downloaded from this site. Anyway, I can't get the shape to be displayed in shaded mode. What am I doing wrong?

Christian Reif's picture

Try following code for(myContext->InitCurrent();myContext->moreCurrent();myContext->NextCurrent)

myContext->SetDisplayMode(myContext->Current(),1); //Shading

myContext->SetDisplayMode(myContext->Current(),0); //Wireframe or myContext->Display(shape,AIS_Shaded);

Paul Kitchen's picture

This method you propose only works if the shapes are selected. I want to be able to change the display mode of all the shapes in the context without any of the shapes being selected. Any other suggestions?

Stephen JANNIN(DRIME)'s picture


There are two methods : 1/ set the "global diplay mode" : -----------------------------------------

context1->SetDisplayMode(AIS_Shaded); or context1->SetDisplayMode(AIS_WireFrame);

2/ change the display mode for each shape : -------------------------------------------------------- AIS_ListOfInteractive liste; // liste d'objets AIS_ListIteratorOfListOfInteractive It; // index pour la liste d'obj Handle(AIS_Shape) shap;

// get a list of all displayed elements context1->DisplayedObjects(liste,Standard_True);

// loop on all visualized elements for (It.Initialize(liste);It.More();It.Next())





Hopes this can help...

Stephen JANNIN