[Paraview] Creating a vtp file
Cory Quammen
cory.quammen at kitware.com
Thu Jul 2 07:40:12 EDT 2015
Hi Norman,
To set point data, you can first get the point data object with
vtkPointData* pointData = polydata->GetPointData();
Then you can add arrays to it:
vtkFloatArray* myArrray = vtkFloatArray::New();
myArray->SetName("myArray");
myArray->SetNumberOfComponents(1);
myArray->SetNumberOfTuples(polydata->GetNumberOfPoints());
// Set array elements here...
pointData->AddArray(myArray);
The same holds true for cell data, just replace PointData with CellData,
and set the number of tuples to the number of cells instead of the number
of points.
Hope this helps,
Cory
On Thu, Jul 2, 2015 at 1:57 AM, Norman Goldstein <normvcr at telus.net> wrote:
> From net examples and on-line docs, I have gleaned some of the info to
> create a full 1-piece vtp file:
>
> Call
> vtkXMLPolyDataWriter::SetInputData( vtkDataObject
> <http://www.vtk.org/doc/nightly/html/classvtkDataObject.html> *)
>
> where you pass in a vtkPolyData, which you first set up with the methods:
>
> SetVerts
> SetLines
> SetPolys
> SetStrips
>
> and the parent method
>
> SetPoints
>
> What I have not figured out is how to set the vtp fields
> PointData and CellData
>
> Any pointers much appreciated ...
>
>
>
>
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
--
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150702/a930ddb2/attachment.html>
More information about the ParaView
mailing list