[Paraview] Construct Point Set in Python
Robert Maynard
thorin.hax at gmail.com
Wed Jul 18 10:15:44 EDT 2007
Currently I am unable to figure out how to create a set of points in
paraview with the python shell or programmable filter. I have constructed a
script
that can read a database and output a single point source for each point
(see below). Is there something I am missing to instead construct a point
set, or will I have to create a point set source object first?
#!/usr/bin/env python
import time
import sys
import paraview
from pysqlite2 import dbapi2 as sqlite
COLS_TO_GET = 100
# Locate the view to which we'll add the "display". All views are
# registered in the group "view_modules" with the proxy manager.
#pxm = paraview.pyProxyManager()
iter = pxm.group_iter("view_modules");
activeView = None
for proxy in iter:
if proxy.IsA("vtkSMRenderModuleProxy"):
activeView = proxy
break
if activeView:
db = sqlite.connect('/home/rmaynard/ProjParaview/rmaynard/Python/mine.db')
c = db.cursor()
#start time tracking
startTime = time.time()
c.execute('select * from data where lbExpl > 0')
cols = c.fetchmany(COLS_TO_GET)
for row in cols:
grab the row x, y, z
(x,y,z) = row[:3]
point = paraview.CreateProxy("sources","PointSource","sources",
"point.%d.%d.%d"%(x,y,z))
point.SetCenter(x,y,z)
point.UpdateVTKObjects();
disp = paraview.CreateDisplay(point, activeView);
activeView.StillRender();
#end time tracking
endTime = time.time()
print endTime-startTime
c.close()
db.close()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20070718/da09b23a/attachment.htm
More information about the ParaView
mailing list