<div dir="ltr"><div>Hi vtk users,<br><br></div>Has any of you experienced problems when trying to register the interaction event into a vtkImplicitPlaneWidget2 observer in an application with PyQt4? <br clear="all"><div><div><br></div><div>I can successfully register the event out of PyQt4 app. However, when I am trying to get vtkImplicitPlaneWidget2 to my PyQt4 application, the AddObserver is not registered. The widget is properly displayed but I cannot access the interaction mode. Thus, when I am moving the object, the widget disappears. <br><br></div><div>In particular, I am trying to clip an unstructured grid and my clip method looks like the following:<br><br> plane = vtkPlane()<br> plane.SetOrigin(0.0, 0.0, 0.0) <br> <br> clipData = vtkClipDataSet()<br> clipData.SetInputData(actUG)<br> clipData.SetClipFunction(plane)<br> clipData.InsideOutOn()<br> clipData.Update()<br> <br> clipMapper = vtkDataSetMapper()<br> clipMapper.ImmediateModeRenderingOn()<br> clipMapper.SetInputData(clipData.GetOutput())<br> <br> clipActor = vtkLODActor()<br> clipActor.SetMapper(clipMapper)<br> clipActor.VisibilityOn()<br> clipActor.SetScale(1.01, 1.01, 1.01)<br> <br></div><div> # the following is my QWidget which contains the QVTKRenderWindowInteractor<br></div><div> self.formWidgetC.iren.SetRenderWindow(self.formWidgetC.vtkWidget.GetRenderWindow())<br># backFaces = vtkProperty()<br># backFaces.SetDiffuseColor(0.8, 0.8, 0.4)<br># clipActor.SetBackfaceProperty(backFaces)<br> def callback(pw, event):<br> print("triggered")<br> pw.GetRepresentation().GetPlane(plane)<br> clipActor.VisibilityOn()<br><br> rep = vtkImplicitPlaneRepresentation()<br> rep.SetPlaceFactor(1.25)<br> rep.PlaceWidget(actUG.GetBounds())<br> rep.SetNormal(plane.GetNormal())<br> rep.VisibilityOn()<br> rep.GetPlane(plane)<br> <br> planeWidget = vtkImplicitPlaneWidget2()<br> planeWidget.SetInteractor(self.formWidgetC.iren)<br> planeWidget.SetRepresentation(rep) <br> planeWidget.SetEnabled(1)<br># planeWidget.On() <br># planeWidget.SetInputData(actUG)<br># planeWidget.Set<br># planeWidget.PlaceWidget()<br> planeWidget.AddObserver("InteractionEvent", callback)<br> planeWidget.On()<br> self.formWidgetC.ren.AddActor(clipActor)<br> <br># self.formWidgetC.iren.Initialize()<br> self.formWidgetC.iren.Render()<br># self.formWidgetC.iren.Start()<br><br># self.formWidgetC.vtkWidget.GetRenderWindow().GetInteractor().Render()<br></div><div><br><br></div><div>Any help would be much appreciated.<br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><br></div><div>Giorgos<br></div><div><br></div><br></div></div></div></div>
</div></div></div>