Re: [Paraview] simple Programmable Source

2017-10-12 Thread Heiland, Randy
Yes! (banging forehead)  Thanks very much, Cory.

> On Oct 11, 2017, at 11:10 PM, Cory Quammen  wrote:
> 
> Randy,
> 
> Try setting a name on the array with
> 
> scalars.SetName('array_name')
> 
> This should let you select this array as the color array in ParaView.
> 
> - Cory
> 
> On Wed, Oct 11, 2017 at 9:48 PM, Heiland, Randy  > wrote:
> I create the following in the Pgmable Source in PV, but cannot figure out how 
> to color the resulting points or 3D glyphs using the scalar values. What am I 
> missing?
> -Randy
> 
> # Get a vtk.PolyData object for the output
> pdo = self.GetPolyDataOutput()
> 
> # Create points
> num_pts = 3
> newPts = vtk.vtkPoints()
> scalars = vtk.vtkFloatArray()
> 
> xval = -1.0
> for idx in range(0, num_pts):
>   # rf. PhysiCell User Guide for these array indices to a cell's position.
>   x = xval
>   y = 0.0
>   z = 0.0
>   newPts.InsertPoint(idx, x,y,z)
>   sval = xval*2
>   scalars.InsertNextValue(sval)
>   xval += 1.0
> 
> # Add the points to the vtkPolyData object.
> pdo.SetPoints(newPts)
> pdo.GetPointData().SetScalars(scalars)
> 
> verts = vtk.vtkCellArray()
> for idx in range(0, num_pts):
>   verts.InsertNextCell(1)
>   verts.InsertCellPoint(idx)
> 
> pdo.SetVerts(verts)
> 
> 
> 
> ___
> 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 
> 
> 
> 
> 
> 
> -- 
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.



smime.p7s
Description: S/MIME cryptographic signature
___
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


Re: [Paraview] simple Programmable Source

2017-10-11 Thread Cory Quammen
Randy,

Try setting a name on the array with

scalars.SetName('array_name')

This should let you select this array as the color array in ParaView.

- Cory

On Wed, Oct 11, 2017 at 9:48 PM, Heiland, Randy  wrote:

> I create the following in the Pgmable Source in PV, but cannot figure out
> how to color the resulting points or 3D glyphs using the scalar values.
> What am I missing?
> -Randy
>
> # Get a vtk.PolyData object for the output
> pdo = self.GetPolyDataOutput()
>
> # Create points
> num_pts = 3
> newPts = vtk.vtkPoints()
> scalars = vtk.vtkFloatArray()
>
> xval = -1.0
> for idx in range(0, num_pts):
>   # rf. PhysiCell User Guide for these array indices to a cell's position.
>   x = xval
>   y = 0.0
>   z = 0.0
>   newPts.InsertPoint(idx, x,y,z)
>   sval = xval*2
>   scalars.InsertNextValue(sval)
>   xval += 1.0
>
> # Add the points to the vtkPolyData object.
> pdo.SetPoints(newPts)
> pdo.GetPointData().SetScalars(scalars)
>
> verts = vtk.vtkCellArray()
> for idx in range(0, num_pts):
>   verts.InsertNextCell(1)
>   verts.InsertCellPoint(idx)
>
> pdo.SetVerts(verts)
>
>
>
> ___
> 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
>
>


-- 
Cory Quammen
Staff 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


[Paraview] simple Programmable Source

2017-10-11 Thread Heiland, Randy
I create the following in the Pgmable Source in PV, but cannot figure out how 
to color the resulting points or 3D glyphs using the scalar values. What am I 
missing?
-Randy

# Get a vtk.PolyData object for the output
pdo = self.GetPolyDataOutput()

# Create points
num_pts = 3
newPts = vtk.vtkPoints()
scalars = vtk.vtkFloatArray()

xval = -1.0
for idx in range(0, num_pts):
  # rf. PhysiCell User Guide for these array indices to a cell's position.
  x = xval
  y = 0.0
  z = 0.0
  newPts.InsertPoint(idx, x,y,z)
  sval = xval*2
  scalars.InsertNextValue(sval)
  xval += 1.0

# Add the points to the vtkPolyData object.
pdo.SetPoints(newPts)
pdo.GetPointData().SetScalars(scalars)

verts = vtk.vtkCellArray()
for idx in range(0, num_pts):
  verts.InsertNextCell(1)
  verts.InsertCellPoint(idx)

pdo.SetVerts(verts)




smime.p7s
Description: S/MIME cryptographic signature
___
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