简体   繁体   English

在QVTKRenderWindowInteractor中使用vtkOrientationMarkerWidget [PyQt4 / PySide]

[英]Using vtkOrientationMarkerWidget with QVTKRenderWindowInteractor [PyQt4/PySide]

I working on a PySide/vtk GUI using QVTKRenderWindowInteractor widget class. 我使用QVTKRenderWindowInteractor小部件类处理PySide / vtk GUI。 The widget is working well, unless when I try to add a orientation axis (see image) using vtkOrientationMarkerWidget : 除非我尝试使用vtkOrientationMarkerWidget添加方向轴(参见图像),否则小部件运行良好:

axesActor = vtk.vtkAxesActor();
axes = vtk.vtkOrientationMarkerWidget()
axes.SetOrientationMarker(axesActor)
axes.SetInteractor(self.iren)
self.ren.AddActor(axesActor)
axes.EnabledOn() # <== application freeze-crash
axes.InteractiveOn()

A similar bug has been already reported for ubuntu , showing that the bug is reproduced only with Qt example , while the same example without Qt works well. 已经为ubuntu报告了一个类似的bug ,表明只有Qt示例才能重现该bug,而没有Qt的相同示例效果很好。

Any solution to this behavior ? 这种行为的任何解决方案? 在此输入图像描述

Got this answer from Nicholas R. Rypkema : 得到了Nicholas R. Rypkema的回答:

https://nrr.mit.edu/blog/note-about-vtk-pyqt-and-vtkorientationmarkerwidget https://nrr.mit.edu/blog/note-about-vtk-pyqt-and-vtkorientationmarkerwidget

Long story short : this will fix your problem 长话短说:这将解决你的问题

axesActor = vtk.vtkAxesActor();
self.axes = vtk.vtkOrientationMarkerWidget()
self.axes.SetOrientationMarker(axesActor)
self.axes.SetInteractor(self.iren)
self.ren.AddActor(axesActor)
self.axes.EnabledOn() # <== application freeze-crash
self.axes.InteractiveOn()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM