Two ways to add data object for a vtkView.

1) Create a representation object, set the inputs for it by calling SetInputConnection() or SetInput(), then add representation for the view.

2) Use AddRepresentationFromInputConnection or AddRepresentationFromInput to create representation automatically.

1)
Python
from vtk import *

surfaceRepresentation = vtkRenderedSurfaceRepresentation()

sphere = vtkSphereSource()
sphere.SetPhiResolution( 100 )
sphere.SetThetaResolution( 100 )

surfaceRepresentation.SetInputConnection( sphere.GetOutputPort() )

view = vtkRenderView()
view.AddRepresentation( surfaceRepresentation )
view.SetInteractionMode( vtkRenderView.INTERACTION_MODE_3D )
view.ResetCamera()
view.GetInteractor().Start()

2) 

Python
from vtk import *

source = vtkRandomGraphSource() #vtkGraphAlgorithm
source.SetNumberOfVertices(100)
source.SetNumberOfEdges(100)
source.SetStartWithTree(True)

view = vtkGraphLayoutView()
view.AddRepresentationFromInputConnection(source.GetOutputPort())
view.ResetCamera()
view.Render()
view.GetInteractor().Start()


0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Tools: add a new web service, combine images to PDF.

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