[prev in list] [next in list] [prev in thread] [next in thread] 

List:       paraview
Subject:    [Paraview] ParaView python script - save pipeline data
From:       "Su, Simon M CTR USARMY ARL (US)" <simon.m.su.ctr () mail ! mil>
Date:       2014-04-29 17:52:42
Message-ID: F02E4EC9F4B4BA4189BBDC8BF3B2AD820ECD990D () umechp9h ! easf ! csd ! disa ! mil
[Download RAW message or body]

hello,

How do you write the output of the extract CTH parts filter to either pvd or vtk file \
format using python script? Using the PV GUI, the menu option save geometry will save \
the output to pvd formatted files.

I am using ParaView-4.1.0 on RHEL 5- 64bit (and RHEL 6 64bit). If I open PV and \
source a box, and then open up the Python Shell and to the following


> > > from paraview.simple import *

> > > writer=CreateWriter("/home/simonsm/filename.vtk")

> > > writer.UpdatePipeline()

> > > 

it will create the filename.vtk file with the box in it.

However, in PV, using the GUI to load a CTH file and then apply the extract cth parts \
filters, and the do the following in the Python Shell,


> > > from paraview.simple import *

> > > writer=CreateWriter("/home/simonsm/filename.vtk")

> > > writer.UpdatePipeline()

> > > 


I got the following


ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/ParaViewCore/ServerManager/Core/vtkSMWriterFactory.cxx, \
line 314

vtkSMWriterFactory (0x17ea2200): No matching writer found for extension: vtk


The same if I run the following script via pvpython (python script at the bottom of \
this email). It will create the image.png file but not filename.vtk file.

[bash]$ pvpython cth-trial1.py
ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/ParaViewCore/ServerManager/Core/vtkSMWriterFactory.cxx, \
line 314 vtkSMWriterFactory (0xab5acb0): No matching writer found for extension: vtk

Traceback (most recent call last):
  File "cth-trial1.py", line 47, in <module>
    writer.UpdatePipeline()
AttributeError: 'NoneType' object has no attribute 'UpdatePipeline'



============ python script cth-trial1.py ===========
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

spcth_0 = SpyPlotReader( FileName='spcth.0' )

AnimationScene1 = GetAnimationScene()
AnimationScene1.EndTime = 3.000620618747355e-05
AnimationScene1.PlayMode = 'Snap To TimeSteps'

spcth_0.CellArrays = ['Material volume fraction - 1']

RenderView1 = GetRenderView()
RenderView1.CenterOfRotation = [-2.44791666418314, -1.453125, 0.0]

DataRepresentation1 = Show()
DataRepresentation1.Representation = 'Outline'
DataRepresentation1.ScaleFactor = 0.6000000000000001
DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]
DataRepresentation1.SelectionCellFieldDataArrayName = 'Material volume fraction - 1'

RenderView1.CameraPosition = [-2.44791666418314, -1.453125, 16.349424601301106]
RenderView1.CameraFocalPoint = [-2.44791666418314, -1.453125, 0.0]
RenderView1.CameraClippingRange = [10.215930355288094, 24.10966597032062]
RenderView1.CameraParallelScale = 4.231542463284413

ExtractCTHParts1 = ExtractCTHParts( ClipType="None" )

ExtractCTHParts1.ClipType = "None"
ExtractCTHParts1.VolumeArrays = ['Material volume fraction - 1']

DataRepresentation2 = Show()
DataRepresentation2.ScaleFactor = 0.10245815515518189
DataRepresentation2.SelectionPointFieldDataArrayName = 'Part Index'
DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483]
DataRepresentation2.SelectionCellFieldDataArrayName = 'Material volume fraction - 1'

DataRepresentation1.Visibility = 0

RenderView1.CameraClippingRange = [11.161534331537789, 23.636863982195774]

AnimationScene1.AnimationTime = 3.000620618747355e-05

Render()
WriteImage("image.png")
writer= CreateWriter("filename.vtk")
writer.UpdatePipeline()
=============================== end script =======================================

thank you
-simon


