<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style title="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body ocsi="x">
<div dir="ltr"><font face="Tahoma" color="#000000" size="2">Hi </font></div>
<div dir="ltr"><font face="tahoma" size="2"></font> </div>
<div dir="ltr"><font face="tahoma" size="2">I want to generate and display data in the paraview GUI, all from the python shell tool. The vtk data is not generated from a reader or from inside a programmable source, but directly inside the paraview GUI shell
environment. I now want to connect the input of a filter to this polyData. Are there any interfacing functions to do this:
</font><font face="tahoma" size="2">Here is my example script in which the comments describe what I am trying to do.</font></div>
<div dir="ltr"><font face="tahoma" size="2"></font> </div>
<div dir="ltr"><font face="tahoma" size="2">Thanks in advance,</font></div>
<div dir="ltr"><font face="tahoma" size="2">Louis</font></div>
<div dir="ltr"> </div>
<div dir="ltr"><font face="tahoma" size="2"></font> </div>
<div dir="ltr"><font face="times new roman"># Here is the vtk data generated directly in the GUI python shell:</font></div>
<font size="2">
<p dir="ltr"><font face="Arial">import vtk</font></p>
<p dir="ltr"><font face="Arial">pts=vtk.vtkPoints() </font></p>
<p dir="ltr"><font face="Arial">pts.Initialize()</font></p>
<p dir="ltr"><font face="Arial">pts.InsertNextPoint(0,0,0)</font></p>
<p dir="ltr"><font face="Arial">pts.InsertNextPoint(1,0,.0)</font></p>
<p dir="ltr"><font face="Arial">pts.InsertNextPoint(2,1,0)</font></p>
<p dir="ltr"><font face="Arial">pts.InsertNextPoint(3,3,0.)</font></p>
<p dir="ltr"><font face="arial"></font> </p>
<p dir="ltr"><font face="Arial">cel=vtk.vtkCellArray() </font></p>
<p dir="ltr"><font face="Arial">cel.Initialize()</font></p>
<p dir="ltr"><font face="Arial">cel.InsertNextCell(4) # number of points</font></p>
<p dir="ltr"><font face="Arial">cel.InsertCellPoint(0)</font></p>
<p dir="ltr"><font face="Arial">cel.InsertCellPoint(1)</font></p>
<p dir="ltr"><font face="Arial">cel.InsertCellPoint(2)</font></p>
<p dir="ltr"><font face="Arial">cel.InsertCellPoint(3)</font></p>
<p><font face="Arial"></font> </p>
<p><font face="Arial">pdata=vtk.vtkPolyData()</font></p>
<p><font face="Arial">pdata.SetPoints(pts)</font></p>
<p><font face="Arial">pdata.SetPolys(cel)</font></p>
<p><font face="Arial"></font> </p>
<p><font face="Arial"># Here I am setting up a pipline and registering the proxies</font></font></p>
<font face="times new roman"><font size="2">
<p><font face="Arial">pxm=servermanager.ProxyManager()</font></p>
<p><font face="Arial"></font> </p>
<p><font face="Arial"># Create our programmable filter and set its program ...</font></p>
<p><font face="Arial">#========================================================</font></p>
<p><font face="Arial">filter = servermanager.filters.ProgrammableFilter()</font></p>
<p><font face="Arial">filter.GetProperty("Script").SetElement(0, """</font></p>
<p><font face="Arial">input = self.GetInputDataObject(0, 0)</font></p>
<p><font face="Arial">output = self.GetOutputDataObject(0)</font></p>
<p><font face="Arial">output.DeepCopy(input)</font></p>
<p><font face="Arial">""")</font></p>
<p><font face="Arial"></font> </p>
<p><font face="Arial"># Connect the polyData output to</font></p>
<p><font face="Arial"># the programmable filter input ...</font></p>
<p><font face="arial"></font> </p>
<p><font face="arial"># Here is where I need a link between the filter and my polyData</font></p>
<p><font face="arial"># The following obviously does not work...</font></p>
<p><font face="arial"></font> </p>
<p><font face="Arial">filter.Input = pData</font></p>
<p><font face="Arial">#filter.Input.SetData(polyData)</font></p>
<p><font face="arial"></font> </p>
<p><font face="Arial">pxm.RegisterProxy("sources", "my programmable filter", filter)</font></p>
<p><font face="Arial"></font> </p>
<p><font face="Arial">view = pxm.GetProxy("views", "RenderView1")</font></p>
<p><font face="Arial">rep = servermanager.CreateRepresentation(filter, view)</font></p>
<p><font face="Arial">pxm.RegisterProxy("representations", "myrep1", rep)</font></p>
<p> </p>
<p><font face="times new roman"></font> </p>
<p><font face="times new roman"></font> </p>
<p><font face="times new roman"></font> </p>
</font></font>
</body>
</html>