Do I need an AIS_InteractiveContext per Viewer (window)

karim

CAD community veteran
I wonder if I need a context for each viewer ? can viewers share the context ? My windows show different views of single physical object. Can I somehow pass them a single context ?
I.E.
When I create my windows, a context is created. Do I need a seperate context for each window ? I have attached a picture of my application. Two views of the same geometric object is shown. Can I use a single context for all the vindows ?

myViewer = new V3d_Viewer(GetGraphicDriver());
myView = myViewer->CreateView();

myView->SetWindow(wind);
if (!wind->IsMapped()) wind->Map();

// Create AISInteractiveContext
myContext = new AIS_InteractiveContext(myViewer);


Also as each window has its own context, when a selection is done in one window, the other windows does not reflect the selection. So do I manage that manually as well or share the same context between widows somehow.
 

Attachments

  • two-Windows.png
    two-Windows.png
    49.8 KB · Views: 7
Last edited:

natalia

Moderator
Staff member
Hi @karim

The relation between AIS_InteractiveContext and V3d_Viewer is 1:1. So, the viewer do not assume sharing several contexts. Here, there might be many V3d_View instances created. It allows to investigate the same model in different camera positions. Selection will be shared between these views as it’s stored in the context.

For your task, you should create:
  • one instance of AIS_InteractiveContext,
  • one instance of V3d_Viewer,
  • so many instances of V3d_View as you need.

Regards, Natalia
 

karim

CAD community veteran
Hi @karim

The relation between AIS_InteractiveContext and V3d_Viewer is 1:1. So, the viewer do not assume sharing several contexts. Here, there might be many V3d_View instances created. It allows to investigate the same model in different camera positions. Selection will be shared between these views as it’s stored in the context.

For your task, you should create:
  • one instance of AIS_InteractiveContext,
  • one instance of V3d_Viewer,
  • so many instances of V3d_View as you need.

Regards, Natalia
I took the "roads less travelled" and experimented with the ASI_interactiveContext. What you said is absolutely correct. However, I may need extruded view of my FEM model in one view and a wireframe view in another. So I decided I better have one context for one view for the time being. (for the time being)
 
Top