[Attachment #3 (text/html)]

<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: \
10pt;">hello,<br> <br>
How do you write the output of the extract CTH parts filter to either pvd or vtk file \
format using python script? Using the PV GUI, the menu option save geometry will save \
the output to pvd formatted files. <br>
<br>
I am using ParaView-4.1.0 on RHEL 5- 64bit (and RHEL 6 64bit). If I open PV and \
source a box, and then open up the Python Shell and to the following<br> <br>
<style type="text/css">
p, li { white-space: pre-wrap; }
</style><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Courier'; \
font-size:9pt; color:#000000;">&gt;&gt;&gt; </span><span style=" \
font-family:'Courier'; font-size:9pt; color:#000096;">from paraview.simple import \
*</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <span style=" \
font-family:'Courier'; font-size:9pt; color:#000000;">&gt;&gt;&gt; \
writer=CreateWriter(&quot;/home/simonsm/filename.vtk&quot;)</span></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Courier'; \
font-size:9pt; color:#000000;">&gt;&gt;&gt; writer.UpdatePipeline()</span></p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Courier'; \
font-size:9pt; color:#000000;">&gt;&gt;&gt; </span></p> <br>
it will create the filename.vtk file with the box in it.<br>
<br>
However, in PV, using the GUI to load a CTH file and then apply the extract cth parts \
filters, and the do the following in the Python Shell, <br>
<br>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Courier'; \
font-size:9pt; color:#000000;">&gt;&gt;&gt; </span><span style=" \
font-family:'Courier'; font-size:9pt; color:#000096;">from paraview.simple import \
*</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <span style=" \
font-family:'Courier'; font-size:9pt; color:#000000;">&gt;&gt;&gt; \
writer=CreateWriter(&quot;/home/simonsm/filename.vtk&quot;)</span></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Courier'; \
font-size:9pt; color:#000000;">&gt;&gt;&gt; writer.UpdatePipeline()</span></p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Courier'; \
font-size:9pt; color:#000000;">&gt;&gt;&gt; <br> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <br>
<span style=" font-family:'Courier'; font-size:9pt; color:#000000;"></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Courier'; \
font-size:9pt; color:#000000;">I got the following</span><br> </p>
<br>
<style type="text/css">
p, li { white-space: pre-wrap; }
BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-dar \
kshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}BODY \
{scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshad \
ow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}</style>
 <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Courier'; \
font-size:9pt; color:#800000;">ERROR: In \
/home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/ParaViewCore/ServerManager/Core/vtkSMWriterFactory.cxx, \
line 314</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <span style=" \
font-family:'Courier'; font-size:9pt; color:#800000;">vtkSMWriterFactory \
(0x17ea2200): No matching writer found for extension: vtk</span></p> <br>
<br>
The same if I run the following script via pvpython (python script at the bottom of \
this email). It will create the image.png file but not filename.vtk file.<br> <br>
[bash]$ pvpython cth-trial1.py <br>
ERROR: In /home/utkarsh/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/ParaViewCore/ServerManager/Core/vtkSMWriterFactory.cxx, \
line 314<br> vtkSMWriterFactory (0xab5acb0): No matching writer found for extension: \
vtk<br> <br>
Traceback (most recent call last):<br>
&nbsp; File &quot;cth-trial1.py&quot;, line 47, in &lt;module&gt;<br>
&nbsp;&nbsp;&nbsp; writer.UpdatePipeline()<br>
AttributeError: 'NoneType' object has no attribute 'UpdatePipeline'<br>
<br>
<br>
<br>
============ python script cth-trial1.py ===========<br>
try: paraview.simple<br>
except: from paraview.simple import *<br>
paraview.simple._DisableFirstRenderCameraReset()<br>
<br>
spcth_0 = SpyPlotReader( FileName='spcth.0' )<br>
<br>
AnimationScene1 = GetAnimationScene()<br>
AnimationScene1.EndTime = 3.000620618747355e-05<br>
AnimationScene1.PlayMode = 'Snap To TimeSteps'<br>
<br>
spcth_0.CellArrays = ['Material volume fraction - 1']<br>
<br>
RenderView1 = GetRenderView()<br>
RenderView1.CenterOfRotation = [-2.44791666418314, -1.453125, 0.0]<br>
<br>
DataRepresentation1 = Show()<br>
DataRepresentation1.Representation = 'Outline'<br>
DataRepresentation1.ScaleFactor = 0.6000000000000001<br>
DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483]<br>
DataRepresentation1.SelectionCellFieldDataArrayName = 'Material volume fraction - \
1'<br> <br>
RenderView1.CameraPosition = [-2.44791666418314, -1.453125, 16.349424601301106]<br>
RenderView1.CameraFocalPoint = [-2.44791666418314, -1.453125, 0.0]<br>
RenderView1.CameraClippingRange = [10.215930355288094, 24.10966597032062]<br>
RenderView1.CameraParallelScale = 4.231542463284413<br>
<br>
ExtractCTHParts1 = ExtractCTHParts( ClipType=&quot;None&quot; )<br>
<br>
ExtractCTHParts1.ClipType = &quot;None&quot;<br>
ExtractCTHParts1.VolumeArrays = ['Material volume fraction - 1']<br>
<br>
DataRepresentation2 = Show()<br>
DataRepresentation2.ScaleFactor = 0.10245815515518189<br>
DataRepresentation2.SelectionPointFieldDataArrayName = 'Part Index'<br>
DataRepresentation2.EdgeColor = [0.0, 0.0, 0.5000076295109483]<br>
DataRepresentation2.SelectionCellFieldDataArrayName = 'Material volume fraction - \
1'<br> <br>
DataRepresentation1.Visibility = 0<br>
<br>
RenderView1.CameraClippingRange = [11.161534331537789, 23.636863982195774]<br>
<br>
AnimationScene1.AnimationTime = 3.000620618747355e-05<br>
<br>
Render()<br>
WriteImage(&quot;image.png&quot;)<br>
writer= CreateWriter(&quot;filename.vtk&quot;)<br>
writer.UpdatePipeline()<br>
=============================== end script \
=======================================<br> <br>
thank you<br>
-simon<br>
</div>
</body>
</html>



_______________________________________________
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

--===============0827340692==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic