首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当有两个视图时,Paraview不能SaveScreenshot -- append_pending_request:断言‘!xcb_xlib_unknown_seq_number’失败

当有两个视图时,Paraview不能SaveScreenshot -- append_pending_request:断言‘!xcb_xlib_unknown_seq_number’失败
EN

Stack Overflow用户
提问于 2018-02-13 13:05:01
回答 1查看 264关注 0票数 0

我在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脚本来:

  1. 从PVD读取器生成RenderView。
  2. SaveScreenshot。
  3. PlotOverLine来自RenderView。
  4. SaveScreenshot。

当从pvpython运行时,脚本会崩溃,但当从UI作为宏运行时,脚本就会运行。错误信息是

代码语言:javascript
复制
[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.ViewSizeImageResolution的参数才能得到一个合适的png,但我相信这是可行的。尽管如此,我的意思是不需要删除一个视图使其工作。

脚本的一个简约版本(删除了跟踪中的许多行)是:

代码语言:javascript
复制
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])
EN

回答 1

Stack Overflow用户

发布于 2018-02-15 11:36:56

鉴于pvbatch是:

  1. pvbatch无法交互运行。
  2. pvbatch支持并行处理。

我用的是ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/bin/pvbatch而不是ParaView-5.4.1-Qt5-OpenGL2-MPI-Linux-64bit/bin/pvpython,它起了作用。

我不知道是否有更好的或替代的解决办法。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48767529

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档