[Paraview] Get name of object in Pipeline Browser

Takuya OSHIMA oshima at eng.niigata-u.ac.jp
Thu Aug 18 07:23:16 EDT 2011


Hi Lars,

> But where and when do I have to call that code? Because at the moment my plugin is executed by clicking on "File / Export" in ParaView, so I don't have any GUI related code. Everything is on the VTK side.

Just a faint idea that happened to come to me is to create an
autostart plugin and hook any one of ***Created() signals of
pqOjbectBuilder
http://www.paraview.org/ParaView3/Doc/Nightly/html/classpqObjectBuilder.html
that is considered suitable to detect creation of your exporter and
if detected send the strings to the server-side exporter object.

I have never tried myself so am totally unsure if it at all works, may
be totally wrong.

Takuya

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

From: Lars Bilke <lars.bilke at ufz.de>
Subject: Re: [Paraview] Get name of object in Pipeline Browser
Date: Thu, 18 Aug 2011 12:52:48 +0200

> Dear John,
> 
> thanks for your explanations. I roughly got an idea but I have a few questions:
>>  
>> class vtkMyExporter ..... {
>>  
>> the usual vtkSetGetStuff and all the write, update, etc
>>  
>>  void SetMyNameString(const char *) // for a single dataset/actor
>>  void SetMyNameStringList(const char **) // for a list of items
>> };
>>  
>>  
>>  
> 
> This is clear.  
>> this gets wrapped by client server etc etc
>>  
>> In the GUI, you could query the name from the pqXXX stuff, I have  a similar snippet that does this
>>  
>> pqPipelineSource *source = *it;
>>  
>>  
>>  
>>  
> 
> I assume I can get *it like this:
> 
> QList<pqPipelineSource*> sources_and_filters =
> pqApplicationCore::instance()->getServerManagerModel()->findItems<pqPipelineSource*>();  
> 
> But where and when do I have to call that code? Because at the moment my plugin is executed by clicking on "File / Export" in ParaView, so I don't have any GUI related code. Everything is on the VTK side.
>>  
>>  
>>  
>>  
>> std::string  xmlName = source->getProxy()->GetXMLName();
>>  
>> now you want the name, not the XML name, so use that
>> but now you can  
>>  
>> vtkSMPropertyHelper modified(source->getProxy(), "MyNameString");
>>  
>>  
>> modified.Set(xmlName.c_str()); // or something like that
>>  
>>  
>>  
>>  
> 
> This sets the name on the proxy.  
>>  
>>  
>>  
>>  
>> then you need to push your string into the VTK class using something like
>>  
>>  
>> source->getProxy()->UpdateVTKObjects()
>>  
>>  
>> or UpdatePipeline (I forget the correct calls)
>>  
>>  
>>  
>>  
> 
> But what is that doing?  
>>  
>>  
>>  
>> and because your custom SetMyNameString doesn’t trigger a modified in the pipeline, you can carry on with doing the write, but the exporter has the string passed in from he GUI just before it writes. You can pass a string list if you want and make sure the order matches the order of writes so the names match.
>>  
>>  
>>  
> 
> I dont understand how the name actually gets to my exporter. And because a list of names is more general I would only pass this list to my exporter and not a single name.
> 
> 
> See vtkOpenSGExporter.h / .cxx on Github:  
> https://github.com/bilke/pv_opensg_plugin
> 
> 
> Thank you very much for your help!!
> Lars.
>> From: Lars Bilke [mailto:lars.bilke at ufz.de]  
>> Sent: 18 August 2011 09:14
>> To: Biddiscombe, John A.
>> Cc: Utkarsh Ayachit; ParaView Mailliste
>> Subject: Re: [Paraview] Get name of object in Pipeline Browser  
>>  
>> Thanks for your answers!  
>>  
>>  
>>  
>> John,
>>  
>> where on the gui-side do I need to pass that string? Do I need to modify the ParaView sources? Because I only want to write a plugin which should be redistributable to colleagues which have only the ParaView binaries installed.
>>  
>> And your suggestion assumes that I only want to export one actor right? What I want is to export all actors in one step.
>>  
>>  
>>  
>> Lars
>>  
>>  
>> Am Mittwoch, 17. August 2011 um 15:45 schrieb Biddiscombe, John A.:
>> > It'd probably be easier to add a method to the vtk-exporter class which accepts a string, and from the gui, pass the string in just before export - because you can get it the proxy name from the gui end. Make sure the SetProxyName(char*...) method doesn't call Modified. (ie don't use SetStringMacro)
>> >  
>> >  JB
>> >  
>> >  -----Original Message-----
>> >  From: paraview-bounces at paraview.org (mailto:paraview-bounces at paraview.org) [mailto:paraview-bounces at paraview.org] On Behalf Of Utkarsh Ayachit
>> >  Sent: 17 August 2011 15:16
>> >  To: Lars Bilke
>> >  Cc: ParaView Mailliste
>> >  Subject: Re: [Paraview] Get name of object in Pipeline Browser
>> >  
>> >  It's not possible, not from a simple exporter plugin.The exporter
>> >  lives entirely in the VTK world without any knowledge of proxies. A
>> >  unconventional approach would be explicitly make the exporter plugin
>> >  link agains the pqCore library, then you can access the
>> >  pqApplicationCore and other singletons (like ProxyManager) and get
>> >  information about what sources are present and what their names are
>> >  (this is acceptable since exporter work entirely on the client-side).
>> >  It is still, however, non trivial to determine which actor corresponds
>> >  to what source proxy.
>> >  
>> >  
>> >  
>> >  On Wed, Aug 17, 2011 at 3:40 AM, Lars Bilke <lars.bilke at ufz.de (mailto:lars.bilke at ufz.de)> wrote:
>> >  
>> > Dear ParaView users,
>> >  is it possible to programmatically get the name of an object in the Pipeline
>> >  Browser? To be more specific I need to get this name from a vtkActor. I am
>> >  writing a exporter plugin
>> >  (see http://www.mail-archive.com/paraview@paraview.org/msg12939.html) and
>> >  want to name my objects in the exported file.
>> >  Thanks for your help,
>> >  Lars.
>> >  
>> >  
>> >  _______________________________________________
>> >  Powered by www.kitware.com (http://www.kitware.com)
>> >  
>> >  Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >  
>> >  Please keep messages on-topic and check the ParaView Wiki at:
>> > http://paraview.org/Wiki/ParaView
>> >  
>> >  Follow this link to subscribe/unsubscribe:
>> > http://www.paraview.org/mailman/listinfo/paraview  
>> > _______________________________________________
>> >  Powered by www.kitware.com (http://www.kitware.com)
>> >  
>> >  Visit other Kitware open-source projects at  http://www.kitware.com/opensource/opensource.html
>> >  
>> >  Please keep messages on-topic and check the ParaView Wiki at:  http://paraview.org/Wiki/ParaView
>> >  
>> >  Follow this link to subscribe/unsubscribe:
>> > http://www.paraview.org/mailman/listinfo/paraview  
>>  
>>  
>>  
>>  
>>  
> 
> 


More information about the ParaView mailing list