[vtkusers] Rotate vtkCubeAxesActor

Sebastien Jourdain sebastien.jourdain at kitware.com
Fri Apr 19 11:08:09 EDT 2013


Hi Michka,

the vtkCubeAxesActor will always be axis aligned no matter what, unless you
update to vtk6 and create your own set of base vector for it.
If you checkout the current version of the source code, you can look at the
test made on the CubeAxis to see how to do what you try to achieve here.

Seb


On Fri, Apr 19, 2013 at 8:51 AM, Michka Popoff <michkapopoff at gmail.com>wrote:

> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130419/6ff5c7f8/attachment.htm>


More information about the vtkusers mailing list