removed "legacy" option. STDOUT reports most modern format available (ASCII XML for point cloud, VTK for rectilinear grid).
This commit is contained in:
parent
f1b5d40bac
commit
94933514a1
|
@ -23,14 +23,8 @@ parser.add_option('-p',
|
||||||
dest = 'pos',
|
dest = 'pos',
|
||||||
type = 'string', metavar = 'string',
|
type = 'string', metavar = 'string',
|
||||||
help = 'label of coordinates [%default]')
|
help = 'label of coordinates [%default]')
|
||||||
parser.add_option('-l',
|
|
||||||
'--legacy',
|
|
||||||
dest = 'legacy',
|
|
||||||
action = 'store_true',
|
|
||||||
help = 'legacy VTK output')
|
|
||||||
|
|
||||||
parser.set_defaults(pos = 'pos',
|
parser.set_defaults(pos = 'pos',
|
||||||
legacy = False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
@ -88,19 +82,16 @@ for name in filenames:
|
||||||
|
|
||||||
# ------------------------------------------ output result ---------------------------------------
|
# ------------------------------------------ output result ---------------------------------------
|
||||||
|
|
||||||
if options.legacy:
|
|
||||||
writer = vtk.vtkDataSetWriter()
|
|
||||||
writer.SetHeader('# powered by '+scriptID)
|
|
||||||
else:
|
|
||||||
writer = vtk.vtkXMLPolyDataWriter()
|
writer = vtk.vtkXMLPolyDataWriter()
|
||||||
writer.SetDataModeToBinary()
|
|
||||||
writer.SetCompressorTypeToZLib()
|
writer.SetCompressorTypeToZLib()
|
||||||
|
|
||||||
if name:
|
if name:
|
||||||
|
writer.SetDataModeToBinary()
|
||||||
writer.SetFileName(os.path.join(os.path.split(name)[0],
|
writer.SetFileName(os.path.join(os.path.split(name)[0],
|
||||||
os.path.splitext(os.path.split(name)[1])[0] +
|
os.path.splitext(os.path.split(name)[1])[0] +
|
||||||
'.' + ('vtk' if options.legacy else writer.GetDefaultFileExtension())))
|
'.' + writer.GetDefaultFileExtension()))
|
||||||
else:
|
else:
|
||||||
|
writer.SetDataModeToAscii()
|
||||||
writer.WriteToOutputStringOn()
|
writer.WriteToOutputStringOn()
|
||||||
|
|
||||||
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(Polydata)
|
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(Polydata)
|
||||||
|
@ -108,6 +99,6 @@ for name in filenames:
|
||||||
|
|
||||||
writer.Write()
|
writer.Write()
|
||||||
|
|
||||||
if name is None: sys.stdout.write(writer.GetOutputString()) #[0:writer.GetOutputStringLength()]
|
if name is None: sys.stdout.write(writer.GetOutputString())
|
||||||
|
|
||||||
table.close()
|
table.close()
|
||||||
|
|
|
@ -34,16 +34,10 @@ parser.add_option('-g',
|
||||||
dest = 'geom',
|
dest = 'geom',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
help = 'geom input format')
|
help = 'geom input format')
|
||||||
parser.add_option('-l',
|
|
||||||
'--legacy',
|
|
||||||
dest = 'legacy',
|
|
||||||
action = 'store_true',
|
|
||||||
help = 'legacy VTK output')
|
|
||||||
|
|
||||||
parser.set_defaults(mode = 'cell',
|
parser.set_defaults(mode = 'cell',
|
||||||
pos = 'pos',
|
pos = 'pos',
|
||||||
geom = False,
|
geom = False,
|
||||||
legacy = False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
@ -132,20 +126,17 @@ for name in filenames:
|
||||||
|
|
||||||
# ------------------------------------------ output result ---------------------------------------
|
# ------------------------------------------ output result ---------------------------------------
|
||||||
|
|
||||||
if options.legacy:
|
|
||||||
writer = vtk.vtkDataSetWriter()
|
|
||||||
writer.SetHeader('# powered by '+scriptID)
|
|
||||||
else:
|
|
||||||
writer = vtk.vtkXMLRectilinearGridWriter()
|
|
||||||
writer.SetDataModeToBinary()
|
|
||||||
writer.SetCompressorTypeToZLib()
|
|
||||||
|
|
||||||
if name:
|
if name:
|
||||||
|
writer = vtk.vtkXMLPolyDataWriter()
|
||||||
|
writer.SetCompressorTypeToZLib()
|
||||||
|
writer.SetDataModeToBinary()
|
||||||
writer.SetFileName(os.path.join(os.path.split(name)[0],
|
writer.SetFileName(os.path.join(os.path.split(name)[0],
|
||||||
os.path.splitext(os.path.split(name)[1])[0] +
|
os.path.splitext(os.path.split(name)[1])[0] +
|
||||||
('' if isGeom else '_{}({})'.format(options.pos, options.mode)) +
|
('' if isGeom else '_{}({})'.format(options.pos, options.mode)) +
|
||||||
'.' + ('vtk' if options.legacy else writer.GetDefaultFileExtension())))
|
'.' + writer.GetDefaultFileExtension()))
|
||||||
else:
|
else:
|
||||||
|
writer = vtk.vtkDataSetWriter()
|
||||||
|
writer.SetHeader('# powered by '+scriptID)
|
||||||
writer.WriteToOutputStringOn()
|
writer.WriteToOutputStringOn()
|
||||||
|
|
||||||
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(rGrid)
|
if vtk.VTK_MAJOR_VERSION <= 5: writer.SetInput(rGrid)
|
||||||
|
@ -153,6 +144,7 @@ for name in filenames:
|
||||||
|
|
||||||
writer.Write()
|
writer.Write()
|
||||||
|
|
||||||
if name is None: sys.stdout.write(writer.GetOutputString())
|
if name is None: sys.stdout.write(writer.GetOutputString() if name else
|
||||||
|
writer.GetOutputString()[0:writer.GetOutputStringLength()])
|
||||||
|
|
||||||
table.close()
|
table.close()
|
||||||
|
|
Loading…
Reference in New Issue