[vtk-developers] How to set several scalars to vtkPoint ?

Bill Lorensen bill.lorensen at gmail.com
Sun Apr 2 12:24:40 EDT 2017


Try
uGrid->GetPointdata()->AddArray(data2);


On Sun, Apr 2, 2017 at 12:01 PM, houssen <houssen at ipgp.fr> wrote:
> Hello,
>
> How to set several scalars to vtkPoint ?
>
> Seems vtkDataPoint scratchs the previous scalar array ?!
>
> vtkSmartPointer<vtkIntArray> data1 = vtkSmartPointer<vtkIntArray>::New();
> data1->SetName("data1");
> vtkSmartPointer<vtkIntArray> data2 = vtkSmartPointer<vtkIntArray>::New();
> data2->SetName("data2");
> for (...) {data1->SetValue(idx, d1[i]); data2->SetValue(idx, d2[idx]) }
> uGrid->GetPointdata()->SetScalars(data1); // OK
> uGrid->GetPointdata()->SetScalars(data2); // data2 scratch data1 ?!
>
> uGrid->GetPointdata()->SetActiveScalar("data1") does not do what I need :
> seems that it activate data1 back but "scratch" data2 back.
>
> uGrid is a vtkUnstructuredGrid : the final goal is to write the grid to a
> file (with vtkWriter). In this file, I'd like to have BOTH data1 and data2
> for points.
> I only get either one or the other... How to get both ?
>
> Also tried to create a N-sized-vector (N=2 or 4) to associate to the
> vtkPoint : does not work as it seems vector dimension MUST be 3. I somebody
> knows a solution to attach a N-sized-vector to a vtkPoint, it could solve my
> problem
>
> Franck
>
> PS : found nothing relevant on the web, targetting VTK-7.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtk-developers mailing list