[Paraview] Rendering a VTK vtkRenderWindow() in ParaView's PythonView

Léo Pessanha leonardopessanha74 at gmail.com
Thu Aug 2 15:42:37 EDT 2018


Hi!

In this post
<https://blog.kitware.com/paraview-python-view-is-now-more-versatile/> there's
a link to a list of potentially usable libraries in ParaView's PythonView
and VTK is listed among them.

I am trying to render a vtkRenderWindow() with a vtkCylinderSource() in it.

import vtk
> rw = vtk.vtkRenderWindow()
> ren = vtk.vtkRenderer()
> rw.AddRenderer(ren)
> cylinder = vtk.vtkCylinderSource()
> cylinder.SetResolution(8)
> cylinderMapper = vtk.vtkPolyDataMapper()
> cylinderMapper.SetInputConnection(cylinder.GetOutputPort())
> cylinderActor = vtk.vtkActor()
> cylinderActor.SetMapper(cylinderMapper)
> cylinderActor.RotateX(30.0)
> cylinderActor.RotateY(-45.0)
> ren.AddActor(cylinderActor)
> ren.SetBackground(0.1, 0.2, 0.4)
> rw.Render()


I've tried separating the graphics structure in the | render(view, width,
heigh) | from the source actor and mapper part of the code but no sucess

The result does not show up in the python view but instead it opens a  new
opengl context

Is it possible to do what I am trying to?

Best regards,
Leonardo Pessanha
Laboratory of Computational Methods in Engineering
Federal University of Rio de Janeiro - COPPE
Rio de Janeiro, RJ, Brasil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview/attachments/20180802/d5bee7b1/attachment.html>


More information about the ParaView mailing list