Projecting curves onto overlapping surfaces

This script from @Helvetosaur might help with step 4 - I wonder whether he has a Python equivalent …?