[Paraview] Fetching Data via Script and Interactively

Matthew Cragun mcragun at totalsim.us
Tue Apr 6 13:53:58 EDT 2010


I have a bit of code where I read in a data file, extract a small portion of
it and then integrate the variables of the extracted portion.  In my python
code I then fetch the data from the server with the intent to write it out
to a log file.  The issue that I have come across is when I run my script in
the Python Shell it gives me <0,0,0> for my tuple.  Then if I repeat the
final four lines interactively in the Python Shell starting with the fetch
command I get a proper result of <0.14, 0.5, 0>.  Any ideas why I can't
fetch the data properly in the script but can right after in interactively?

The script looks like:

#**********************************************************8
#Do X-direction
xscale = 1.0
yscale = 1.0/(2*ymax)
zscale = 1.0/zmax

print "load Fluid"
fluid = XMLPolyDataReader(FileName=xSlice)
fluid.PointArrayStatus = ['U', 'p']
RenderView1 = GetRenderView()
DataRepresentation1 = Show()

print "extract Block"
fluidBlock = ExtractCellsByRegion(Input = fluid, IntersectWith = "Box")
fluidBlock.IntersectWith.Scale = [xscale, yscale, zscale]
DataRepresentation2 = Show()

print "integrate"
avgData = IntegrateVariables(Input = fluidBlock)
DataRepresentation3 = Show()
Render()

data = servermanager.Fetch(avgData,0)
pointData = data.GetPointData()
avgVar = pointData.GetArray(0).GetTuple3(0)
print avgVar
#****************************************************

Thanks,
-- 
Matt Cragun

Engineer
TotalSim LLC
7003 Post Road,
Suite 415
Dublin, Ohio 43016
O: (614) 255-7426
M: (801) 404-6021
E: mcragun at totalsim.us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100406/f8186e10/attachment.htm>


More information about the ParaView mailing list