[Paraview] How to export .x3d files from python script?

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu Oct 31 02:33:33 EDT 2013


Hi Rich,

Maybe the active view is not the one that has your rendering.
You may need to call SetView(RenderView2).

Seb



On Wed, Oct 30, 2013 at 6:41 PM, Cook, Rich <cook47 at llnl.gov> wrote:

>  Arrgh!
> I tried the following and the resulting file did not contain my isosurface
> as created by the below script.  What am I doing wrong here?  Sorry for the
> stream-of-consciousness posts here…
>
>  >>> exporters=servermanager.createModule("exporters")
>
>  >>> x3dExporter=exporters.X3DExporter(FileName="test.x3d")
> >>> view = GetActiveView()
>
>  >>> x3dExporter.SetView(view) # <===== NEW LINE
>
>  >>> x3dExporter.Write()
>
>
>  On Oct 30, 2013, at 5:14 PM, "Cook, Rich" <cook47 at llnl.gov>
>  wrote:
>
>  … and immediately got the answer from google:
> http://www.paraview.org/pipermail/paraview/2012-May/024921.html
>
>  However, I'm still curious as to how the person in question discovered
> how to do it.  Where is all the good python documentation/lore stored?  The
> wiki wasn't too helpful to me in that respect, i.e., as a reference,
> although it has a lot of good ideas/information.
>
>  -- Rich
>
>  On Oct 30, 2013, at 5:05 PM, "Cook, Rich" <cook47 at llnl.gov>
>  wrote:
>
>  I recorded a script to try to understand how to export a time series of
> an isosurface as .x3d files so I can muck with them using blender.  But
> when I look at the script, the crucial bit of exporting the .x3d did not
> get captured.  Is that part not scriptable?  How can I go about finding out
> for myself which file formats can be exported from python scripts, if any?
> Thanks
>
>  Here is the script that got captured:
>
>  try: paraview.simple
> except: from paraview.simple import *
> paraview.simple._DisableFirstRenderCameraReset()
>
>  plot_raw = VisItMirandaReader(
> FileName='/nfs/tmp2/rcook/miranda/IRM_512_r1/plot.raw' )
>
>  AnimationScene2 = GetAnimationScene()
> AnimationScene1 = GetAnimationScene()
> plot_raw.CellArrays = []
> plot_raw.Materials = []
> plot_raw.Meshes = ['mesh']
> plot_raw.PointArrays = []
>
>  AnimationScene2.EndTime = 110.0
> AnimationScene2.PlayMode = 'Snap To TimeSteps'
>
>  AnimationScene1.EndTime = 110.0
> AnimationScene1.PlayMode = 'Snap To TimeSteps'
>
>  RenderView2 = GetRenderView()
> DataRepresentation4 = Show()
> DataRepresentation4.Representation = 'Outline'
> DataRepresentation4.ScaleFactor = 51.200000000000003
> DataRepresentation4.EdgeColor = [0.0, 0.0, 0.50000762951094835]
> DataRepresentation4.SelectionCellFieldDataArrayName = 'density'
>
>  plot_raw.CellArrays = ['density']
>
>  CellDatatoPointData2 = CellDatatoPointData()
>
>  RenderView2.CameraFocalPoint = [255.5, 255.5, -0.5]
> RenderView2.CameraClippingRange = [829.67380753909174, 2829.4767488865327]
> RenderView2.CameraPosition = [-979.92119013571846, 1113.4340644820502,
> -820.67547187352602]
>
>  DataRepresentation5 = Show()
> DataRepresentation5.EdgeColor = [0.0, 0.0, 0.50000762951094835]
> DataRepresentation5.SelectionPointFieldDataArrayName = 'density'
> DataRepresentation5.SelectionCellFieldDataArrayName = 'density'
> DataRepresentation5.Representation = 'Outline'
> DataRepresentation5.ScaleFactor = 51.200000000000003
>
>  DataRepresentation4.Visibility = 0
>
>  Contour2 = Contour( PointMergeMethod="Uniform Binning" )
>
>  Contour2.PointMergeMethod = "Uniform Binning"
> Contour2.ContourBy = ['POINTS', 'density']
> Contour2.Isosurfaces = [2.0]
>
>  DataRepresentation6 = Show()
> DataRepresentation6.ScaleFactor = 51.200000000000003
> DataRepresentation6.EdgeColor = [0.0, 0.0, 0.50000762951094835]
> DataRepresentation6.SelectionPointFieldDataArrayName = 'Normals'
> DataRepresentation6.SelectionCellFieldDataArrayName = 'density'
>
>  AnimationScene2.AnimationTime = 10.0
>
>  RenderView2.CameraViewUp = [-0.80853642549145055, -0.58010037415785698,
> 0.098754263479722132]
> RenderView2.CacheKey = 10.0
> RenderView2.CameraPosition = [402.40688029765732, -227.93136313665994,
> -1637.4840153022406]
> RenderView2.CameraClippingRange = [1504.1196765479444, 1981.483268233957]
> RenderView2.ViewTime = 10.0
> RenderView2.RemoteRenderThreshold = 2.0
> RenderView2.UseCache = 0
> RenderView2.CameraFocalPoint = [255.5, 255.49999999999989,
> -0.49999999999999883]
>
>  Render()
>
>  --
> ✐Richard Cook
> ✇ Lawrence Livermore National Laboratory
> Bldg-453 Rm-4024, Mail Stop L-557
> 7000 East Avenue,  Livermore, CA, 94550, USA
> ☎ (office) (925) 423-9605
> ☎ (fax) (925) 423-6961
> ---
> Information Management & Graphics Grp., Services & Development Div.,
> Integrated Computing & Communications Dept.
> (opinions expressed herein are mine and not those of LLNL)
>
>
>
>
>  --
> ✐Richard Cook
> ✇ Lawrence Livermore National Laboratory
> Bldg-453 Rm-4024, Mail Stop L-557
> 7000 East Avenue,  Livermore, CA, 94550, USA
> ☎ (office) (925) 423-9605
> ☎ (fax) (925) 423-6961
> ---
> Information Management & Graphics Grp., Services & Development Div.,
> Integrated Computing & Communications Dept.
> (opinions expressed herein are mine and not those of LLNL)
>
>
>
>
>  --
> ✐Richard Cook
> ✇ Lawrence Livermore National Laboratory
> Bldg-453 Rm-4024, Mail Stop L-557
> 7000 East Avenue,  Livermore, CA, 94550, USA
> ☎ (office) (925) 423-9605
> ☎ (fax) (925) 423-6961
> ---
> Information Management & Graphics Grp., Services & Development Div.,
> Integrated Computing & Communications Dept.
> (opinions expressed herein are mine and not those of LLNL)
>
>
>
>
> _______________________________________________
> 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/20131031/6158bfc7/attachment-0001.htm>


More information about the ParaView mailing list