[vtkusers] How to use vtkClipDataSet and preserve Arrays

Fernando Nellmeldin f.nellmeldin at open-engineering.com
Wed Jan 6 03:28:51 EST 2016


Yes, indeed that was the problem. I had solved it a few weeks ago and I
forgot to reply it here. Thank you.

2016-01-05 19:56 GMT+01:00 Cory Quammen <cory.quammen at kitware.com>:

> // 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.
>



-- 
*Fernando NELLMELDIN*
Software Engineer
*_______________________________________________________________*

*Open Engineering s.a.*

Rue Bois Saint-Jean 15/1
B-4102 Seraing (Belgium)
Tel: +32.4.353.30.34

http://www.open-engineering.com

https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym


*_________________________________________________________________________*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160106/c6c0ca98/attachment-0001.html>


More information about the vtkusers mailing list