[vtkusers] vtkPDataSetToPolyDataFilter

Robbie Banks robbie.banks at gmail.com
Fri Jan 28 14:32:52 EST 2011


Yep, I guessed that, but how do I go about it. The other ways I tried
yielded as much success.

 

R

 

From: Karthik Krishnan [mailto:karthik.krishnan at kitware.com] 
Sent: Friday, January 28, 2011 11:13 AM
To: Robbie Banks
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] vtkPDataSetToPolyDataFilter

 

 

On Sat, Jan 29, 2011 at 12:18 AM, Robbie Banks <robbie.banks at gmail.com>
wrote:

Can anyone see where this is going wrong?

 

I have a scene where the even numbered actors are reflections of the data
for the odd actors.

 

I am trying to create a single vtkPolyData set with the ploydata for the
whole scene. The reflections are created with a vtkReflectionFilter, which
creates a vtkDataSet.

 

I am trying to cast this vtkDataSet down and then convert it to vtkPolyData
to be appended.

 

The compiler is throwing an error when I try and create the
vtkDataSetToPolyDataFilter saying:

 

Error: invalid conversion from 'vtkAlgorithm' to
'vtkDataSetToPolyDataFilter.

 

I guess it doesn't like being created with a vtkSmartPointer, but I don't
know how to fix it.


Its because vtkDataSetToPolyDataFilter is an abstract base class. It cannot
be instantiated by vtkSmartPointer's New.

 

 

Thoughts?

 

Robbie

 

Code below:

 

vtkSmartPointer<vtkAppendPolyData> pAppendData =
vtkSmartPointer<vtkAppendPolyData>::New();

int reflectedActor = 0;

for(int i = 0; i < actors.size(); i++){

      vtkSmartPointer<vtkActor> actor = actors[i];

      if(actor->IsA("vtkActor")){

            vtkSmartPointer<vtkPolyData> pPolyData =
vtkSmartPointer<vtkPolyData>::New();

            if(i==reflectedActor){

                  vtkSmartPointer<vtkDataSet> pDataSet =
vtkDataSet::SafeDownCast(actor->GetMapper()->GetInput());

                  vtkSmartPointer<vtkDataSetToPolyDataFilter> pFilter =
vtkSmartPointer<vtkDataSetToPolyDataFilter>::New();

                  pFilter->SetInput(pDataSet2);

                  pFilter->Update();

                  pPolyData = pFilter->GetOutput();

                  reflectedActor+=2;

            }

            else

                  pPolyData =
vtkPolyData::SafeDownCast(actor->GetMapper()->GetInput());

            pAppendData->AddInput(pPolyData);

      }

}


_______________________________________________
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 VTK FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ

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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110128/af735b27/attachment.htm>


More information about the vtkusers mailing list