[Paraview] Export X3D Files via Python >version 3.8
Sebastien Jourdain
sebastien.jourdain at kitware.com
Wed Nov 14 09:06:47 EST 2012
Instead of exporters.X3DExporter try to use exporters.X3DExporterBinary.
Seb
On Wed, Nov 14, 2012 at 7:19 AM, Andrea Beck <beck at iag.uni-stuttgart.de>wrote:
> Hi everyone, hi Sebastien,
> I have a follow-up question about the exporting of X3D files via python. I
> noticed that the X3DExporter (see code below) works fine, but creates only
> ascii- X3D files, not the binary ones (*.X3Db). The binary export is
> available through the GUI, so I'm pretty sure there must a python way of
> doing it. I tried some obvious first guesses (renamed exporters.X3DExporter(
> **FileName="foo.x3d") to exporters.X3DBinaryExporter(**FileName="foo.x3d")
> for example ) , but couldn't find a way to do it. Is there some easy way to
> export as binary x3d, instead of ascii?
>
> Thanks for reading, best regards
> Andrea
>
>
>
>
> Sebastien Jourdain wrote:
>
>> Hi guys,
>>
>> the solution is as follow:
>>
>> from paraview.simple import *
>> exporters=servermanager.**createModule("exporters")
>> source=Cone()
>> view = GetActiveView()
>> Show(view)
>> render=Render()
>> x3dExporter=exporters.**X3DExporter(FileName="foo.x3d"**)
>> x3dExporter.SetView(view) # <===== NEW LINE
>> x3dExporter.Write()
>>
>> The reason for that is SetView and Write are not Proxy properties but
>> local methods on the current proxy implementation. Therefore, you must
>> call them as is.
>>
>> Seb
>>
>> On Wed, May 9, 2012 at 3:28 PM, <shpatric at vt.edu> wrote:
>>
>>> Hi,
>>> I too have this issue. I did find that View and Write attributes of
>>> X3DExporter were removed from the
>>> ParaViewCore/**ServerImplementation/**Resources/utilities.xml but
>>> removing View
>>> does work but does not write the file.
>>>
>>> The updated python script looks like:
>>>
>>>
>>> from paraview.simple import *
>>> exporters=servermanager.**createModule("exporters")
>>> source=Cone()
>>> view = GetActiveView()
>>> Show(view)
>>> render=Render()
>>> x3dExporter=exporters.**X3DExporter(FileName="foo.x3d"**)
>>> x3dExporter.Write()
>>>
>>> If source, view, or render are added to the x3dexporter constructor such
>>> as
>>>
>>> x3dExporter=exporters.**X3DExporter(source,FileName="**foo.x3d")
>>>
>>> I get recursive errors:
>>> Exception exceptions.RuntimeError: 'maximum recursion depth exceeded' in
>>> <bound method X3DExporter.__del__ of <paraview.servermanager.**
>>> X3DExporter
>>> object at 0x2b8e69567f10>> ignored
>>>
>>>
>>> Hopefully this bug is fixed soon or someone with knowledge can provide
>>> the
>>> correct way to use it.
>>>
>>> Thanks,
>>> Pat
>>>
>>>
>>> Quoting Andrea Beck <beck at iag.uni-stuttgart.de>:
>>>
>>> Hey folks,
>>>> I'm looking for a way to export X3D files with a python script for
>>>> Paraview version 3.14.
>>>> In v 3.8, what worked was:
>>>>
>>>> from paraview.simple import *
>>>> exporters=servermanager.**createModule("exporters")
>>>> Cone()
>>>> Show()
>>>> SetActiveView(GetRenderView())
>>>> Render()
>>>> x3dExporter=exporters.**X3DExporter(View=view,
>>>> FileName="/home/iagbeck/demo/**foo.x3d")
>>>> x3dExporter.Write()
>>>>
>>>> but that won't work in any version > 3.8 (see also bug tracker report
>>>> here: http://vtk.org/Bug/view.php?**id=12738<http://vtk.org/Bug/view.php?id=12738>
>>>> ).
>>>> <http://vtk.org/Bug/view.php?**id=12738<http://vtk.org/Bug/view.php?id=12738>
>>>> >
>>>>
>>>>
>>>> Is there anyone who knows how to do that? Alternatively, if you have
>>>> some
>>>> code snippets about exporting / importing files (tecplot bins) lying
>>>> around,
>>>> please let me know!
>>>>
>>>> Thanks for the help!
>>>>
>>>> Andrea
>>>> <http://vtk.org/Bug/view.php?**id=12738<http://vtk.org/Bug/view.php?id=12738>
>>>> >
>>>>
>>>>
>>> ______________________________**_________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/**opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>>>
>>> Please keep messages on-topic and check the ParaView Wiki at:
>>> http://paraview.org/Wiki/**ParaView <http://paraview.org/Wiki/ParaView>
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.paraview.org/**mailman/listinfo/paraview<http://www.paraview.org/mailman/listinfo/paraview>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20121114/ee9b6532/attachment.htm>
More information about the ParaView
mailing list