Carton macro

hi i am looking for 2 type of macrosI

First macro that can make all type of carton by just mentions its height weidth and length

second macro that can automaticly utilize page every space by rotating moving and adjusting itself in every possible area and adjust multiple designs of small and large cartons size in 1 page without wasting any space of pagee.