當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。