Created
March 29, 2011 18:40
-
-
Save vanne02135/892962 to your computer and use it in GitHub Desktop.
Create 3D points with associated data in Paraview Programmable source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wonder why the points won't show up on my osx 3.8.0 rc 1. They are there, since you can select them.