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

Visual3d package

Sven Jungnickel's picture
Forums: 

Hi,

I have a question about using the Viusal3d package. I want to use the Visual3d package instead of the V3d package because it allows one to modify the view mapping in detail. The problem is that I don't know which function I have to use if I want to display an interactice object, like a shape. In an older version of my software I used the V3d package to create the interactive context. Here is the old code snippet

// Get Graphic device of application
Handle(Graphic3d_WNTGraphicDevice) GraphicDevice =
((CVcpaApp*)AfxGetApp())->GetGraphicDevice();

// Create new viewer
m_3dviewer = new V3d_Viewer(GraphicDevice,(short *) "Visu3D");

// Create interactive context
m_AISContext = new AIS_InteractiveContext(m_3dviewer);

Later I dispay a shape with the following code:

// Display shape
m_AISContext->Display(new AIS_Shape(m_Shape));

So how can I display the shape with an interactive context using the Visual3d package? It can't be so difficult, but I didn't find anything withing the OCC documentation.

Thanks for your help!!!

Sven

Patrik Mueller's picture

Hi,

I'm not so sure if I this works, but I see 2 possibilities for still working with V3d and use your own mapping (I don't think it would be so easy displaying a shape directly in Visual3D):

1) V3d_View::View() gives you a handle to the Visual3d_View. With that handle you can use "SetViewMapping()" for your Visual3d_ViewMapping.

2) derive a class from V3d_View and add a method for getting MyViewMapping directly.

Perhaps this helps you,

Patrik

Sven Jungnickel's picture

Seems to be a good hint...and another undocumented Function. I think this will help, so I should get direct acces to the view mapping.

Thanks!

Sven

Patrik Mueller's picture

Never trust the documentation - most helps a look at the cdl files :-))))

Sven Jungnickel's picture

cdl files?!? What kind of files are these and where can I find them?

Patrik Mueller's picture

You'll find them in the "src" dirs from OCC. They are from the OCC WOK environment if I remember right.

Regards,

Patrik

Sven Jungnickel's picture

I tried it out and it worked. I'm now able to save and restore the ViewMapping and ViewOrientation. First get with V3d_View::View the Visual3d_View of the 3D Viewer and afterwards get/set ViewMapping/ViewOrientation with Visual3d_View::SetViewMapping, Visual3d_View::SetViewOrientation, Visual3d_View::ViewMapping, Visual3d_View::ViewOrientation.

Thanks a lot...

Sven

Patrik Mueller's picture

Good to hear...

Have a nice day,

Patrik

Stoltz's picture

Hi Sven !

I'm interested by your topic. I can't set the back and front planes properly using this :
Handle_Visual3d_View myVisual;
myVisual = myView->View();
Visual3d_ViewMapping viewmap();

Graphic3d_Vertex prp(X,Y,Z);
viewmap.SetProjection (Visual3d_TOP_PERSPECTIVE);
viewmap.SetProjectionReferencePoint(prp);
viewmap.SetFrontPlaneDistance(asceneex->m_Camera->m_dNearPlane);
viewmap.SetBackPlaneDistance (asceneex->m_Camera->m_dFarPlane);
viewmap.SetViewPlaneDistance (asceneex->m_Camera->m_dCameraPOS[2]);
myVisual->SetViewMapping(viewmap);

I can't see my objects clipped by the planes. Do I have something to do with the V3d_View to make the clipping work.
Maybe if you have a code in which you modify your clipping it would help me.

Thank you for your help!

Philippe.

Sven Jungnickel's picture

Hi Philippe,

to get the changes in you V3d_View you must use a trick.
append this to your code:

// Sets the default mapping
myVisual->SetViewMappingDefault();

// Transfers the mapping in your view
myView->Reset();

Should work.

Best regards,

Sven

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.