From 26f437b507c0214c94d31cbe84c8014ffbec5724 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 25 Apr 2016 08:28:00 +0200 Subject: [PATCH] fixed pointcloud issues for vtk < 7.0 (going back to old, non-XML format) --- processing/post/vtk_pointcloud.py | 10 +++++----- processing/post/vtk_rectilinearGrid.py | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/processing/post/vtk_pointcloud.py b/processing/post/vtk_pointcloud.py index dc62682e6..ffeaf0906 100755 --- a/processing/post/vtk_pointcloud.py +++ b/processing/post/vtk_pointcloud.py @@ -82,16 +82,16 @@ for name in filenames: # ------------------------------------------ output result --------------------------------------- - writer = vtk.vtkXMLPolyDataWriter() - writer.SetCompressorTypeToZLib() - if name: + writer = vtk.vtkXMLPolyDataWriter() + writer.SetCompressorTypeToZLib() writer.SetDataModeToBinary() writer.SetFileName(os.path.join(os.path.split(name)[0], os.path.splitext(os.path.split(name)[1])[0] + '.' + writer.GetDefaultFileExtension())) else: - writer.SetDataModeToAscii() + writer = vtk.vtkDataSetWriter() + writer.SetHeader('# powered by '+scriptID) writer.WriteToOutputStringOn() if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(Polydata) @@ -99,6 +99,6 @@ for name in filenames: writer.Write() - if name is None: sys.stdout.write(writer.GetOutputString()) + if name is None: sys.stdout.write(writer.GetOutputString()[:writer.GetOutputStringLength()]) # limiting of outputString is fix for vtk <7.0 table.close() diff --git a/processing/post/vtk_rectilinearGrid.py b/processing/post/vtk_rectilinearGrid.py index 4fd2addfb..cc430dbe2 100755 --- a/processing/post/vtk_rectilinearGrid.py +++ b/processing/post/vtk_rectilinearGrid.py @@ -6,7 +6,6 @@ import numpy as np import damask from optparse import OptionParser - scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) @@ -144,7 +143,6 @@ for name in filenames: writer.Write() - if name is None: sys.stdout.write(writer.GetOutputString() if name else - writer.GetOutputString()[0:writer.GetOutputStringLength()]) + if name is None: sys.stdout.write(writer.GetOutputString()[:writer.GetOutputStringLength()]) # limiting of outputString is fix for vtk <7.0 table.close()