Stepan Yakovenko
Stepan Yakovenko

Reputation: 9216

How to draw mouse-rotatable point cloud in python with vtk

I need to draw rotatable point cloud in python, here is what I've found on the net:

import vtk_visualizer as vv
import numpy as np
xyz = np.random.rand(1000, 3)
vtkControl = vv.VTKVisualizerControl()
vtkControl.AddPointCloudActor(xyz)
vtkControl.Render()
vtkControl.ResetCamera()

It shows window for few moments, but then window hides, so I can't rotate it with mouse. How can I fix it?

Upvotes: 1

Views: 450

Answers (1)

Stepan Yakovenko
Stepan Yakovenko

Reputation: 9216

This is solution, which I've found:

import vtk_visualizer as vv
import numpy as np
import sys
from PyQt5.QtWidgets import *
xyz = np.random.rand(1000, 3)
vtkControl = vv.VTKVisualizerControl()
vtkControl.AddPointCloudActor(xyz)
app = QApplication.instance()
if app is None:
    app = QApplication(sys.argv)
app.exec_()

Upvotes: 1

Related Questions