我在Ubuntu 16.04 LTS下。我使用的是ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/bin/pvpython,简单地从ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit.tar.gz扩展
我有一个python脚本来:
当从pvpython运行时,脚本会崩溃,但当从UI作为宏运行时,脚本就会运行。错误信息是
[xcb] Unknown sequence number while appending request
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
pvpython: ../../src/xcb_io.c:161: append_pending_request: Assertion `!xcb_xlib_unknown_seq_number' failed.我怎样才能做到这一点?
添加EXTRA LINES (请参阅下面的代码)错误消失。我仍然需要调优lineChartView1.ViewSize和ImageResolution的参数才能得到一个合适的png,但我相信这是可行的。尽管如此,我的意思是不需要删除一个视图使其工作。
脚本的一个简约版本(删除了跟踪中的许多行)是:
from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
# 1. Generate a RenderView from a PVD reader.
pvdreader = PVDReader(FileName='mydata.pvd')
animationScene1 = GetAnimationScene()
animationScene1.UpdateAnimationUsingDataTimeSteps()
renderView1 = GetActiveViewOrCreate('RenderView')
renderView1.ViewSize = [1554, 838]
pvdreaderDisplay = Show(pvdreader, renderView1)
renderView1.ResetCamera()
renderView1.Update()
layout1 = GetLayout()
# 2. SaveScreenshot.
SaveScreenshot('last_frame_render.png', renderView1, ImageResolution=[1554, 838])
# 3. PlotOverLine from the RenderView.
plotOverLine1 = PlotOverLine(Input=pvdreader, Source='High Resolution Line Source')
plotOverLine1.Source.Point1 = [-5.0, -5.0, 0.0]
plotOverLine1.Source.Point2 = [5.0, 5.0, 0.0]
plotOverLine1Display = Show(plotOverLine1, renderView1)
lineChartView1 = CreateView('XYChartView')
layout1.AssignView(2, lineChartView1)
plotOverLine1Display_1 = Show(plotOverLine1, lineChartView1)
# ========================== EXTRA LINES ==============================
# destroy renderView1
Delete(renderView1)
del renderView1
layout1.Collapse(1)
# =======================================================================
lineChartView1.ViewSize = [1554, 838]
lineChartView1.Update()
# 4. SaveScreenshot.
SaveScreenshot('last_frame_linechart.png', lineChartView1, ImageResolution=[772, 838])发布于 2018-02-15 11:36:56
鉴于pvbatch是:
pvbatch无法交互运行。pvbatch支持并行处理。我用的是ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/bin/pvbatch而不是ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/bin/pvpython,它起了作用。
我不知道是否有更好的或替代的解决办法。
https://stackoverflow.com/questions/48767529
复制相似问题