[vtkusers] Adding two SCALARS into on vtkPolyData

Forrest Sheng Bao forrest.bao at gmail.com
Thu Jan 5 19:56:28 EST 2012


Hi David,

A minor thing. Using either your code or mine, in the output file, between
the SCALARS block for curv and the one for depth, I saw the follows.

FIELD FieldData 1
Depth 1 133597 double

It causes problems when I load the file using VTK's Python wrapper in
Python. Interestingly, it had no problem with some visualization software,
e.g., MayaVI.

To "fix" this, is there any way that I can
1. get rid of the "FIELD FieldData 1" line and,
2. have "Depth 1 133597 double" changed into "SCALARS Depth double" and,
3. add a line "LOOKUP_TABLE default" ?

Cheers, Forrest

On Thu, Jan 5, 2012 at 7:02 AM, David Doria <daviddoria at gmail.com> wrote:

> On Wed, Jan 4, 2012 at 10:47 PM, Forrest Sheng Bao <forrest.bao at gmail.com>wrote:
>
>> Hi,
>>
>> I am trying to associate two scalars to points of a vtkPolyData object
>> (i.e., I want to see two SCALARS blocks in POINTDATA segment in the output
>> VTK file).
>>
>> Suppose I have a vtkPolyData pointer
>>
>> vtkPolyData* mesh;
>>
>> and two vtkDoubleArray pointers
>>
>>  vtkDoubleArray* depth;
>>  vtkDoubleArray* curv;
>>
>> This is what I do:
>>
>> depth->SetName("Depth");
>> mesh->GetPointData()->SetScalars(depth);
>> curv->SetName("Curvature");
>> mesh->GetPointData()->AddArray(curv)
>>
>> Sure, that is fine.
> You could equivalently do:
>
> mesh->GetPointData()->AddArray(depth);
> mesh->GetPointData()->AddArray(curv)
>
> mesh->GetPointData()->SetActiveScalars("Depth");
>
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120105/9cb816e6/attachment.htm>


More information about the vtkusers mailing list