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

Multiply views

Dmitry's picture
Forums: 

I show the StepModel (3DShape) in two Views (V3d_View).
...
Handle(V3d_View) aView1 = aViewer->CreateView();
Handle(V3d_View) aView2 = aViewer->CreateView();
..
Handle(XCAFPrs_AISObject) aXCAFPrs_AISObject = new XCAFPrs_AISObject( aLabel );

aZAIS_InteractiveContext->DisplayShape(aXCAFPrs_AISObject);
..

The 3DShape's colors are defined in StepModel.
I would like to show colorized 3DShape in aView1. It's work.
I want to show the 3DShape with only one color in aView2.
How can I do it without to make two different Shapes ?

Thanks
Dmitry Khabi

Dmitry's picture

is mission impossible ??

Paul Jimenez's picture

Afraid so. It's like trying to show a different grid per view... no way.

Dmitry's picture

Thank you for your answer.
But I don't agree with your point of view ;).
I don't want to show different object. I want to show the same object. Only the surface colors should bedifferent.

I think, there is the way to show object with the texture in one view an the same object without texture in an other view . The question ist, can I show the simple AIS_Shape or XCAFPrs_AISObject with texture ? I need XCAFPrs_AISObject, because I use the colors from step file (in one view;).

Paul Jimenez's picture

Showing an object with a texture is possible... from what I've read and from the sample I ran. However, showing it with texture in one view and without texture in another view won't work as long as the views are connected to the same viewer. The problem is that the display mode is "centralized", so, if you change it through the AIS_InteractiveContext, it'll be displayed like that in all views associated with the viewer. Writing a new AIS_InteractiveObject won't work either because the presentation is computed once for all views.

Dmitry's picture

Thanks a lot.
It's realy good answer. I have to create two viewer with two objects.
Is it possible to make some "rules" to synchronize two different viewer's ? (for example by changing the location of one object ). probable not.
I hope I can return the favour some time. Wenn I know the stuff (OCC) better.

Paul Jimenez's picture

No way to synchronize them that I'm aware of. I also doubt there's one. You'll have to handle that yourself.

Bearloga's picture

Interactive object should be considered as a presentation of some shape. The same shape can have several presentations. But in order to show in different views different sets of objects you need to create different interactive contexts.
So, you create two interactive contexts, and bind each to its own view. In one context you create a multiple colored presentation of the shape, in another context you create a single colored presentation.
Hope this will help.

Dmitry's picture

It's very interesting
I have two ways->
1. Create two different Viewers (and two different interactive contexts) but One AIS_Shape Object.
I suppose, it's possible to show the same Interactive Object (XCAFPrs_AISObject) with colors in the first Viewer and without colors in the second viewer(for example with help of white texture and cyan light in the view)

In this case I have some kind of synchronisation:

The Operation on the first Interactive Context:

gp_Trsf aRotate;
aRotate.SetRotation(gp::OX(),theAngle);
itsInteractiveContext->SetLocation(aXCAFPrs_AISObject, aMove);
itsInteractiveContext->Update(aXCAFPrs_AISObject,1);

will rotate automatic the Object in the second interactive context.

2. Create one Viewer and two Interactive Contexts.
Question:
what is advantage and what is disadvantage ?

Paul Jimenez's picture

About way 1: I doubt the object will be automatically updated in the second Interactive Context. Just have in mind the way you display the object in each Interactive Context must be a different presentation mode (for example 0 in one for wireframe, and 1 in another one for shaded).

Way 2: Are you really sure you can connect 2 Interactive Contexts to 1 Viewer?

Way 1 should be the way to go, but you'll really have to test how good it works that way.

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.