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

Problem with visualization of a TopoDS_Shape (Windows)

Matthias Teich's picture


I am trying to display an iges-file with Qt and OpenCascade.
The code i wrote compiles and runs...but it does not display the shape.
The import of the iges-file seems to be okay.


TopoDS_Shape readIgesFile(){
IGESControl_Reader reader;
IFSelect_ReturnStatus stat = reader.ReadFile("test.igs");
return reader.OneShape();

int main (int argc, char* argv[]){
//Read shape
TopoDS_Shape shape = readIgesFile();

//Create Window
QApplication App (argc, argv);
QWidget *window = new QWidget();

Handle(Graphic3d_WNTGraphicDevice) TheGraphicDevice = new Graphic3d_WNTGraphicDevice();
TCollection_ExtendedString aName("3DV");
Handle (V3d_Viewer) myViewer = new V3d_Viewer (TheGraphicDevice,aName.ToExtString (), "");

Handle (WNT_Window) myWindow;

int windowHandle = (int) window->winId();
short lo = (short) windowHandle;
short hi = (short) ( windowHandle >> 16 );
myWindow = new WNT_Window( TheGraphicDevice, (int) hi, (int) lo);
Handle (V3d_View) myView = myViewer -> CreateView();
myView -> SetWindow (myWindow);
Handle (AIS_InteractiveContext) myAISContext = new AIS_InteractiveContext (myViewer);
Handle (AIS_Shape) aAISShape = new AIS_Shape(shape);
myAISContext -> Display (aAISShape);

return App.exec();

I would be happy if someone could tell me why this doesnt work.
I already looked at the QtOpenCascade-Sample, but it is far too complex for me since i am not very familiar with C++.