[Paraview] multiple scalar fields
David E DeMarle
dave.demarle at kitware.com
Wed Oct 25 13:26:59 EDT 2017
Give each array a name (vtkDataArray::SetName()) and use AddArray
(vtkFieldData:AddArray()) instead of using the atttibutes based API
(vtkDataSetAttributes::Set{Scalars/Tensors/Vectors....})
ParaView uses named array access almost exclusively anyway.
David E DeMarle
Kitware, Inc.
Principal Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909
On Wed, Oct 25, 2017 at 12:32 PM, Heiland, Randy <heiland at iu.edu> wrote:
> How does one use 2 (or more) scalar fields in a dataset, e.g. one for a
> colormap, one to scale glyphs? E.g., Pgmable Source:
>
> pdo = self.GetPolyDataOutput()
>
> num_pts = 2
> newPts = vtk.vtkPoints()
> cell_color_ID = vtk.vtkFloatArray()
> cell_radius = vtk.vtkFloatArray()
>
> cell_color_ID.SetName('cell_color_ID')
> cell_radius.SetName('cell_radius')
>
> newPts.InsertPoint(0, -1,0,0)
> cell_color_ID.InsertNextValue(1)
> cell_radius.InsertNextValue(0.2)
>
> newPts.InsertPoint(1, 1,0,0)
> cell_color_ID.InsertNextValue(2)
> cell_radius.InsertNextValue(0.3)
>
> pdo.SetPoints(newPts)
> pdo.GetPointData().SetScalars(cell_color_ID)
> pdo.GetPointData().SetScalars(cell_radius) # overrides the 1st
>
> verts = vtk.vtkCellArray()
> for idx in range(0, num_pts):
> verts.InsertNextCell(1)
> verts.InsertCellPoint(idx)
> pdo.SetVerts(verts)
>
>
> thanks, Randy
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20171025/1bc23770/attachment.html>
More information about the ParaView
mailing list