Ejemplo n.º 1
0
 def __init__(self, module_manager):
     SimpleVTKClassModuleBase.__init__(
         self, module_manager,
         vtk.vtkDataObjectWriter(), 'Writing vtkDataObject.',
         ('vtkDataObject',), (),
         replaceDoc=True,
         inputFunctions=None, outputFunctions=None)
Ejemplo n.º 2
0
    output = comb.GetOutput().GetBlock(0)

    wsg = vtk.vtkStructuredGridWriter()
    wsg.SetInputData(output)
    wsg.SetFileTypeToBinary()
    wsg.SetFileName("combsg.vtk")
    wsg.Write()

    pl3d = vtk.vtkStructuredGridReader()
    pl3d.SetFileName("combsg.vtk")

    ds2do = vtk.vtkDataSetToDataObjectFilter()
    ds2do.SetInputConnection(pl3d.GetOutputPort())

    writer = vtk.vtkDataObjectWriter()
    writer.SetInputConnection(ds2do.GetOutputPort())
    writer.SetFileName("SGridField.vtk")
    writer.Write()

    # read the field
    dor = vtk.vtkDataObjectReader()
    dor.SetFileName("SGridField.vtk")

    do2ds = vtk.vtkDataObjectToDataSetFilter()
    do2ds.SetInputConnection(dor.GetOutputPort())
    do2ds.SetDataSetTypeToStructuredGrid()
    do2ds.SetDimensionsComponent("Dimensions", 0)
    do2ds.SetPointComponent(0, "Points", 0)
    do2ds.SetPointComponent(1, "Points", 1)
    do2ds.SetPointComponent(2, "Points", 2)
Ejemplo n.º 3
0
#

# Create a reader and write out the field
reader = vtk.vtkDataSetReader()
reader.SetFileName(VTK_DATA_ROOT + "/Data/RectGrid2.vtk")

ds2do = vtk.vtkDataSetToDataObjectFilter()
ds2do.SetInputConnection(reader.GetOutputPort())

# NOTE: This test only works if the current directory is writable
#
try:
    channel = open("RGridField.vtk", "wb")
    channel.close()

    writer = vtk.vtkDataObjectWriter()
    writer.SetInputConnection(ds2do.GetOutputPort())
    writer.SetFileName("RGridField.vtk")
    writer.Write()

    # Read the field
    #
    dor = vtk.vtkDataObjectReader()
    dor.SetFileName("RGridField.vtk")

    do2ds = vtk.vtkDataObjectToDataSetFilter()
    do2ds.SetInputConnection(dor.GetOutputPort())
    do2ds.SetDataSetTypeToRectilinearGrid()
    do2ds.SetDimensionsComponent("Dimensions", 0)
    do2ds.SetPointComponent(0, "XCoordinates", 0)
    do2ds.SetPointComponent(1, "YCoordinates", 0)