code generating for layers

generating code for Adv objects is now dependable of $multi and $layer
parameters instead of $width and $height