This post is similar to 【VTK】A SIMPLE EXAMPLE WRITTEN IN C++
We use python script to do the same thing: create and show a cone in 3D world with the virtualization tool kit.
python script:

#!/usr/bin/env python

import vtk

cone = vtk.vtkConeSource()

coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInputConnection( cone.GetOutputPort() )

coneActor = vtk.vtkActor()
coneActor.SetMapper( coneMapper )

ren1= vtk.vtkRenderer()
ren1.AddActor( coneActor )
ren1.SetBackground( 0, 0, 0 )

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer( ren1 )

renWinInteractor = vtk.vtkRenderWindowInteractor()
renWinInteractor.SetRenderWindow( renWin )
renWinInteractor.Start()

Run the script:vtkpython pythonTest.py


0 0 votes
Article Rating
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] is a simple python script for drawing cone in VTK, VTK – A Simple Example Written In Python Script, we can run it by […]

3D Model Viewer: add grid plane and convex hull.
Add google translate tool at right-bottom position.

X
A prohibited operation
1
0
Would love your thoughts, please comment.x
()
x