Difference between revisions of "ParaView/Automation with Python"

From PHASTA Wiki
Jump to: navigation, search
Line 1: Line 1:
 
1. Extract surface using paraview, the code will look like  
 
1. Extract surface using paraview, the code will look like  
  
<nowiki>from paraview.simple import *
+
from paraview.simple import *
  
#========== read in data file
+
<nowiki>#========== read in data file</nowiki>
  
 
print 'Read phasta file'
 
print 'Read phasta file'
  
dataObj = PhastaReader( FileName= 'restart_one.pht' )  # you have to change the name of this pht file
+
<nowiki>dataObj = PhastaReader( FileName= 'restart_one.pht' )  # you have to change the name of this pht file</nowiki>
  
 
SRF = ExtractSurface(Input=dataObj)
 
SRF = ExtractSurface(Input=dataObj)
Line 13: Line 13:
 
MGBLK1 = MergeBlocks(Input=SRF)
 
MGBLK1 = MergeBlocks(Input=SRF)
  
vtkWriter = DataSetWriter(FileName = 'Surface.vtk' , Input = MGBLK1, FileType = 1) # you have to change the name of this vtk file
+
<nowiki>vtkWriter = DataSetWriter(FileName = 'Surface.vtk' , Input = MGBLK1, FileType = 1) # you have to change the name of this vtk file</nowiki>
  
 
vtkWriter.UpdatePipeline()
 
vtkWriter.UpdatePipeline()
Line 20: Line 20:
 
Get the python file from  
 
Get the python file from  
  
/users/ychen/NGC/geometry2012/pvExtractSuface.py</nowiki>
+
/users/ychen/NGC/geometry2012/pvExtractSuface.py

Revision as of 15:20, 26 July 2012

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