title: VTK Python Wrapper - Exporting Surface Plot
body: <p>I'm using VTK 8.0.1 and python 3.5 and am brand new to VTK. I am trying to export a surface plot using vtkPlotSurface.</p>
  
  <p>By referencing <a href="https://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Filters/General/Testing/Python/TestPointConnectivityFilter.py" rel="nofollow noreferrer">TestSurfacePlot.cxx</a> I have successfully created a surface plot and have been able to render it in python (even though it doesn't really look like a surface plot).</p>
  
  <pre class="lang-py prettyprint-override"><code>import vtk
  import math as m
  import numpy as np
  
  ## Set things up
  chart = vtk.vtkChartXYZ()
  view = vtk.vtkContextView()
  view.GetRenderWindow().SetSize(800,800)
  view.GetScene().AddItem(chart)
  
  ## Create a surface
  table = vtk.vtkTable()
  numPoints = 70;
  inc = 9.424778 / (numPoints - 1);
  for i in range(0,numPoints):
      arr = vtk.vtkFloatArray()
      table.AddColumn(arr)
  
  table.SetNumberOfRows(numPoints)
  for i in range(0,numPoints):
      x = i * inc;
      for j in range(0,numPoints):
          y  = j * inc;
          table.SetValue(i, j, m.sin(m.sqrt(x*x + y*y)))
  
  # Using table, create a surface plot
  test = vtk.vtkPlotSurface()
  test.SetXRange(0,9.424778)
  test.SetYRange(0,9.424778)
  test.SetInputData(table)
  
  # Start visualizing the surface plot
  chart.AddPlot(test)
  view.GetRenderWindow().SetMultiSamples(0)
  view.GetInteractor().Initialize()
  view.GetRenderWindow().Render()
  
  out = vtk.vtkOBJExporter()
  out.SetFilePrefix("test")
  out.SetInput(chart)
  out.Write()
  
  
  view.GetInteractor().Start()
  </code></pre>
  
  <p>In order to better visualize what I've made, I wanted to try and export it and then visualize using Paraview/Visit. However, I'm struggling to find any concrete examples where this type of vtk object is exported...</p>
  
  <p>I have tried adding the following:</p>
  
  <pre><code>out = vtk.vtkOBJExporter()
  out.SetFilePrefix("test")
  out.SetInput(chart)
  out.Write()
  </code></pre>
  
  <p>But end up with the following type error:</p>
  
  <pre><code>TypeError: SetInput argument 1: method requires a vtkRenderWindow, a vtkContextView was provided.
  </code></pre>
  
  <p>Can anyone provide assistance? Thanks in advance.</p>