当前位置: 首页>>代码示例>>Python>>正文


Python vtk.vtkXMLPolyDataReader方法代码示例

本文整理汇总了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) 
开发者ID:Tecplot,项目名称:handyscripts,代码行数:24,代码来源:vtk_file_converter.py

示例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() 
开发者ID:mmolero,项目名称:pcloudpy,代码行数:7,代码来源:ReaderVTP.py

示例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) 
开发者ID:jeanfeydy,项目名称:geomloss,代码行数:15,代码来源:tract_io.py

示例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 
开发者ID:NREL,项目名称:OpenWARP,代码行数:31,代码来源:mesh.py


注:本文中的vtk.vtkXMLPolyDataReader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。