how to get the cross section perpendicular z axis base on the z user input?

I want read a stl file. Then capture a image of cross section perpendicular to z axis, the z value is given by user. And output the intersection to image.

I already know how to read a file by https://lorensen.github.io/VTKExamples/site/Python/IO/ReadSTL/

and image write on this site. https://lorensen.github.io/VTKExamples/site/Python/IO/ImageWriter/

I think make a plane z axis perpendicular and get all intersection points and make them to a image will get what I need.

But I get confused when I read the plane intersection part code.
https://lorensen.github.io/VTKExamples/site/Python/GeometricObjects/PlanesIntersection/

I haven’t found the part to define a plane so how the intersection happened? All code related to the sphere and the bounds I don’t know why use bounds either.

Thank you for you help~

You can use vtkCutter to get a cross-section of a surface mesh.