Python调用VTK模块显示.vtk文件

import vtk
vtk aRenderer=vtk.vtkRenderer()
renWin=vtk.vtkRenderWindow()
renWin.AddRenderer(aRenderer)
iren=vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
vtkReader=vtk.vtkPolyDataReader()
vtkReader.SetFileName("文件位置\文件名")
skinMapper=vtk.vtkPolyDataMapper()
skinMapper.SetInputConnection(vtkReader.GetOtputPort())
skinMapper.ScalarVisibilityOff()
skin=vtk.vtkActor()
skin.SetMapper(skinMapper)
aCamera=vtk.vtkCamera()
aCamera.SetViewUp(0,0,-1)
aCamera.SetPosition(0,1,0)
aCamera.SetFocalPoint(0,0,0)
aCamera.ComputeViewPlaneNormal()
aCamera.Azimuth(30.0)
aCamera.Dolly(1.5)
aRenderer.AddActor(skin)
aRenderer.SetActiveCamera(aCamera)
aRenderer.SetBackground(.2,.3,.4)
aRenderer.ResetCameraClippingRange()
renWin.Render()
iren.Initialize()
iren.Start()

你可能感兴趣的:(python编程)