<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-CA">I am having trouble figuring out how to get a pqPipelineSource from a vtkObject (specifically a vtkPolyData) so that I can view those objects in paraview from my plugin. Here is my code<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas"><<span style="color:blue">vtkXMLPolyDataReader</span>>
<b><span style="color:navy">reader</span></b> = <span style="color:blue">vtkSmartPointer</span><<span style="color:blue">vtkXMLPolyDataReader</span>>::<span style="color:#880000">New</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">std</span><span style="font-size:9.5pt;font-family:Consolas">::<i><span style="color:blue">string</span></i>
<b><span style="color:navy">binary_string</span></b>; // I get this from a database which stores contents of a binary .vtp file<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:9.5pt;font-family:Consolas;color:navy">reader</span></b><span style="font-size:9.5pt;font-family:Consolas">-><span style="color:#880000">SetInputString</span>(<b><span style="color:navy">binary_string</span></b>);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:9.5pt;font-family:Consolas;color:navy">reader</span></b><span style="font-size:9.5pt;font-family:Consolas">->ReadFromInputStringOn();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:9.5pt;font-family:Consolas;color:navy">reader</span></b><span style="font-size:9.5pt;font-family:Consolas">-><span style="color:#880000">Update</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">pqApplicationCore</span><span style="font-size:9.5pt;font-family:Consolas"> *<b><span style="color:navy">core</span></b> =
<span style="color:blue">pqApplicationCore</span>::<span style="color:#880000">instance</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">pqDisplayPolicy</span><span style="font-size:9.5pt;font-family:Consolas"> *<b><span style="color:navy">displayPolicy</span></b> =
<b><span style="color:navy">core</span></b>-><span style="color:#880000">getDisplayPolicy</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">pqView</span><span style="font-size:9.5pt;font-family:Consolas"> *<b><span style="color:navy">view</span></b> =
<span style="color:blue">pqActiveObjects</span>::<span style="color:#880000">instance</span>().<span style="color:#880000">activeView</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:yellow;mso-highlight:yellow">pqPipelineSource</span><span style="font-size:9.5pt;font-family:Consolas;background:yellow;mso-highlight:yellow">*
<b><span style="color:navy">source = ???</span></b></span><b><span style="font-size:9.5pt;font-family:Consolas;color:navy"> // want to obtain from vtkObject/vtkPolyData somehow (vtkPolyData * pdata = reader</span></b><span style="font-size:9.5pt;font-family:Consolas">-><span style="color:#880000">GetOutput</span>());<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">vtkSMProxy</span><span style="font-size:9.5pt;font-family:Consolas"> *<b><span style="color:navy">sourceProxy</span></b> =
<b><span style="color:navy">source</span></b>-><span style="color:#880000">getProxy</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:9.5pt;font-family:Consolas;color:navy">sourceProxy</span></b><span style="font-size:9.5pt;font-family:Consolas">-><span style="color:#880000">UpdateVTKObjects</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:9.5pt;font-family:Consolas;color:navy">displayPolicy</span></b><span style="font-size:9.5pt;font-family:Consolas">-><span style="color:#880000">setRepresentationVisibility</span>(<b><span style="color:navy">source</span></b>-><span style="color:#880000">getOutputPort</span>(0),<b><span style="color:navy">view</span></b>,<span style="color:blue">true</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:9.5pt;font-family:Consolas;color:navy"><o:p> </o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-CA">Any help much appreciated.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Michael</span><o:p></o:p></p>
</div>
</body>
</html>