Display of a shaded object into a local AIS context

Hi,

I have a problem with displaying a shaded object defined into a local context. For instance, the following code, where m is an Handle(AIS_InteractiveContext), doesn't work :
m->openLocalContext();
Handle(AIS_Shape)s=new AIS_Shape( .. a topoDS_Shape ..);
m->Display(s);
m->SetColor(s,Quantity_NOC_REC);
m->SetDisplayMode(s,AIS_Shaded);

As a result, my local context is opened with a wireframe representation of s. The same example in the Neutral Point provide the expected result.

I Hope someone could help me.

Franck

Hugues's picture

I met the same problem. As you have opened a local context, you should use the second overload of AIS_InteractiveContext::Display, i.e. :
void Display
(const Handle(AIS_InteractiveObject)& anIobj,
const Standard_Integer amode,
const Standard_Integer aSelectionMode,
const Standard_Boolean
updateviewer = Standard_True,
const Standard_Boolean
allowdecomposition = Standard_True);

Giving AIS_Shaded to the second argument 'amode'.
Be sure to use the "local context" oriented routines of AIS_InteractiveContext (some can be used only in neutral point, other only in local context, other in both).

By now I'm facing problems with managing the selection of items in local contexts.

Anyway, hope this helps.

franck ledoux's picture

thanks a lot, it works with instanciating the second and third arguments.

I can\'t help you, I have no idea about managing the selection of items in local contexts.