It is written as a series of modules, so you firstly have parameters for battery size, wall thickness, angle (of each section to encourage the batteries to roll down), how long you want each layer to be and number of layers. It then uses parameters which will calculate the different layer heights, offsets and dimensions based upon the nominated battery size.Were you able to use push pull for the internal void in the serpentine to get the battery space or did you do it as ten assemblies ?
The main program is then a loop set to run for as many iterations as there are layers, firstly it calls a module which will draw 2 cubes with translations and rotations before then hollowing them out, a second module then adds cylinders at each intersection then hollows them out then adds another cylinder to round off the internal ramp end where 2 layers meet. When this loop has run you have the basic structure and 2 further modules then add the top hopper and a base (which I have now improved a bit). Finally another module will trim the model to produce wither a lid or a base for printing which can then be glued together to make the finished thing.
Once I have got rid of a couple of artifacts and finished another couple of test prints I may put the code up on Thingiverse to see how many improvements others will make to it!