[vtkusers] Get vtkPolyData from vtkMapper in vtkActor using Java API
kent myers
dakota_63124 at yahoo.com
Sat May 9 15:21:10 EDT 2015
Hi Bill,
I edited my post shortly after I wrote it because I was able to get the vtkPolyData object from my actor.
However I could not find the SetInput() method for the writer, so I tried SetInputData. This crashes the Java virtual machine.
I will try to understand your C++ code sample, but Java is very different, and it seems that not all C++ methods are exposed to Java.
Thanks for the help.Kent
On Saturday, May 9, 2015 12:07 PM, Bill Lorensen [via VTK] <ml-node+s1045678n5731860h13 at n5.nabble.com> wrote:
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
<[hidden email]> 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
_______________________________________________
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
If you reply to this email, your message will be added to the discussion below: http://vtk.1045678.n5.nabble.com/Get-vtkPolyData-from-vtkMapper-in-vtkActor-using-Java-API-tp5731859p5731860.html To unsubscribe from Get vtkPolyData from vtkMapper in vtkActor using Java API, click here.
NAML
--
View this message in context: http://vtk.1045678.n5.nabble.com/Write-vtkPolyData-to-vtp-file-using-Java-API-tp5731859p5731861.html
Sent from the VTK - Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150509/5ca21d75/attachment.html>
More information about the vtkusers
mailing list