this snippet may help you

      QList<QVariant> blocks;
      vtkPVCompositeDataInformation *pvcdi = 
out->GetDataInformation()->GetCompositeDataInformation();
      QList<QVariant> blocks;
      int N = pvcdi->GetNumberOfChildren();
      for (int i=0; i<N; i++) {
        if (...) blocks.append(i+1);
      }
      pqSMAdaptor::setMultipleElementProperty(
        this-> Pipeline->GetProperty("BlockIndices"), blocks);
      this->Pipeline->UpdateProperty("BlockIndices");

assuming you're inside a pqSomething class and have access to all the usual 
pqSMAdaptor stuff. From raw servermanager stuff it'd look different

JB

From: paraview-boun...@paraview.org [mailto:paraview-boun...@paraview.org] On 
Behalf Of papa ndéné NDIAYE
Sent: 08 July 2011 12:20
To: paraview@paraview.org
Subject: [Paraview] vtkSMIntVectorProperty number of elements

Hi, all
I have built a Toolbar plugin in paraview with a button that applies 
extractblock filter to a multiblock dataset
so as to get all the blocks seperately in different objects in the pipeline 
browser.

I achieve getting the number of blocks from the selected multiblock but I don't 
know how to set the block indice
of an extract block filter after having it buit.


vtkSMProperty* property= [the pqPipelineSource resulting from 
createFilter]->GetProperty("BlockIndices");

vtkSMIntVectorProperty * indices= 
vtkSMIntVectorProperty::SafeDownCast(property);

but "indices->GetNumberOfElements();" returns 0 while the compositeTreeWidget 
displays the blocks' hierarchy.

how can I modify a vtkSMProperty within the code?

thanks in advance!
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to