Python vtk.vtkXMLPolyDataReader() Examples
The following are 7
code examples of vtk.vtkXMLPolyDataReader().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
vtk
, or try the search function
.
Example #1
Source File: vtk_file_converter.py From handyscripts with MIT License | 6 votes |
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)
Example #2
Source File: ReaderVTP.py From pcloudpy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _update(self): reader = vtkXMLPolyDataReader() reader.SetFileName(self.filename_) reader.Update() self._polydata = reader.GetOutput()
Example #3
Source File: tract_io.py From geomloss with MIT License | 5 votes |
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)
Example #4
Source File: mesh.py From OpenWARP with Apache License 2.0 | 5 votes |
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
Example #5
Source File: mesh.py From OpenWARP with Apache License 2.0 | 5 votes |
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
Example #6
Source File: mesh.py From OpenWARP with Apache License 2.0 | 5 votes |
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
Example #7
Source File: mesh.py From OpenWARP with Apache License 2.0 | 5 votes |
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