I just lay the rifle (scope and all) where I want it on the foam and mark where i want it with something that will wash off. Then after taking the first layer out, I use an electric knife to cut it. If you go slow it does a great job. If you don't have anything that will come off to mark it, just mark inside the rifle shape (A little smaller) and cut the marks out.
I like to place the scope up towards the handle for carrying and sometimes have room for a couple of Mag cutouts.