[vtkusers] Get vtkPolyData from vtkMapper in vtkActor using Java API
Bill Lorensen
bill.lorensen at gmail.com
Sat May 9 15:07:20 EDT 2015
Here is what I do in C++:
vtkSmartPointer<vtkActorCollection> actors =
vtkSmartPointer<vtkActorCollection>::New();
actors = renderer->GetActors();
actors->InitTraversal();
for (vtkIdType a = 0; a < actors->GetNumberOfItems(); ++a)
{
vtkActor * actor = actors->GetNextActor();
vtkPolyData *pd = vtkPolyData::SafeDownCast(actor->GetMapper()->GetInput());
vtkSmartPointer<vtkCleanPolyData> clean =
vtkSmartPointer<vtkCleanPolyData>::New();
clean->SetInputData(pd);
vtkSmartPointer<vtkPolyDataNormals> normals =
vtkSmartPointer<vtkPolyDataNormals>::New();
normals->SetInputConnection(clean->GetOutputPort());
normals->Update();
vtkPolyDataMapper *mapper =
vtkPolyDataMapper::SafeDownCast(actor->GetMapper());
mapper->SetInputData(normals->GetOutput());
}
On Sat, May 9, 2015 at 2:48 PM, kent myers via vtkusers
<vtkusers at vtk.org> wrote:
> I am trying to export a vtkPolyData object to a vtp file using
> vtkXMLPolyDataWriter. The online VTK documentation says to use the
> writer.SetInput() method that takes a vtkPolyData object.
>
> I am having some problems with this strategy:
> 1. I can get the vtkMapper object from my vtkActor, but the vtkMapper object
> has no GetInput() method to retrieve a vtkPolyData object (or any other
> method)
> 2. vtkXMLPolyDataWriter has no SetInput() method (or any other method) to
> pass the vtkPolyData object even if I could get the vtkPolyData object.
>
> Has anyone successfully exported vtkPolyData from a Java application? If so,
> how?
>
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Get-vtkPolyData-from-vtkMapper-in-vtkActor-using-Java-API-tp5731859.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
--
Unpaid intern in BillsBasement at noware dot com
More information about the vtkusers
mailing list