[vtkusers] saving vtkPolyData after vtkClipPolyData issue

Joachim Pouderoux joachim.pouderoux at kitware.com
Mon Dec 28 09:02:44 EST 2015


Yusuf,

In the code you provide, the clip filter is never executed. You should add
m_Clip->Update(); - for instance just after the setinputconnection.
Not related but you could directly plug the clip filter to the writer (no
need to shallow copy the output of the clip filter):
just replace m_PolyDataWriter->SetInput(m_PolyDataSave);
by m_PolyDataWriter->SetInputConnection(m_Clip->GetOutputPort());
If you do so, calling Write() on the writer will execute the pipeline of
the writer which involves the Clip filter too - so the clip filter would be
called automatically even if you do not explicitly called Update() on it.

Best,
Joachim

*Joachim Pouderoux*

*PhD, Technical Expert*
*Kitware SAS <http://www.kitware.fr>*


2015-12-20 17:06 GMT+01:00 Yusuf OEZBEK <nasil122002 at yahoo.de>:

>  Hello,
>
> I want to save my polydata after clipping with vtkBoxWidget. If I run
> following code-block, the saved file is empty.
> What can be my mistake here?
>
>   m_Clip= vtkSmartPointer<vtkClipPolyData>::New();
>   m_Clip->SetClipFunction(m_Plane);
>   m_Clip->InsideOutOn();
>   m_Clip->SetInputConnection(m_Decimater->GetOutputPort());
>
>   m_PolyDataSave= vtkSmartPointer<vtkPolyData>::New();
>   m_PolyDataSave->ShallowCopy(m_Clip->GetOutput());
>
>   m_PolyDataWriter = vtkSmartPointer<vtkPolyDataWriter>::New();
>   m_PolyDataWriter->SetFileName("clippedObject.vtk");
>   m_PolyDataWriter->SetInput(m_PolyDataSave);
>   m_PolyDataWriter->SetFileTypeToASCII();
>   m_PolyDataWriter->Write();
>
> Thank you for any help!
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151228/08386a30/attachment.html>


More information about the vtkusers mailing list