本文整理汇总了Python中vtk.vtkGenericEnSightReader函数的典型用法代码示例。如果您正苦于以下问题:Python vtkGenericEnSightReader函数的具体用法?Python vtkGenericEnSightReader怎么用?Python vtkGenericEnSightReader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkGenericEnSightReader函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_reader
def create_reader (self):
"Create the corresponding reader."
debug ("In VtkEnSightReader::create_reader ()")
# set up the reader
if self.file_name == "":
raise IOError, "No filename specifed for the data handler!"
self.reader = vtk.vtkGenericEnSightReader()
示例2: __init__
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkGenericEnSightReader(), 'Reading vtkGenericEnSight.',
(), ('vtkGenericEnSight',),
replaceDoc=True,
inputFunctions=None, outputFunctions=None)
示例3: readData
def readData(self, ntime = -1.):
"""
Return the mesh vtkDataSet with the associated scalars for a single time step.
"""
p = os.path.abspath(self.opt.f_name)
path, case = os.path.dirname(p), os.path.basename(p)
ens = vtk.vtkGenericEnSightReader()
ens.SetByteOrderToLittleEndian()
ens.SetFilePath(path)
ens.SetCaseFileName(case)
ens.ReadAllVariablesOn()
ens.Update()
times = ens.GetTimeSets().GetItem(0)
# last result by default
if ntime == -1.:
ntime = times.GetSize() - 1
ens.SetTimeValue(times.GetTuple1(ntime))
ens.Update()
return ens.GetOutput().GetBlock(0) # Now multiblock objet with 0 for volume, 1 for bord !
示例4: readEnsightFile
def readEnsightFile(self, fileName):
"""
Read Ensight file. Writes a VTK file with fileName+'.vtk'.
:param str filename: Input filename
"""
#read the ensight file
reader = vtk.vtkGenericEnSightReader()
reader.SetCaseFileName(fileName)
reader.Update()
output = reader.GetOutput()
num_blocks = output.GetNumberOfBlocks()
#blocks_unstructured is a list of objects of vtkUnstructuredGrid
blocks_unstructured = []
for i in range(num_blocks):
blocks_unstructured.append(output.GetBlock(i))
appendFilter = vtk.vtkAppendFilter()
i = 0
while i < len(blocks_unstructured):
if(vtk.VTK_MAJOR_VERSION <= 5):
appendFilter.AddInput(blocks_unstructured[i])
else:
appendFilter.AddInputData(blocks_unstructured[i])
i=i+1
appendFilter.Update();
unstructuredGrid=vtk.vtkUnstructuredGrid()
unstructuredGrid.ShallowCopy(appendFilter.GetOutput());
w = vtk.vtkUnstructuredGridWriter()
if(vtk.VTK_MAJOR_VERSION <= 5):
w.SetInput(unstructuredGrid)
else:
w.SetInputData(unstructuredGrid)
w.SetFileName(fileName+'.vtk')
w.Write()
self.readVtkFile(fileName+'.vtk')
示例5: vtkGetDataRoot
#!/usr/bin/env python
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create a rendering window and renderer
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
renWin.StereoCapableWindowOn()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
reader = vtk.vtkGenericEnSightReader()
# Make sure all algorithms use the composite data pipeline
cdp = vtk.vtkCompositeDataPipeline()
reader.SetDefaultExecutivePrototype(cdp)
reader.SetCaseFileName("" + str(VTK_DATA_ROOT) + "/Data/EnSight/blow2_bin.case")
reader.SetTimeValue(1)
geom = vtk.vtkGeometryFilter()
geom.SetInputConnection(reader.GetOutputPort())
mapper = vtk.vtkHierarchicalPolyDataMapper()
mapper.SetInputConnection(geom.GetOutputPort())
mapper.SetColorModeToMapScalars()
mapper.SetScalarModeToUsePointFieldData()
mapper.ColorByArrayComponent("displacement",0)
mapper.SetScalarRange(0,2.08)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# assign our actor to the renderer
ren1.AddActor(actor)
# enable user interface interactor