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

pat marion pat.marion at kitware.com
Fri Apr 30 14:07:20 EDT 2010


Yes, that works.  Actually, this might be even better- put this line
anywhere after 'from paraview.simple import *', and before the first call to
Render:

paraview.simple._funcs_internals.first_render = False

Pat

On Fri, Apr 30, 2010 at 1:57 PM, Greg Schussman <schussman at slac.stanford.edu
> wrote:

>  On 04/30/10 10:48, pat marion wrote:
>
> Hi Greg,
>
> Sorry I am unable to answer your question right now, but I just wanted to
> warn you about an issue in your script.  Paraview tries to be clever and it
> resets the camera on the first call to Render after the paraview.simple
> module is imported.  So if you create a render view, set the camera
> properties, and call render, you're not going to get what you expect to
> see.  Until we add a fix for this, the best workaround is to call Render()
> once before setting the camera properties.
>
> Hi, Pat.
>
> Thanks for the tip.   So if I put this into my script, should the
> RenderView1 portion now look like this?
>
> RenderView1 = GetRenderView()
> Render()  # needed before setting camera properties to prevent auto camera
> reset
>
> RenderView1.CameraPosition = [-1.1, 0.0, 0.7]
> RenderView1.CameraFocalPoint = [0.0, 0.0, 0.7]
> RenderView1.CameraClippingRange = [2.68, 3.33]
>
> Is that correct?
>
> Thanks again.
>
> Greg
>
>
>
>
> Pat
>
> On Fri, Apr 30, 2010 at 1:09 PM, Greg Schussman <
> schussman at slac.stanford.edu> wrote:
>
>> 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.
>>
>>
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100430/1be3032e/attachment-0001.htm>


More information about the ParaView mailing list