how to display the vtk file?

hi, I am new about the vtk, my purpose is to read 3d vtk file and display it using vtk, however, there is no view at all. Here is my program, Does anyone know the reason? Thanks!
import vtk
aRenderer=vtk.vtkRenderer()
renWin=vtk.vtkRenderWindow()
renWin.AddRenderer(aRenderer)
iren=vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
vtkReader=vtk.vtkStructuredPointsReader()
vtkReader.SetFileName(‘file.vtk’)
vtkReader.Update()
print(vtkReader)
skinMapper=vtk.vtkPolyDataMapper()
skinMapper.SetInputConnection(vtkReader.GetOutputPort())
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()

Hi, could you add much more detail information?
1)OS:
2)Python Version:
3)VTK Version:
4)the format of your file

Here is my setting:

  • OS: LinuxMint20

  • Python: 3.6

  • VTK: 9.0.1

  • I use the stl file which is delivered by Example: “42400-IDGH.stl”

  • I using vtkSTLReader replacing your vtkStructuredPointsRead

  • I comment your Camera parts

It worked!
I advise you checking camera’s setting. And you could refer the example “CATPart.py” which is located at VTK-9.0.1/Examples/Rendering/Python

Thanks for your question, I am also a newer. To solve your issue, I did some tests, and here is the result for your references:(I just use the 42400-IDGH.stl as input file)

  • aRenderer.AddActor(skin) should be set after the camera setting, otherwise will impact the current active camera’s settings. You could try to print camera.GetPosition, GetFocalPoint, GetViewUp to verify this.

  • Camera’s setting, Dolly should nearby 1.0 from start, In my case(42400-IDGH.stl), if started from 1.5 you can not get any useful image but a blank background screen.

  • Also, you should set up viewup carefully, the default is (0, 1, 0)

Below is my code, just modified from yours:

import vtk
aRenderer=vtk.vtkRenderer()
renWin=vtk.vtkRenderWindow()
iren=vtk.vtkRenderWindowInteractor()
#vtkReader=vtk.vtkStructuredPointsReader()
vtkReader = vtk.vtkSTLReader()
vtkReader.SetFileName(‘42400-IDGH.stl’)
#vtkReader.Update()
#print(vtkReader)
skinMapper=vtk.vtkPolyDataMapper()
skinMapper.SetInputConnection(vtkReader.GetOutputPort())
#skinMapper.ScalarVisibilityOff()
skin=vtk.vtkActor()
skin.SetMapper(skinMapper)
aRenderer.SetBackground(.2,.3,.4)
aRenderer.AddActor(skin)

aRenderer.ResetCamera()
aCamera = aRenderer.GetActiveCamera()
aCamera.Azimuth(30.0)
aCamera.Dolly(1.2)
aCamera.SetViewUp(0,0,-1)
aRenderer.SetActiveCamera(aCamera)

print(aCamera.GetFocalPoint())
print(aCamera.GetPosition())
print(aCamera.GetViewUp())

renWin.AddRenderer(aRenderer)
iren.SetRenderWindow(renWin)
iren.Initialize()
renWin.Render()
iren.Start()

Thanks! Here are my vtk file format

vtk DataFile Version 3.0

Structured Points
ASCII

DATASET STRUCTURED_POINTS
DIMENSIONS 64 64 64
ORIGIN 1 1 1
SPACING 1 1 1

POINT_DATA 262144
SCALARS scalars float
LOOKUP_TABLE domain
24.0
24.0
24.0
24.0
24.0
24.0
24.0
24.0
24.0
24.0
24.0
24.0
24.0

Thanks a lot! Now the display is ok when i use the vtkvolume, but the color is not correct. I use the structured points and want to do 3d volume rendering with a fourth dimension scalar value map to different color. Do you know how to achieve this?

Tahe a look at vtk-examples some of the examples there may help.