我在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
,但我相信这会有效。
不过,我的意思是不需要删除一个View来使其工作。
<小时/> 脚本的简约版本(删除了Trace中的许多行)是:
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])
答案 0 :(得分:0)
鉴于differences between pvpython
and 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
它有效。
我不知道是否有更好或替代的解决方案。