[Paraview] Creating a vtp file
Norman Goldstein
normvcr at telus.net
Thu Jul 2 12:37:45 EDT 2015
Yes, thanks, that is exactly what I needed.
PS
I was getting memory errors when using myArrray->InsertNextTuple1( value )
This cleared up when I switched to myArrray->InsertTuple1( index, value ).
On 07/02/2015 04:40 AM, Cory Quammen wrote:
> 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
> <mailto: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 <http://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/0ab9e92b/attachment.html>
More information about the ParaView
mailing list