[vtkusers] Get vtkPolyData from vtkMapper in vtkActor using Java API

Bill Lorensen bill.lorensen at gmail.com
Sat May 9 15:27:16 EDT 2015


SetInput(polydata) is not in vtk6.x. It should be SetInputData. Not
sure why you are crashing. Try printing the polydata. In C++:

polydata->Print(std::cout);



On Sat, May 9, 2015 at 3:21 PM, kent myers via vtkusers
<vtkusers at vtk.org> wrote:
> 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] <[hidden email]>
> 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: Re: Get vtkPolyData from vtkMapper in vtkActor
> using Java API
>
> 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