Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics

problem of visualization of TopoDS_Shape

problem of visualization of TopoDS_Shape
Canan Gunicen 2012/06/08 17:15
I have an object of type TopoDS_Shape. Now I wanted to visualize this data, which classes I can use, I searched the forum, I try the sample codes in forum but they were not working. Is there any thread or any classes you could advice?

Thank you already.
Marco Nanni 2012/06/11 01:48
Hello Canan,

Give a look to the doc visu at "4. 2. 4 Create an interactive context".
I assume you have already set up a window, a viewer, a view, and an ais interactive context. If not, look as well some page backward.

Canan Gunicen 2012/06/11 15:47
Thank you Marco.
I will be grateful if you help me with problem below.

After I saw your post,

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

     Handle ( WNT_Window) aWNTWindow;
     aWNTWindow = new WNT_Window(TheGraphicDevice, theApp.m_pMainWnd->GetSafeHwnd());
     Handle(V3d_View) myView = myViewer->CreateView();

     StlAPI_Reader reader;
     TopoDS_Shape aShape;
     std::string filename = "flank_original.tcl";
     reader.Read(aShape, (char*)filename.c_str());
     Handle(AIS_InteractiveContext) myAISContext = new AIS_InteractiveContext(myViewer);
     Handle(AIS_Shape) aAISShape = new AIS_Shape(aShape);

I created this code piece, but there is a problem with this line :

     Handle(Graphic3d_WNTGraphicDevice) TheGraphicDevice = new Graphic3d_WNTGraphicDevice();

The error says unhandled exception. Btw I am running MFC application.

What can be the problem?

Thank you already!
Marco Nanni 2012/06/11 16:44
Hello Canan,

This should work well.

I never used MFC, but I usually you do not use the macro Handle() to declare the type:

Could you try insteed:

Handle_Graphic3d_WNTGraphicDevice TheGraphicDevice = new Graphic3d_WNTGraphicDevice();

I guess you forget to import Standard_Macro.hxx.


Canan Gunicen 2012/06/11 17:01
Hi Marco,

I guess you forgot something here, what will I try instead :

Handle_Graphic3d_WNTGraphicDevice TheGraphicDevice = new Graphic3d_WNTGraphicDevice();

Btw I also included Standard_Macro.hxx but it didn't work.

What do you recommend to use instead of MFC?

I know I am keeping you busy and I am sorry, but I hope you can help.


Marco Nanni 2012/06/11 17:08
No problem Canan,

MFC is not the problem, I would stay with it.

It is like you have an initialization problem. Try to study the samples. There is one very good based on MFC. You will find it in the binary distribution as well (under samples).

I am sorry but, as I do not use MFC, I cannot help you further.


shmsh 2013/02/09 03:53
Dear Canan Gunicen

I also tried to do the same thing but it did not work ...
did you get a solution for that ???
if you got it kindly post it ???
I'm also using MFC , and when i try to debug it ,it gives me an error of
"First-chance exception at 0x75c0c41f in CIRCLE.exe: Microsoft C++ exception: Aspect_GraphicDeviceDefinitionError at memory location 0x002ae98c..
Unhandled exception at 0x75c0c41f in CIRCLE.exe: Microsoft C++ exception: Aspect_GraphicDeviceDefinitionError at memory location 0x002ae98c.."

Marco Nanni 2012/06/11 16:54
Hello Canan,

try to put as well after SetWindow(aWNTWindow):

if (!aWNTWindow->IsMapped()) aWNTWindow->Map();


Latest news
  • Open CASCADE CAD Assistant for iOS platform is available!
  • Open CASCADE Technology 6.9.0 is available for download!
  • JT Assistant for Android

  • © OPEN CASCADE 2000 - 2015  |  Search  |  Contacts   |  Site map