Changes to TPrsStd_AISPresentation ???

Hi !

With the PR2 release I had some code that created a sphere, added it to a label and displayed it, this code no longer compiles. The code looked like this: (parent is the label)

BRepPrimAPI_MakeSphere S( gp_Pnt(0,0,0), 200.0); TNaming_Builder bld( parent); bld.Generated( S);

Handle(TPrsStd_AISPresentation) pres = new TPrsStd_AISPresentation();

/* ** Drivers and presentation */

TPrsStd_DriverTable drivers; TPrsStd_DriverTable::Get()->InitStandardDrivers(); pres->Set( parent, TNaming_NamedShape::GetID()); pres->Display( true); TPrsStd_AISPresentation::Display( parent, true);

The last line was needed to display the sphere in the view, this method is no longer available, I have added a pres->Display( true), but that does not help anything.

How do I display an object added as an attribute to an OCAF document with the latest release ?


Sergey RUIN's picture

Hi Mikael!

You are right, there are some changes in TPrsStd_AISPresentation class.

First of all, there are no static methods in that class except Set/Unset

Concerning method Display. For optimization reason all methods AISPresentation don't repaint viewer , so you need do that explicitly.

Here is a short example:

Imaging you have a label tree with TPrsStd_AISPresentation attributes set in this tree. To display the tree in viewer you need something like that:

Handle(TDF_Data) DF = new TDF_Data;

// ... Filling DF with some data

TDF_Label Root = DF->Root();

TDF_ChildIterator Itr(Root);

Handle(TPrsStd_AISPresentation) AP;

for( ; Itr.Next(); Itr.More() ) {

if( (Itr.Value).FindAttribute( TPrsStd_AISPresentation::GetID(), AP ) ) AP->Display();


//Updating of TPrsStd_AISViewer


Best regards