[vtkusers] Bug with vtkImplicitPlaneWidget2?

James Shi james.shi at sbcglobal.net
Tue Jan 23 17:18:18 EST 2018


Hi everyone,
I noticed that if I reset the camera after turning on vtkImplicitPlaneWidget2, nothing is visible, but if I reset the camera before, everything looks fine.  Am I not supposed to reset the camera after turning on the widget, or is there a bug?  I'm using VTK 8.0.1 and Python 3.6.3.Here is the broken version:
import vtk
cone = vtk.vtkConeSource()mapper = vtk.vtkPolyDataMapper()actor = vtk.vtkActor()renderer = vtk.vtkRenderer()window = vtk.vtkRenderWindow()interactor = vtk.vtkRenderWindowInteractor()
mapper.SetInputConnection(cone.GetOutputPort())actor.SetMapper(mapper)renderer.AddActor(actor)window.AddRenderer(renderer)interactor.SetRenderWindow(window)
widget = vtk.vtkImplicitPlaneWidget2()widget.CreateDefaultRepresentation()rep = widget.GetImplicitPlaneRepresentation()widget.SetInteractor(interactor)rep.SetWidgetBounds(cone.GetOutput().GetBounds())widget.On()renderer.ResetCamera()
interactor.Start()
Working version for comparison (notice only the renderer.ResetCamera() line moved):
import vtk
cone = vtk.vtkConeSource()mapper = vtk.vtkPolyDataMapper()actor = vtk.vtkActor()renderer = vtk.vtkRenderer()window = vtk.vtkRenderWindow()interactor = vtk.vtkRenderWindowInteractor()
mapper.SetInputConnection(cone.GetOutputPort())actor.SetMapper(mapper)renderer.AddActor(actor)window.AddRenderer(renderer)interactor.SetRenderWindow(window)renderer.ResetCamera()
widget = vtk.vtkImplicitPlaneWidget2()widget.CreateDefaultRepresentation()rep = widget.GetImplicitPlaneRepresentation()widget.SetInteractor(interactor)rep.SetWidgetBounds(cone.GetOutput().GetBounds())widget.On()
interactor.Start()
I tried printing the bounds of all props, and one of them (I think the sphere in vtkImplicitPlaneRepresentation) has bounds (0.0, 0.0, 0.0, 0.0, -1e+299, 1e+299), which may have caused the issue.  Also, I tried using vtkBoxWidget2 for comparison, and this widget didn't have any issue.
Thanks,James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180123/517e9d23/attachment.html>


More information about the vtkusers mailing list