fixed pointcloud issues for vtk < 7.0 (going back to old, non-XML format)

This commit is contained in:
Martin Diehl 2016-04-25 08:28:00 +02:00
parent 34aa11f197
commit 26f437b507
2 changed files with 6 additions and 8 deletions

View File

@ -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()

View File

@ -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()