[Paraview] dynamic variable names in pvython

Timothy Cale drtsc.para at gmail.com
Sun May 5 12:50:20 EDT 2013


Pat:

Thanks. Makes sense, though complicated (for me).

Being new to python, pvpython and vtk, I used the append attribute of lists.

Do you see a problem with that idea, as shown below? It works, but that is
not always the end of the story.
(num is the read number of vtu files to be processed):

files[]
reader[]
rep[]
. . .
i=0
while i<num
. . .
   files.append('results/layer_'+str(i+1)+'.vtu')
   reader.append(XMLUnstructuredGridReader(FileName=files[i]))
   rep.append(Show())
   Render()
   i=i+1


Thanks,
Ti


On Sun, May 5, 2013 at 2:35 AM, Pat Marion <pat.marion at kitware.com> wrote:

> Hi Tim,
>
> Variable names in trace are generated by this function defined in
> smtrace.py:
>
>
> def pyvariable_from_proxy_name(proxy_name):
>   return servermanager._make_name_valid(proxy_name.replace(".", "_"))
>
>
> That function will generate a suitable variable name from a proxy name.  A
> proxy is registered with a name in a proxy group.  smtrace.py also defines
> some functions to lookup the proxy name given a proxy and a proxy group.
> For example:
>
>
> >>> from paraview import smtrace
> >>> s = Sphere()
> >>> smtrace.get_source_proxy_registration_name(s)
> 'Sphere1'
>
> >>> smtrace.pyvariable_from_proxy_name('Sphere1')
> 'Sphere1'
>
> >>> help(smtrace.get_source_proxy_registration_name)
> Help on function get_source_proxy_registration_name in module
> paraview.smtrace:
>
> get_source_proxy_registration_name(proxy)
> Assuming the given proxy is registered in the group 'sources',
> lookup the proxy's registration name with the servermanager
>
>
> >>> help(smtrace.get_view_proxy_registration_name)
> Help on function get_view_proxy_registration_name in module
> paraview.smtrace:
>
> get_view_proxy_registration_name(proxy)
> Assuming the given proxy is registered in the group 'views',
> lookup the proxy's registration name with the servermanager
>
>
> Pat
>
>
> On Sun, May 5, 2013 at 3:01 AM, Timothy Cale <drtsc.para at gmail.com> wrote:
>
>> I use paraview to visualize the results of simulations.
>>
>> I use Trace in the paraview gui, in order to use the generated scripts to
>> help guide
>> the development of the pypython script I use to visualize my simulation
>> results.
>>
>> I would like to use dynamic variable names, and note that the scripts
>> generated
>> by Trace seem to use dynamic variable names.
>>
>> Aside: The driver for this is that the number of meshes I want to display
>> differs
>> with each simulation.
>>
>> I have looked over python posts on dynamic variable names . . .
>>
>> Question: How are the (seemingly) dynamic variable names created
>> in/by/during
>> Trace?
>>
>> Regards,
>> Tim
>>
>> PS: Linux
>>
>> _______________________________________________
>> Powered by 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130505/c2778d5b/attachment.htm>


More information about the ParaView mailing list