Skip to content

Instantly share code, notes, and snippets.

@vanne02135
Created March 29, 2011 18:40
Show Gist options
  • Save vanne02135/892962 to your computer and use it in GitHub Desktop.
Save vanne02135/892962 to your computer and use it in GitHub Desktop.
Create 3D points with associated data in Paraview Programmable source
# run in paraview programmable source
import math
pdo = self.GetOutput()
myPts = vtk.vtkPoints()
myData = vtk.vtkDoubleArray()
myData.SetName("MyData")
myData.SetNumberOfComponents(2)
Nx = 100
Ny = 100
for x in (xrange(Nx)):
for y in xrange(Ny):
myPts.InsertNextPoint(float(x), float(y), 0.0)
myData.InsertNextTuple2(1.0/(math.sqrt(x**2+y**2)+1), math.sqrt(x**2+y**2))
pdo.SetPoints(myPts)
pdo.GetPointData().SetScalars(myData)
@vanne02135
Copy link
Author

Wonder why the points won't show up on my osx 3.8.0 rc 1. They are there, since you can select them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment