例如, 如果我有一个立方体
(这部分代码来自vtk python示例)
import vtk
# create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# create a renderwindowinteractor
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create cube
cube = vtk.vtkCubeSource()
# mapper
cubeMapper = vtk.vtkPolyDataMapper()
cubeMapper.SetInput(cube.GetOutput())
# actor
cubeActor = vtk.vtkActor()
cubeActor.SetMapper(cubeMapper)
# assign actor to the renderer
ren.AddActor(cubeActor)
# enable user interface interactor
iren.Initialize()
renWin.Render()
iren.Start()
如何删除此多维数据集actor并添加另一个? (这必须按顺序完成)
答案 0 :(得分:3)
你试过吗
ren.RemoveActor(cubeActor);
之后,你只需添加另一个演员
ren.AddActor(anotherActor);