本文整理汇总了Python中vtk.vtkXMLPolyDataReader方法的典型用法代码示例。如果您正苦于以下问题:Python vtk.vtkXMLPolyDataReader方法的具体用法?Python vtk.vtkXMLPolyDataReader怎么用?Python vtk.vtkXMLPolyDataReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtk
的用法示例。
在下文中一共展示了vtk.vtkXMLPolyDataReader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_vtk_file
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkXMLPolyDataReader [as 别名]
def convert_vtk_file(vtk_file, plt_file, strand=None, solution_time=None):
reader = None
if vtk_file.endswith(".vtu"):
reader = vtk.vtkXMLUnstructuredGridReader()
elif vtk_file.endswith(".vtp"):
reader = vtk.vtkXMLPolyDataReader()
elif vtk_file.endswith(".vts"):
reader = vtk.vtkXMLStructuredGridReader()
elif vtk_file.endswith(".vti"):
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName(vtk_file)
reader.Update()
vtk_dataset = reader.GetOutput()
tp.new_layout()
tecplot_dataset = tp.active_frame().dataset
add_vtk_dataset(vtk_dataset, tecplot_dataset)
for z in tecplot_dataset.zones():
z.name = os.path.basename(vtk_file)
if strand and solution_time:
z.strand = strand
z.solution_time = solution_time
tp.data.save_tecplot_plt(plt_file, dataset=tecplot_dataset)
示例2: _update
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkXMLPolyDataReader [as 别名]
def _update(self):
reader = vtkXMLPolyDataReader()
reader.SetFileName(self.filename_)
reader.Update()
self._polydata = reader.GetOutput()
示例3: read_vtk
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkXMLPolyDataReader [as 别名]
def read_vtk(filename):
if filename.endswith('xml') or filename.endswith('vtp'):
polydata_reader = vtk.vtkXMLPolyDataReader()
else:
polydata_reader = vtk.vtkPolyDataReader()
polydata_reader.SetFileName(filename)
polydata_reader.Update()
polydata = polydata_reader.GetOutput()
return vtkPolyData_to_tracts(polydata)
示例4: _read_vtp
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkXMLPolyDataReader [as 别名]
def _read_vtp(file_name):
'''Internal function to read vtp mesh files
'''
reader = vtk.vtkXMLPolyDataReader()
reader.SetFileName(file_name)
reader.Update()
mesh_data = PanelMesh(file_name)
mesh_data.orig_type = 'VTK Polydata (.vtp)'
readerOut = reader.GetOutput()
mesh_data.num_faces = int(readerOut.GetNumberOfCells())
mesh_data.num_points = int(readerOut.GetNumberOfPoints())
for i in xrange(mesh_data.num_points):
mesh_data.points.append(readerOut.GetPoint(i))
mesh_data.points = np.array(mesh_data.points)
for i in xrange(mesh_data.num_faces):
c = readerOut.GetCell(i)
numCellPoints = int(c.GetNumberOfPoints())
idsTemp = []
for i in xrange(numCellPoints):
idsTemp.append(int(c.GetPointId(i)))
mesh_data.faces.append(np.array(idsTemp))
mesh_data.faces = np.array(mesh_data.faces)
return mesh_data