For installation install the package in KLayout’s package manager (requires KLayout 0.25). Open the package manager with “Tools/Manage Packages”. Search for “xsection” in the list of available packages. Mark the package for installation (check button above) and use “Apply” to actually install the package.
In order to use the cross section generator, a description of the process must be provided. Such a description is stored in files with extension “.xs”. They contain a step-by-step receipe how the layer stack is formed. Statements will describe individual process steps such as etching, deposition and material conversion (i.e. implant).
The source tree contains one example for such a file in “samples/cmos.xs”. This example illustrates how to create a “.xs” and has a lot of documentation inside. Have a look at this file here: cmos.xs.
Start KLayout after you have installed the script. You will find a new entry in the “Tools” menu. Choosing “Tools/XSection Scripts/XSection Script” opens a file browser and you are prompted for the .xs file.
To create a cross section, draw a ruler into the layout indicating the line along which the cross section is created. Choose “Tools/XSection Scripts/XSection Script” to select the “.xs” file and to generate the cross section in a new layout window. Once you have used a “.xs” file, it is available in the recently used files list below the “XSection Script” menu entry for quick access.
An introduction into writing XS files can be found here: Writing XS Files - an Introduction.
A function reference is also available here: XS File Reference.