This makes a customised puzzle box with random maze. Use OpenSCAD to render to an STL for 3D printing.
See https://www.thingiverse.com/thing:2410748 for examples.
Do click like on thingiverse. Gifts accepted (just because people have asked how they can do this).
Some parameters are subject to sanity checks, e.g. nubs set to helix if greater than 1, etc. See comments at top of output for parameters actually used.
Source code at https://github.com/revk/PuzzleBox
[Note, licence is creative commons ATTRIBUTION. A commercial licence is available if not using CCA, at £10 per print sold. If you are not attributing you are either breaking the law by using without a licence and so costing me the £10 I would get, or are agreeing to the commercial licence. Either way you owe me £10 a print, plus legal costs if I choose to sue you to get it. So ATTRIBUTE any usage of this model.]