<div dir="ltr">Claudio,<br><div><br></div><div>Attached is an example script with a demo vtu file used for it.</div><div><br></div><div>Hope that helps.</div><div><br></div><div>Utkarsh</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 23, 2017 at 8:55 AM, Ing. Claudio Pascarelli <span dir="ltr"><<a href="mailto:claudio.pascarelli@unisalento.it" target="_blank">claudio.pascarelli@unisalento.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_68075342142416384divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p><span style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt">Hi,</span><br>
</p>
<div style="color:rgb(0,0,0)">
<div>
<div id="m_68075342142416384divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif">
<p>these are the first times that I'm using Paraview and <span>Python.</span></p>
<p><span><br>
</span></p>
<p><span>I would like to create a script that:</span></p>
<p><span><br>
</span></p>
<p><span>1 - Read the number and name of properties (variables/contour plot) that I have in my .vtu file (for instance TEMPERATURE and TH_FLUX)</span></p>
<p><span>2 - Export every contour plot (Export Scenes) in vrml format, looping among them (like a "for" cycle), with the right name (for instance VtuName_TEMPERATURE.vrml and <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px">VtuName_TH_FLUX.vrml)</span></span></p>
<p><span><br>
</span></p>
<p><span>A priori I do not know how many and which are these properties so I think that I need first lo list them in some way.</span></p>
<p><span><br>
</span></p>
<p><span>If I record a trace this is what I obtain</span></p>
<p><span><br>
</span></p>
<p><span style="font-size:12pt">******************************<wbr>******************************<wbr>***************</span><br>
</p>
<p><span style="font-size:12pt"></span></p>
<div>#### import the simple module from the paraview</div>
<div>from paraview.simple import *</div>
<div>#### disable automatic camera reset on 'Show'</div>
<div>paraview.simple._<wbr>DisableFirstRenderCameraReset(<wbr>)</div>
<div><br>
</div>
<div># get active source.</div>
<div>valvola_XXX_termicovtu = GetActiveSource()</div>
<div><br>
</div>
<div># get active view</div>
<div>renderView1 = GetActiveViewOrCreate('<wbr>RenderView')</div>
<div># uncomment following to set a specific view size</div>
<div># renderView1.ViewSize = [763, 502]</div>
<div><br>
</div>
<div># get display properties</div>
<div>valvola_XXX_termicovtuDisplay = GetDisplayProperties(valvola_<wbr>XXX_termicovtu, view=renderView1)</div>
<div><br>
</div>
<div># set scalar coloring</div>
<div>ColorBy(valvola_XXX_<wbr>termicovtuDisplay, ('POINTS', 'TEMP'))</div>
<div><br>
</div>
<div># rescale color and/or opacity maps used to include current data range</div>
<div>valvola_XXX_termicovtuDisplay.<wbr>RescaleTransferFunctionToDataR<wbr>ange(True, False)</div>
<div><br>
</div>
<div># show color bar/color legend</div>
<div>valvola_XXX_termicovtuDisplay.<wbr>SetScalarBarVisibility(<wbr>renderView1, True)</div>
<div><br>
</div>
<div># get color transfer function/color map for 'TEMP'</div>
<div>tEMPLUT = GetColorTransferFunction('<wbr>TEMP')</div>
<div><br>
</div>
<div># export view</div>
<div>ExportView('C:/Users/User/<wbr>Desktop/TEMP.vrml', view=renderView1)</div>
<div><br>
</div>
<div># set scalar coloring</div>
<div>ColorBy(valvola_XXX_<wbr>termicovtuDisplay, ('POINTS', 'TH_FLUX', 'Magnitude'))</div>
<div><br>
</div>
<div># Hide the scalar bar for this color map if no visible data is colored by it.</div>
<div>HideScalarBarIfNotNeeded(<wbr>tEMPLUT, renderView1)</div>
<div><br>
</div>
<div># rescale color and/or opacity maps used to include current data range</div>
<div>valvola_XXX_termicovtuDisplay.<wbr>RescaleTransferFunctionToDataR<wbr>ange(True, False)</div>
<div><br>
</div>
<div># show color bar/color legend</div>
<div>valvola_XXX_termicovtuDisplay.<wbr>SetScalarBarVisibility(<wbr>renderView1, True)</div>
<div><br>
</div>
<div># get color transfer function/color map for 'TH_FLUX'</div>
<div>tH_FLUXLUT = GetColorTransferFunction('TH_<wbr>FLUX')</div>
<div><br>
</div>
<div># export view</div>
<div>ExportView('C:/Users/User/<wbr>Desktop/TH_FLUX.vrml', view=renderView1)</div>
<div><br>
</div>
<div>#### saving camera placements for all active views</div>
<div><br>
</div>
<div># current camera placement for renderView1</div>
<div>renderView1.CameraPosition = [-0.09199999999789327, 0.0665, 0.7345691646101393]</div>
<div>renderView1.CameraFocalPoint = [-0.09199999999789327, 0.0665, -0.05375]</div>
<div>renderView1.<wbr>CameraParallelScale = 0.2040320134204131</div>
<div><br>
</div>
<div>#### uncomment the following to render all views</div>
<div># RenderAllViews()</div>
<div># alternatively, if you want to write images, you can use SaveScreenshot(...).</div>
<br>
<p></p>
<p>******************************<wbr>*************************</p>
<p><span><br>
</span></p>
<p><span>Thank you!!!!</span></p><span class="HOEnZb"><font color="#888888">
<p><span><br>
</span></p>
<p><span>Claudio Pascarelli</span></p>
<p><span><br>
</span></p>
<p><span><br>
</span></p>
</font></span></div>
</div>
</div>
</div>
</div>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/paraview</a><br>
<br></blockquote></div><br></div>