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 <[email protected] <mailto:[email protected]>> 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.

_______________________________________________
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

Reply via email to