This is indeed a bug. I've reported it here [1]. Attached script shows
how to overcome this issue in 4.3. You'll need to add the following
stub to your code. Note this is only a workaround. Once the bug is
fixed, one should not use this hack.
#-----------------------------------------------
# HACK: Overcomes a bug# 15298
conn = servermanager.ActiveConnection
misc = conn.Modules.misc
servermanager.createModule("exporters", misc)
#-----------------------------------------------
[1] http://www.paraview.org/Bug/view.php?id=15298
On Mon, Feb 2, 2015 at 10:11 AM, Elias Pipping
<[email protected]> wrote:
> Dear list,
>
> I'm trying to export vector graphics through paraview's python interface(*).
> To that end, from within paraview, I start a python trace, use the UI to
> export to an embedded postscript file (via File->Export scene), and stop the
> trace again.
> The relevant lines of the trace look something like this:
>
> renderView1 = GetActiveViewOrCreate('RenderView')
> ExportView('test.eps', view=renderView1)
>
> Now I can open a python interpreter, paste these lines and get the expected
> result. So far, so good.
>
> Now let me retrace the above steps: After selecting a location to save to,
> I'm presented with a setting of export options. In the above scenario, I
> left everything as-is. I can choose among "rasterize 3d geometry", "draw
> background", etc. (the latter is an advanced option).
>
> If I change those options, they're passed to ExportView, yielding a line
> like the following in the trace:
>
> ExportView('test.eps', view=renderView1, Drawbackground=0,
> Rasterize3Dgeometry=0)
>
> While saving from the UI continues to work even in this case, running the
> above from within the python interpreter does not. Here's what I get:
>
> File
> "[..]/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/simple.py",
> line 1350, in ExportView
> SetProperties(proxy, **params)
> File
> "[..]/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/simple.py",
> line 449, in SetProperties
> raise AttributeError("object has no property %s" % param)
> AttributeError: object has no property Drawbackground
>
> Neither the field Drawbackground nor Rasterize3Dgeometry is recognised.
>
> Is the python interface currently incomplete in this respect? Is this easily
> fixed or is there a workaround for this issue?
>
>
> Best regards,
>
> Elias Pipping
>
> (*) All of this concerns a paraview 4.3.1 binary for linux
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
#-----------------------------------------------
# HACK: Overcomes a bug# 15298
conn = servermanager.ActiveConnection
misc = conn.Modules.misc
servermanager.createModule("exporters", misc)
#-----------------------------------------------
# create a new 'Sphere'
sphere1 = Sphere()
sphere1.ThetaResolution = 80
sphere1.PhiResolution = 80
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [938, 796]
# show data in view
sphere1Display = Show(sphere1, renderView1)
# trace defaults for the display properties.
sphere1Display.ColorArrayName = [None, '']
# reset view to fit data
renderView1.ResetCamera()
# export view
ExportView('/tmp/sample.eps', view=renderView1, Drawbackground=0,
Rasterize3Dgeometry=0)
_______________________________________________
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
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview