Difference between revisions of "ParaView/Automation with Python"

From PHASTA Wiki
Jump to: navigation, search
Line 16: Line 16:
 
<code>/users/ychen/NGC/geometry2012/pvExtractSuface.py</code>
 
<code>/users/ychen/NGC/geometry2012/pvExtractSuface.py</code>
 
[[Category:Paraview]]  [[Category:Post-processing]]
 
[[Category:Paraview]]  [[Category:Post-processing]]
 +
 +
 +
 +
==Generating Python Scripts for Data Extraction==
 +
 +
which is documented [https://fluid.colorado.edu/tutorials/Paraview_Data_Extraction_Automation_1.mp4 here].

Revision as of 14:18, 16 February 2021

1. Extract surface using paraview, the code will look like

from paraview.simple import *

#========== read in data file
print 'Read phasta file'
dataObj = PhastaReader( FileName= 'restart_one.pht' )  # you have to change the name of this pht file
SRF = ExtractSurface(Input=dataObj)
MGBLK1 = MergeBlocks(Input=SRF)
vtkWriter = DataSetWriter(FileName = 'Surface.vtk' , Input = MGBLK1, FileType = 1) # you have to change the name of this vtk file
vtkWriter.UpdatePipeline()

Get the python file from

/users/ychen/NGC/geometry2012/pvExtractSuface.py


Generating Python Scripts for Data Extraction

which is documented here.