This script is identical to the script described in Aligning 2D Lines in all XSections, except that the alignment is automatic. This script is a reactive script instead of a script that gets launched on-demand by the end-user.
This script is attached at the bottom of the page. Place this script in a folder named "On_XSection_Seismic_Layer_Added"
Only the following lines have been changed compared to the original script