[vtkusers] How to use vtkClipDataSet and preserve Arrays

Cory Quammen cory.quammen at kitware.com
Tue Jan 5 13:56:24 EST 2016


>
> // Clip data
> vtkSmartPointer<vtkClipDataSet> clipDataSet =
> vtkSmartPointer<vtkClipDataSet>::New();
> clipDataSet->SetClipFunction(plane);
> clipDataSet->SetInputConnection(model->GetProducerPort());
> clipDataSet->InsideOutOn();
> clipDataSet->GenerateClippedOutputOn();
>
> //PROBLEM HERE. The print shows that there aren't any arrays on the output
> data
> clipDataSet->GetOutput()->Print(std::cout);
>

You haven't updated the clipDataSet filter yet at this point, so the output
should be empty here. If you do add a call to clipDataSet->Update(), you
should see that the output has the arrays you expect. Let us know if it
doesn't.


> // Warp the data.
> vtkSmartPointer<vtkWarpVector> warpingVector =
> vtkSmartPointer<vtkWarpVector>::New();
> warpingVector->SetInput(clipDataSet->GetOutput());
> warpingVector->Update();
>

Could you try calling

warpingVector->SetInputArrayToProcess(0, 0, 0, vtkDataObject::
 FIELD_ASSOCIATION_POINTS, "Displacements");

This should tell the vtkWarpVector object to displace by your
"Displacements" array.

HTH,
Cory


> // Filter the data because vtkFeatureEdges needs polydata as input
> vtkSmartPointer<vtkGeometryFilter> outGeometryFilter =
> vtkSmartPointer<vtkGeometryFilter>::New();
> outGeometryFilter->SetInput(warpingVector->GetOutput());
>
> //Create a filter to only draw the boundaries of the displaced mesh
> vtkSmartPointer<vtkFeatureEdges> drawOnlyBoundaries =
> vtkSmartPointer<vtkFeatureEdges>::New();
> drawOnlyBoundaries->SetInputConnection(outGeometryFilter->GetOutputPort());
> // configuration of drawOnlyBoundaries, it is not important
> drawOnlyBoundaries->BoundaryEdgesOn();
> drawOnlyBoundaries->ManifoldEdgesOff();
> drawOnlyBoundaries->NonManifoldEdgesOff(); drawOnlyBoundaries->Update();
>
> /* Here I omitted the code to display the mesh using
> clipDataSet->GetOutputPort() as input*/
> /* Also, the code to configure the mapper and actor using
> drawOnlyBoundaries as input */
>
>
>
> _______________________________________________
> 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
>
>


-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160105/1e271b86/attachment.html>


More information about the vtkusers mailing list