[Paraview] Please help!! How to force Render() from a reader

Takuya OSHIMA oshima at eng.niigata-u.ac.jp
Wed Oct 14 05:51:11 EDT 2009


Hi Fabian,

From: Fabian Wein <fabian.wein at am.uni-erlangen.de>
Subject: Re: [Paraview] Please help!! How to force Render() from a reader
Date: Wed, 14 Oct 2009 10:26:09 +0200

> Hi Takuya,
> 
>> I am not sure what you mean by a thread (a client side code?),
>> but perhaps you can simply write
>> 
>>   pqApplicationCore::instance()->render();
> 
> This has no effect. Meanwhile I think this is because of the client/server
> structure.
> 
> Update within the reader forces RequestUpdateExtent and RequestData
> for the new time value - but it is not dispayed in the time GUI next
> to the
> VCR area.
> 
> A reader is a server part, isn't it? I guess I need also a gui part.

Perhaps you are right in that you need a gui (client) part.
(PV experts: correct me if I am wrong)

> 
> Is there a complete code example anywhere?

Here is what I have in the gui (client) part for the "pesudo" live
updating of my time-aware reader (I am using a QTimer for periodically
polling a running case in a simple way). It's sort of brutal
implementation though.

If you are intersted in the full version, have a look at
http://openfoamwiki.net/index.php/Contrib_Parallelized_Native_OpenFOAM_Reader_for_ParaView

  // only update pipeline information (RequestInformation())
  this->Sp->GetProperty("Refresh")->Modified();
  this->Sp->UpdatePipelineInformation();
  this->Sp->UpdatePropertyInformation(); // explicitly pull the property informa
tion

  // get the last timestep
  vtkSMDoubleVectorProperty *tsv
      = vtkSMDoubleVectorProperty::SafeDownCast(this->Sp->GetProperty("TimestepV
alues"));
  if(tsv->GetNumberOfElements() > 0)
    {
    const double lastStep = tsv->GetElement(tsv->GetNumberOfElements() - 1);
    pqApplicationCore *app = pqApplicationCore::instance();

    // set animation time to the last timestep
    QList<pqAnimationScene*> scenes
        = app->getServerManagerModel()->findItems<pqAnimationScene *>();
    foreach (pqAnimationScene *scene, scenes)
      {
      scene->setAnimationTime(lastStep);
      }

    if(this->Rescale->isChecked())
      {
      // rescale
      QList<pqPipelineRepresentation*> pipes
          = app->getServerManagerModel()->findItems<pqPipelineRepresentation *>(
);
      foreach (pqPipelineRepresentation *pipe, pipes)
        {
        pipe->resetLookupTableScalarRange();
        }
      app->render();
      }
    }

Regards,
Takuya

Takuya OSHIMA, Ph.D.
Faculty of Engineering, Niigata University
8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN


More information about the ParaView mailing list