[vtkusers] Rotate vtkCubeAxesActor

Michka Popoff michkapopoff at gmail.com
Fri Apr 19 08:51:31 EDT 2013


Hello

I am using the latest vtk 5.10 and I am not able to rotate a vtkCubeAxesActor. The vtkCubeAxesActor has as parents 
vtkActor and vtkProp3D. The vtkProp3D class has RotateX, RotateY, and RotateZ methods, which I already use to rotate another vtkActor, which is a meshgrid (working nicely).

But if I use one of these rotation methods on vtkCubeAxesActor, nothing happens (no rotation; no error message). Is this the way I should rotate vtkCubeAxesActor, or is there another way ? Here is a minimal example (in python with PyQT) to show you what I want to achieve. Adding or removing the RotateZ(45) gives twice the same result …


#!/usr/bin/env python

from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QApplication
import vtk
from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
import sys
 
class SimpleView(QtGui.QMainWindow):
 
    def __init__(self, parent = None):
        QtGui.QMainWindow.__init__(self, parent)
        
        self.centralWidget = QtGui.QWidget()
        self.layout = QtGui.QVBoxLayout()
        
        self.widget = QVTKRenderWindowInteractor(self.centralWidget)
        self.renderer = vtk.vtkRenderer()
        self.widget.GetRenderWindow().AddRenderer(self.renderer)
        self.widget.Initialize()
        self.widget.Start()
        
        self.actorAxes = vtk.vtkCubeAxesActor()
        self.actorAxes.SetCamera(self.renderer.GetActiveCamera())
        self.actorAxes.RotateZ(45)
        self.renderer.AddActor(self.actorAxes)
        
        self.renderer.Render()
        
        self.renderer.ResetCameraClippingRange()
        
        self.renderer.ResetCamera()

        self.layout.addWidget(self.widget)
        self.centralWidget.setLayout(self.layout)
        self.setCentralWidget(self.centralWidget)
 
if __name__ == "__main__":
 
    app = QApplication(sys.argv)
    window = SimpleView()
    window.show()
    window.resize(800, 600)
    sys.exit(app.exec_())


Thank you in advance

Michka Popoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130419/73cb8097/attachment.htm>


More information about the vtkusers mailing list