Difference between revisions of "VTK/Examples/Python/VTPReader"

From KitwarePublic
< VTK‎ | Examples‎ | Python
Jump to navigationJump to search
(Created page with '==VTPReader.py== <source lang="python"> reader = vtk.vtkXMLPolyDataReader() path = os.path.join(constant.BASE_DIR, "archive.vtp") #Archive path reader.SetFil…')
 
 
Line 1: Line 1:
 
==VTPReader.py==
 
==VTPReader.py==
 
<source lang="python">
 
<source lang="python">
      reader = vtk.vtkXMLPolyDataReader()
+
reader = vtk.vtkXMLPolyDataReader()
      path = os.path.join(constant.BASE_DIR, "archive.vtp") #Archive path
+
path = os.path.join(constant.BASE_DIR, "archive.vtp") #Archive path
      reader.SetFileName(path)
+
reader.SetFileName(path)
      reader.Update()
+
reader.Update()
  
      mapper = vtk.vtkPolyDataMapper()
+
mapper = vtk.vtkPolyDataMapper()
      mapper.SetInput(reader.GetOutput())
+
mapper.SetInput(reader.GetOutput())
  
      actor = vtk.vtkActor()
+
actor = vtk.vtkActor()
      actor.SetMapper(mapper)
+
actor.SetMapper(mapper)
 
</source>
 
</source>

Latest revision as of 01:30, 22 August 2015

VTPReader.py

reader = vtk.vtkXMLPolyDataReader()
path = os.path.join(constant.BASE_DIR, "archive.vtp") #Archive path
reader.SetFileName(path)
reader.Update()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(reader.GetOutput())

actor = vtk.vtkActor()
actor.SetMapper(mapper)