[Paraview] Internal volume vs. external surface via python interface?

Greg Schussman schussman at slac.stanford.edu
Fri Apr 30 13:09:14 EDT 2010


Hi, Everyone.

I am trying to display a slice from a volume dataset, but when I use the 
python interface, all I get is a slice of the external surface.  Within 
paraview's gui, there is no problem selecting "External Surface" vs. 
"Internal Volume".

I have tried comparing python traces of slicing entire volume vs. 
exterior surface, but the traces are, for all practical purposes, 
identical.  I also tried looking at a trace of changing the slice's 
input, but the trace seems to have no relevant information.

I tried comparing trace state, with no important difference found.   I 
tried comparing saved state (.pvsm) files, but saw no difference there 
except for id kinds of numbers.

I think that ll9cellf523_ncdf (see below) has two output ports, where 0 
is the surface and 1 is the entire volume, but I'm not sure of that.   
 From "Paraview Scripting with Python" (August 2007), page 15, it looks 
like I should be able to:

      Slice1.Input = OutputPort(ll9cellf523_ncdf, 1)

But that gives

     NameError: name 'OutputPort' is not defined

Trying either

     Slice1.Input = ll9cellf523_ncdf.Port(0)
     Slice1.Input = ll9cellf523_ncdf.Port(1)

runs, but the slice is still only slicing the external surface.

My test script is below.

Thanks for any help.

Greg

    #!/usr/bin/python

    try: paraview.simple
    except: from paraview.simple import *

    ll9cellf523_ncdf = SLACDataReader(MeshFileName='./ll-9cell-f523.ncdf' )
    ll9cellf523_ncdf.ModeFileName =
    ['./mode0.l0.R2.457087E+09I5.096430E+04.m2']
    ll9cellf523_ncdf.ReadInternalVolume = 1

    a3_efield_PVLookupTable = \
        GetLookupTableForArray( "efield", 3,
                                RGBPoints=[0.0,   0.0, 0.0, 1.0,
                                           19.0,  1.0, 0.0, 0.0],
                                VectorMode='Magnitude',
                                ColorSpace='HSV',
                                ScalarRangeInitialized=1.0 )

    RenderView1 = GetRenderView()
    RenderView1.CameraPosition = [-1.1, 0.0, 0.7]
    RenderView1.CameraFocalPoint = [0.0, 0.0, 0.7]
    RenderView1.CameraClippingRange = [2.68, 3.33]

    a3_efield_PVLookupTable.RGBPoints = [0.0,   0.0, 0.0, 1.0,
                                          19.0,  1.0, 0.0, 0.0]

    Slice1 = Slice( SliceType="Plane" )
    Slice1.SliceType.Origin = [-0.023, 0.0, 0.7]
    Slice1.SliceOffsetValues = [0.0]
    Slice1.SliceType = "Plane"

    DataRepresentation1 = Show()
    DataRepresentation1.ColorArrayName = 'efield'
    DataRepresentation1.LookupTable = a3_efield_PVLookupTable
    DataRepresentation1.ColorAttributeType = 'POINT_DATA'

    ###########################################################

    UpdatePipeline()

    view            = GetActiveView()
    view.Background = [1, 1, 1]
    view.ViewSize   = [800, 300]

    WriteImage("test.png")


p.s., I actually want to do something else (use a calculator to get 
efield magnitude, and then plot isocontour surfaces from that), but this 
slice example seemed simplest, and I'm assuming that once that works, 
the other stuff will work in the same way.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100430/a518158c/attachment.htm>


More information about the ParaView mailing list