<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">this snippet may help you
<o:p></o:p></span></b></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New""><o:p> </o:p></span></b></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:green">QList</span><<span style="color:green">QVariant</span>>
<span style="color:green">blocks</span>;</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:green">vtkPVCompositeDataInformation</span> *<span style="color:green">pvcdi</span> =
<span style="color:green">out</span>-><span style="color:green">GetDataInformation</span>()-><span style="color:green">GetCompositeDataInformation</span>();</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:green">QList</span><<span style="color:green">QVariant</span>>
<span style="color:green">blocks</span>;</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:maroon">int</span> <span style="color:green">N</span> = <span style="color:green">
pvcdi</span>-><span style="color:green">GetNumberOfChildren</span>();</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:maroon">for</span> (<span style="color:maroon">int</span> <span style="color:green">
i</span>=<span style="color:red">0</span>; <span style="color:green">i</span><<span style="color:green">N</span>;
<span style="color:green">i</span>++) {</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New""> if (...)
<span style="color:green">blocks</span>.<span style="color:green">append</span>(<span style="color:green">i</span>+<span style="color:red">1</span>);</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New""> }</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:green">pqSMAdaptor</span>::<span style="color:green">setMultipleElementProperty</span>(</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:maroon">this</span>-><span style="color:green"> Pipeline</span>-><span style="color:green">GetProperty</span>(<span style="color:blue">"BlockIndices"</span>),
<span style="color:green">blocks</span>); </span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New""> <span style="color:maroon">this</span>-><span style="color:green">Pipeline</span>-><span style="color:green">UpdateProperty</span>(<span style="color:blue">"BlockIndices"</span>);</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">assuming you’re inside a pqSomething class and have access to all the usual pqSMAdaptor stuff. From raw servermanager stuff it’d look different<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">JB<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> paraview-bounces@paraview.org [mailto:paraview-bounces@paraview.org]
<b>On Behalf Of </b>papa ndéné NDIAYE<br>
<b>Sent:</b> 08 July 2011 12:20<br>
<b>To:</b> paraview@paraview.org<br>
<b>Subject:</b> [Paraview] vtkSMIntVectorProperty number of elements<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi, all<br>
I have built a Toolbar plugin in paraview with a button that applies extractblock filter to a multiblock dataset<br>
so as to get all the blocks seperately in different objects in the pipeline browser.<br>
<br>
I achieve getting the number of blocks from the selected multiblock but I don't know how to set the block indice<br>
of an extract block filter after having it buit.<br>
<br>
<b><br>
vtkSMProperty* property= [the pqPipelineSource resulting from createFilter]->GetProperty("BlockIndices");<br>
<br>
vtkSMIntVectorProperty * indices= vtkSMIntVectorProperty::SafeDownCast(property);<br>
<br>
</b>but <b>"indices->GetNumberOfElements();" </b>returns 0 while the compositeTreeWidget displays the blocks' hierarchy.<br>
<br>
how can I modify a vtkSMProperty within the code?<br>
<br>
thanks in advance!<o:p></o:p></p>
</div>
</body>
</html>