Alternative for V3d_Viewer....

hi,
i'm relatively new to open cascade...

i have actually did the process of reading the STEP file and allowing the model to be displayed in the window using the V3d_Viewer...

Now in my particular application instead of using the V3d_Viewer...i need to make use of the CWnd class in the visual c++ and also the viewer which is being provided by the CWnd class...

kindly reply as early as possible....

Regards,
E.G.Arun Prasath

Rob Bachrach's picture

I don't really understand what you mean. You should use a V3d_Viewer, but connect it to the window under a CWnd object. If you look at section 4.2 and 4.2 of the Visualization User's Guide, it gives a loose example. So, if you have a CWnd object called myWindow, you would want to do something like (untested):

Handle(Graphic3d_WNTGraphicDevice) hDevice = new Graphic3d_WNTGraphicDevice();
TCollection_ExtendedString viewerName("OCC Viewer");
Handle(V3d_Viewer) hViewer = new V3d_Viewer(hDevice, viewerName.ToExtString());
hViewer->Init();
Handle(WNT_Window) hWnd = new WNT_Window(hDevice, myWindow->GetSafeHWnd());
Handle(V3d_View) hView = hViewer->CreateView();
hView->SetWindow(hWnd);

Good luck.

prasath's picture

hi Rob,

Thanks for your reply...

Actually i have did the same as what you have mentioned over here..i'll just submit a sample over here and you please refer and say whether the methodology i did is proper also say me it does satisfy the requirements which i specified in my earlier post...

Handle(Graphic3d_WNTGraphicDevice) hDevice = new Graphic3d_WNTGraphicDevice();
TCollection_ExtendedString viewerName("OCC Viewer");
Handle(V3d_Viewer) hViewer = new V3d_Viewer(hDevice, viewerName.ToExtString());
hViewer->Init();
Handle(WNT_Window) hWnd = new WNT_Window(hDevice,GetSafeHWnd());
Handle(V3d_View) hView = hViewer->CreateView();
hView->SetWindow(hWnd);

Here i haven't included the CWnd object(myWindow) as specified by you in ur post...This is wat i have did in my application..now please refer it and reply me at the earliest...

Regards,
E.G.Arun Prasath.

Rob Bachrach's picture

If this code is in member function of a CWnd derived class, it should work fine.

Rob

prasath's picture

hi Rob,

Thanks again for your reply,

Yes this code is being wirtten under the class which is being inherited from CView class....Is it ok..

Regards,
E.G.Arun Prasath.

Rob Bachrach's picture

I haven't used MFC for over 10 years, but I believe this should be fine.

prasath's picture

hi Rob,

Thanks you for your reply once again...

i hope i did everything right....thanks for your support....

Regards,
E.G.Arun Prasath