<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Well, I was able to transplant your code into a PyQt4 app. (Since you're using Python, I'm assuming that's what you're using...?) Here's the code that works on my system and a screenshot.<div><br></div><div>-Eric</div><div><br></div><div><img id="5160eafa-bc6b-4df6-86b5-846a40d4e437" height="410" width="416" apple-width="yes" apple-height="yes" src="cid:D11D54FE-D39E-4F1C-BCDA-228422C788F0@trinity.duke.edu"></div><div><br></div><div><br></div><div><div>from PyQt4 import QtCore, QtGui</div><div>from PyQt4.QtGui import QApplication</div><div>import vtk</div><div>from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor</div><div>import sys</div><div><br></div><div>class Ui_MainWindow(object):</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>def setupUi(self, MainWindow):</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>MainWindow.setObjectName("MainWindow")</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>MainWindow.resize(603, 553)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.centralWidget = QtGui.QWidget(MainWindow)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.gridlayout = QtGui.QGridLayout(self.centralWidget)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.vtkWidget = QVTKRenderWindowInteractor(self.centralWidget)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.gridlayout.addWidget(self.vtkWidget, 0, 0, 1, 1)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>MainWindow.setCentralWidget(self.centralWidget)</div><div><br></div><div>class SimpleView(QtGui.QMainWindow):</div><div> </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>def __init__(self, parent = None):</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>QtGui.QMainWindow.__init__(self, parent)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.ui = Ui_MainWindow() </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.ui.setupUi(self)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.ren = vtk.vtkRenderer()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>iren = self.ui.vtkWidget.GetRenderWindow().GetInteractor()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>cube = vtk.vtkCubeSource()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>cube.SetXLength(200)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>cube.SetYLength(200)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>cube.SetZLength(200)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>cube.Update()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>cm = vtk.vtkPolyDataMapper()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>cm.SetInputConnection(cube.GetOutputPort())</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>ca = vtk.vtkActor()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>ca.SetMapper(cm)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.ren.AddActor(ca)</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor = vtk.vtkAnnotatedCubeActor();</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.SetXPlusFaceText('R')</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.SetXMinusFaceText('L')</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.SetYMinusFaceText('H')</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.SetYPlusFaceText('F')</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.SetZMinusFaceText('P')</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.SetZPlusFaceText('A')</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.GetTextEdgesProperty().SetColor(1,1,0)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.GetTextEdgesProperty().SetLineWidth(2)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axesActor.GetCubeProperty().SetColor(0,0,1)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axes = vtk.vtkOrientationMarkerWidget()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axes.SetOrientationMarker(self.axesActor)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axes.SetInteractor(iren)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axes.EnabledOn()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.axes.InteractiveOn()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>self.ren.ResetCamera()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>iren.Start()</div><div> </div><div>if __name__ == "__main__":</div><div><br></div><div> app = QApplication(sys.argv)</div><div> window = SimpleView()</div><div> window.show()</div><div> sys.exit(app.exec_())</div></div><div><br></div><div><br></div><div><br><div><div>On Jun 23, 2010, at 10:24 AM, Jothy wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Why my orientationWidget is show like the one shown in the attached picture?<br><br>Its a vtkAxesActor+vtkOrientationWidget with a cube rendered in QVTKWidget.<br><br><br>Thanks,<br><br>Jothy<br><br><br><div class="gmail_quote">
On Wed, Jun 23, 2010 at 3:07 PM, Jothy <span dir="ltr"><<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">And it also appears cropped, I mean only the centre portion is visible.<br><br>How to get the camera of the orientation widget renderer? So that I can reset it.<br><br>Thanks,<br><font color="#888888"><br>Jothy</font><div>
<div></div><div class="h5"><br><br><div class="gmail_quote">
On Wed, Jun 23, 2010 at 2:23 PM, Jothy <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">No Eric,<br><br>The problem is not with this code, with this script I can rotate without calling start().But, when I embed it into a QVTKWidget, it doesn't work as expected. Did you tried with QVTKWidget?<br>
<br>Thanks,<br><font color="#888888"><br>Jothy</font><div><div></div><div><br><br><div class="gmail_quote">On Wed, Jun 23, 2010 at 2:18 PM, Eric E. Monson <span dir="ltr"><<a href="mailto:emonson@cs.duke.edu" target="_blank">emonson@cs.duke.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hey Jothy,<br>
<br>
If I add iren.Start() at the end of this code it works for me. The blue cube in the corner spins with the big white cube.<br>
<br>
-Eric<br>
<br>
------------------------------------------------------<br>
<font color="#888888">Eric E Monson<br>
Duke Visualization Technology Group<br>
</font><div><div></div><div><br>
<br>
On Jun 23, 2010, at 7:29 AM, Jothy wrote:<br>
<br>
> Hi all,<br>
><br>
> I am trying to add a vtkOrientationMarkerWidget to a QVTKWidget. The annotatedCube is displayed in the corner but it doesn't rotate along with the other actors.<br>
><br>
> I checkd the code with vtkRenderWindow, it works well. What is the problem??<br>
><br>
> Below is the code<br>
><br>
><br>
><br>
> from vtk import*<br>
> cube=vtkCubeSource()<br>
> cube.SetXLength(200)<br>
> cube.SetYLength(200)<br>
> cube.SetZLength(200)<br>
> cube.Update()<br>
> cm=vtkPolyDataMapper()<br>
> cm.SetInputConnection(cube.GetOutputPort())<br>
> ca=vtkActor()<br>
> ca.SetMapper(cm)<br>
><br>
> renWin = vtkRenderWindow()<br>
> ren=vtkRenderer()<br>
> ren.AddActor(ca)<br>
> renWin.AddRenderer(ren)<br>
> iren = vtkRenderWindowInteractor()<br>
> iren.SetRenderWindow(renWin)<br>
> ren.SetBackground(0,0,0)<br>
> renWin.Render()<br>
><br>
> axesActor = vtkAnnotatedCubeActor();<br>
> axesActor.SetXPlusFaceText('R')<br>
> axesActor.SetXMinusFaceText('L')<br>
> axesActor.SetYMinusFaceText('H')<br>
> axesActor.SetYPlusFaceText('F')<br>
> axesActor.SetZMinusFaceText('P')<br>
> axesActor.SetZPlusFaceText('A')<br>
> axesActor.GetTextEdgesProperty().SetColor(1,1,0)<br>
> axesActor.GetTextEdgesProperty().SetLineWidth(2)<br>
> axesActor.GetCubeProperty().SetColor(0,0,1)<br>
> axes = vtkOrientationMarkerWidget();<br>
> axes.SetOrientationMarker(axesActor);<br>
> axes.SetInteractor(iren);<br>
> axes.EnabledOn();<br>
> axes.InteractiveOn();<br>
><br>
><br>
> Thanks,<br>
><br>
> Jothy<br>
><br>
><br>
><br>
><br>
><br>
</div></div><div><div></div><div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>
<span><untitled.TIF></span></blockquote></div><br></div></body></html>