How to create a script for cross sections

I ve saw this script on a video and wanted to make it but i m a newbee in scripting