Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

remix of "Russian Doll Maze Puzzle Box"

by spool2kool Jun 27, 2018
Download All Files

Thing Apps Enabled

Please Login to Comment

I really like the idea of having a script that is able to generate random mazes and the generation works perfectly. But it looks like the generated mazes are much easier to solve (compared to the original one). It took me about half an hour to solve the original maze but I only needed about 10 minutes to compelte the generated maze with 5 levels!
The thing that I miss most is that in the original maze you open the maze and just before you get to the end you have to slide it almost completely in before you can continue. This makes it much more difficult. Or am I just missing an option in your script?
My opt:

And in the shell:
multi thread Y
nub count 0
difficulty 16
shift mode 3
twist amount 10
(but I also tried various other settings)

note in the new github version, larger mazes are better.

First of all: Thank you for pointing me to github. I did not know that there is a newer version on github. I downlaoded the new script from github, modified the openSCAD path but I am unable to run the main.py script. It always fails:
C:\Users\Thomas\Desktop\3D drucker\remix_ofRussian_Doll_Maze_PuzzleBox\files\src_github>main.py
Traceback (most recent call last):
File "C:\Users\Thomas\Desktop\3D drucker\remix_of__Russian_Doll_Maze_PuzzleBox\files\src_github\main.py", line 384, in
if has_scad_threading():
File "C:\Users\Thomas\Desktop\3D drucker\remix_of
Russian_Doll_Maze_PuzzleBox\files\src_github\main.py", line 65, in has_scad_threading
out = str(sp.check_output(cmd)).lower()
File "C:\Program Files (x86)\Python37-32\lib\subprocess.py", line 389, in check_output
File "C:\Program Files (x86)\Python37-32\lib\subprocess.py", line 466, in run
with Popen(
popenargs, **kwargs) as process:
File "C:\Program Files (x86)\Python37-32\lib\subprocess.py", line 769, in init
restore_signals, start_new_session)
File "C:\Program Files (x86)\Python37-32\lib\subprocess.py", line 1172, in _execute_child
PermissionError: [WinError 5] Zugriff verweigert

Do you have any idea what I am doing wrong?

just realized path was uncommented. unless scad is not on the C drive, comment it out.

verify the scad path. you can uncomment the path in main.py to set your own.
also make sure to close the folder before run. otherwise you will get a similar error.

The "old" main.py script from thiniverse works fine. I also tried running the command line as administrator but this did not help.

It looks like this method causes issues:
def has_scad_threading():
cmd = [openscad(), "--help"]
out = str(sp.check_output(cmd)).lower()
if "--parallelism" in out:
return True
return False

In your old version you had a different command:
ver=sp.check_output(shlex.split(openscad_com+" --version"),shell=True)
ver=str(ver).replace("b'OpenSCAD version ","").replace("\r\n'","").split(".")

works on my end. read above for details.

The editor path is set correctly. I just verified it again. This cannot be the issue here. There must be something else

re-download. I found the problem and is now fixed. it was simply a problem with '"text"' vs. "text".

Looks much better now. Maze generation seems to work but it looks like there is something wrong with your command to determinate the openscad version and if multi threading is available:
Usage: C:/Program Files/OpenSCAD/openscad [ -o output_file [ -d deps_file ] ]\
[ -m make_command ] [ -D var=val [..] ] \
[ --help ] print this help message and exit \
[ --version ] [ --info ] \
[ --camera=translatex,y,z,rotx,y,z,dist | \
--camera=eyex,y,z,centerx,y,z ] \
[ --autocenter ] \
[ --viewall ] \
[ --imgsize=width,height ] [ --projection=(o)rtho|(p)ersp] \
[ --render | --preview[=throwntogether] ] \
[ --colorscheme=[Cornfield|Sunset|Metallic|Starnight|BeforeDawn|Nature|DeepOcean] ] \
[ --csglimit=num ] [ --enable= ] [ --parallelism=num ] \
[ -p ] [-P ] \

nub count (0=2 nubs,1=3 nubs,2=4 nubs, ...):

This is what happens immediately if I run main.py (but maze generation still works)

multi threading check is fine. --parallelism only exists when using a multi thread capable version.

did find a bug in version check that i just fixed. give another go.

weird printout fixed. I did not notice it until I ran by double clicking.

OK I found the issue: The path has to point to the openscad.com file directly.
works perfectly: OPENSCAD_PATH = "C:/Program Files/OpenSCAD/openscad.com"
generates some messages, but still works: OPENSCAD_PATH = "C:/Program Files/OpenSCAD/openscad"
does not work at all: OPENSCAD_PATH = "C:/Program Files/OpenSCAD"

found another fix. see above. however, the .com makes sense according to the devs of openscad.

found another fix. see above. however, the .com makes sense according to the devs of openscad.

github version even better now. no more hbias! instead using a solver to find path lengths. difficulty is now based on that and how often the path goes down!

the dificulty level needs to be in the hundreds for better result. but I'm thinking of some changes. did you upgrade the github version?

Thanks for the fix!

Worked great!

How do I specify the hole where the 'prize' would be I need it to hold a note 80mm wide.

I'm assuming 'Units tall on inner most (int)' is the parameter to change but not sure what this number should be.

Is it:
Unit Spacing = X (4)
Units tall = 80/X (20)

should be unit spacing times units tall=inner height. it should stick out the top by about 1 unit.

Great thanks!

Is everyone satisfied with the latest version? Make sure to update too! If so, I'm thinking of considering this one done for now.

Later, I may remix my self to make it a customizer with the help of a web based generator code on my website!

I love this design, but I don't know Python or OpenScad or really any of those tools/processes you mention in the description. I want to scale this up so that it fits inside http://www.thingiverse.com/thing:2338724 with maybe .5mm or .75mm clearance between the cap on this design and the inner diameter of the other design. But I am afraid that if I scale this model up that it will screw up the fit between the pieces. Can you offer me some pointers?

Money Box Maze

thinking about doing a tutorial on my Youtube about this. just don't have time right now. on the move...again.

  1. You don't need to know python to use this (just be sure that the scad path is still in quotes).
  2. Some slicers have repairs built in.
  3. Tutorials below the description.
  4. Scale to 2x for 0.6mm tolerance. I used 0.3 for a 0.4 nozzle.
  5. Multi-thread scad link in description

more updates coming...

  • new nub design to help resist rubbing off.
  • ability to adjust number of nubs to help keep from cheating.


  • new nub design to help resist rubbing off.
  • ability to adjust number of nubs to help keep from cheating.

main.py having problems at line 290,192,118. While multithread script works fine with same parameters inserted

What i meant previously about the notch is to have single notch for inner cylinder to have more maze routes and possibilities.

Also, is it possible to combine both of the multithread and main.py files together and user will just enter option to pick "single" or "multi" thread processing instead of having to maintain 2 files at once?

latest version updates (works so far):

  • new nub design to help resist rubbing off.
  • ability to adjust number of nubs to help keep from cheating.

just fixed that. also now a single python file. about having 1 nub, it would be too easy to cheat. especially at the end. still updating stls as another problem is being fixed.

hold up!! found a bug. fixing it.

more updates.

  • new base style
  • smaller samples


I'm unable to run the script, it says the following

No module named PIL

You need to install the pillow module. And numpy. Make sure to use the pip version for your python version you are using.

Thank you for your response, I am trying to run the script slowly. I would like to point out a little bit about the "curdir", can't you just use something similar to this https://stackoverflow.com/questions/5137497/find-current-directory-and-files-directory where the script will automatically get the current working directory instead of user have to copy, paste then change to forward slash symbols?

yes, just did an update about that. and no need to manually create folders anymore!

preview works better now too.

Also, some of the parameter's explanation are confusing to me especially "Lid sides", I tried to change the one in scad file to 20, it literally just changed to the second part.

Is there a way to make the inner lid flushed with the shell? I printed first three parts, they work okay but the base diameter is slightly smaller compared to its outer shell

Possible to change the notch into single notch type?

update has a bug still. fixing it now. only affects when transition point used.

more updates.

  • new base style
  • smaller samples

because of the thread at the bottom, the base is small. "bs" is for the 2 outer most shells for decoration. the notches on base are just for added grip.

fixing minor issues. src is up to date. next stl's. working on a print now though.

For anyone looking to do really big mazes you can save a substantial amount of time by using an OpenSCAD build with threading enabled.


Then edit main.py and find the line:

sp.run(shlex.split(openscad_com+" -o ""+curdir+"/stl's/"+str(shell+1)+".stl" ""+curdir+"/make_shells.scad""),shell=True)

Replace it with:

sp.run(shlex.split(openscad_com+" --enable=thread-traversal -o ""+curdir+"/stl's/"+str(shell+1)+".stl" ""+curdir+"/make_shells.scad""),shell=True)

missing backslash!!!
should be:
sp.run(shlex.split(openscad_com+" --enable=thread-traversal -o ""+curdir+"/stl's/"+str(shell+1)+".stl" ""+curdir+"/make_shells.scad""),shell=True)

ok. the next revision will have the render() 's removed. still works without them.

Huge improvements! I love the new maze in/out flip.

I am a bit concerned though, it seems the nubs are much smaller now than they were before?

partially quoted the above:

Huge improvements!...
to RevK (creator of original)

Yep still works though. If i make the nubs bigger the whole thing gets bigger. I think the new size is nice though.

Definitely liking the new size, seems just as sturdy as the old way.

Oh ok, sounds good. I'm printing 20 shells. This should be entertaining.

hold on! i'm still doing fixes. there are still some problems with bigger nubs and I had rub-off problems with the small ones. tested with abs+
working on it though.

Awesome! Will hold on until next release. Definitely some huge improvements though.

Almost there. One last bug I'm fixing before upload. Also will upload a multi-thread python for the noobies.

Src updated. Working on stls.

Still having issues with the exit not being completely finished for exterior facing mazes if the unit size is greater than 4. Interior mazes and transition cylinders (inside & outside) work fine.


Also a variable error if you try and set bsmooth=0 in make_shells.scad:

c:\Tools\e>"C:\Users\Joseph\AppData\Local\Programs\Python\Python37\python.exe" main_multi-thread.py
difficulty (hbias); 0=none >0= bias; larger= more difficult:150
shift mode (0=none 1=random 2=random change 3=twist):2
part: 1
Executing OpenSCAD script...
WARNING: Ignoring unknown variable 'w'.

all good. now up to date.

inside maze is weird. working on a fix.

I noticed the inside maze thing too but it disappeared without issue once I put it through the slicer.

the maze on my end did not line up. anyway i guess it is something I did but (luckily) have not uploaded yet.

Ok. I just fixed that and need to upload. I'll upload all when done with making stls.

ok. seems fixed. added a new feature:

  • transition point. maze in/out-ness can be flipped part way.
    preparing to upload...

uploaded new gen code. next stls.

oops. lid of inside needs work.

Oh boi... I just realized (after print) that last turns in outside maze versions are f**ed up :(

Can you fix it?

try it now.

ok. moved the maze a little. should work now. still need to upload the inside maze stls

What do you mean. Please keep it clean by the way.

I mean that there is no way to close each maze. There is a big gap at the end!

Oh. But to be sure check that you're actually at the exit and not a dead end. The exit should act like a 90 degree screw thread.

Im sure. Only maze_outside_6.stl goes to the bottom :(

stil working on it.

I'm having this issue too.

2 fits over 1 flush to the end but 3 doesn't sit flush with 2.

Make sure its the latest and that you are not in a tricky dead end. The mazes can be hard to solve. The latest worked when i did the test print of 6 shells. You need to try a lot of paths to find the one that goes to the bottom sometimes. Try again with bias set to 1. It will be easier to solve but will verify that it fits. Bias does not effect the fit. Only the maze difficulty

If I recall correctly I did set the bias to 1 and the path I'm taking is definitely the right one, it does fit together but rattles.

if you run the gen again, you'll get a different maze. try that or check them in a CAD program or viewer first to be sure. I have tested a print of it and it worked.

also lock the parts at the bottom using the thread by twisting like screw.

I've just tried fitting them together again, 2 and 3 will fit together without 1 inside 2 but not with 1 inside. I've twisted 1 into two as hard as I can.

I've attached my STLs, as well as screenshot of another generation, from a side profile to show the heights.

I have a fix... I will repair and upload tomorrow.

btw, tired of scrolling to the post! next time post a new comment (not a reply).

OH! two problems...

  1. no gap between 1 & 2
  2. 2 & 3 do not fit.

attempting to fix both...

Hey, yeah I resorted to control-f-ing for my username to find the thread. That's great I'll check back in a day.

Comments deleted.

Ok ill look intuit. Just a little busy now.

updated python script. working on stl's

More probs. Update soon.

heads up! doing updates! (not done yet)

currently preping files...

this update should fix many problems:

large overhangs
screw lock smoothness
maze width calibration
added option for a smooth bottom vs a "grippy" bottom (in make_shells.scad)

not yet uploaded. waiting on the 2nd batch of samples to compute on my i7 PC...

I tried to disable the smooth bottom by changing bsmooth=0 in make_shells.scad and I get a warning when OpenSCAD is executed:

c:\Tools\b>"C:\Users\Joseph\AppData\Local\Programs\Python\Python37\python.exe" main.py
difficulty (hbias); 0=none >0= bias; larger= more difficult:0
shift mode (0=none 1=random 2=random change 3=twist):2
part: 1
Executing OpenSCAD script...
WARNING: Ignoring unknown variable 'w'.
Started 4 worker threads

End result ends up having a smooth base.

above features uploaded.

How do I enable the lock thread on outer shell of an Inner Maze set?

you don't. for decorative reasons.

I just ran the script for an extra layer that I won't use... wanted to make a double sided "last" level so needed the final inner maze to have a thread. I can see how the outer lid would be difficult to line up with a thread...

I do not see a problem. The outer most level should not have the thread because the two parts will not line up once tightened. The second to last and inward should and i saw it in the pic near the top on the inside.

By the way i like the transition idea. A future update?

The "second to last, inward" is actually the last (6th) inward and only has the thread you see because I ran the script with opt to give me 7 shells, then had to remove the serrated grip from the STL and merge it with an STL for the same level done with outer maze and the lid base. Not a problem really, just would have been easier to merge if both had the same outer base. Yes would have been easier still if double sided layer was an option in the scad :)

Something I would also do when printing again is add some extra distance between the last row of an outward maze and the edge of the piece. It's close enough to "jump" over that last wall if the lid is slightly tilted, which is easily done when there is a straight line up to the last wall.

just now rebranded my account. did so because of my youtube channel.

the pic last posted should be the second to last shell. the last is the "lid". ex. using 7 shells the one in the pic would be shell 6.
by the way 7 shells gives 6 levels. level count are shell count-1.

What is a good bias? tried 5 and then 8, but still get straight thru runs that make it really easy to solve.
What does it actually do?

Attached pic is with Bias set to 30!! just doesn't seem to help, almost straight out

Inner mazes tend to be small which makes bias less effective. I tested with 100 or so. Larger is better. Bias makes it attempt horizontal. Of course if it sees a path in the way it stops there to avoid loops.
By the way shift mode more than 0 can help too. Makes a more complicated maze.

Actually I was using shift 3 with a twist of 5.
Just tried with shift 2 and overkill bias of 150 and the result looks much better. still some straight lines but but not straight to the finish, more false trails and and generally evil :D Thanks
btw, I modified the knob so there is a less severe overhang as I was getting mid-air printing on the internal horizontal sections

A little late but a twist of less than the start maze width works best as it will appear on all mazes. That is because of modulo arithmetic.

Ummm. The knob is flipped 180. Ill look into it later. That is the mod you did is useless due to the back of knob doing the carving.

Not useless for me... I'm talking about the carved result. As it is, the horizontal carved lines overhang and print on air, by adjusting the knob the way I have, it carves a steeper underside which overlaps previous layers. The outer lug is also adjusted.
attaching before and after... my sample prints are perfect now.

All the clutter made it look backwards. The knob can wear out after a while. Like to know how long it lasts. By the way what material?
Also tested bias of 200 and it looked very squiggly!

I disable the outer surfaces so I can look at the inner maze in openscad preview so I don't have to wait ages for it to render only to find it's not right...

I usually print in ABS but that's relatively soft compared to my PLA. 0.2 tolerence is fairly loose so the wear should be reduced, tho I am about to try with 0.1. I'll let you know...

milage may vary... 0.2 was perfect for my 0.4mm nozzle. some were looser than others. abs shrinks a bit.

Uh looks ok on my end. So...
Never mind.
Working on the knob though.

Making updates. Will upload soon.

Comments deleted.

First thanks for providing the script.

Unfortunately i was not successful with it.

First it searched for a "make shells.scad" file. But the file is actually named "make_shells.scad".

second, i get a couple warnings per part
"WARNING: Ignoring unknown variable 'g'."

and all parts except the last one are empty without any maze structure.

Only the last one has a maze.

using Python 3.6.3 and OpenSCAD 2015.03-2 on Windows 10

Just now looked at it and i have the g var comented out with //
A temporary fix it to uncomment it but leave it 0
However, i'll update it with a proper fix in a few minutes.

had to rename some things though.
apparently, thingiverse does not like spaces!!! (how dare you!)

Thanks a lot. Now it worked and printed successfully. :)

Great! But thank you because if it wasn't for you i wouldn't have known that there was a problem.

Any chance you could explain the options more?

I have no idea what shift does.

What exactly is twist?

I also noticed the generated mazes mostly have long straight aways making the mazes too easy - how could I fix this?

The last shell doesnt have that "threading" to lock it in place. should it?

How about unit spacing?

I will definitley post a make if I can get this generator to work!

Please read the readme and opt fmt text files first. Twist is a mode for staggering the maze to appear larger than it is. Makes it wrap more than 180 degrees. Twist stagers by an inputed value. All others involve random staggers except none. My favorite modes are 2 and 3. And a value of 1 for mode 3 twist amount.

Thanks for the quick reply!

How can I make them harder? The straightaways will make these mazes too easy to solve. I have generated them a dozen times and they always have long straightaways right to the end. I have attached a picture of my last attempt. As you can see, the last maze is too simple, my 5 year old could colve this!

Keep in mind that the smaller inner mazes will be easier than the outer. Bigger is better but takes more time and filament. However i noticed this somewhat on the larger mazes too. I was thinking of adding horizontal bias to the maze algorithm. But not now. I'm out of town. And i left my gear at home of course! Keep an eye on my YouTube spool2kool i have a kool video coming after the trip.

Horizontal bias sounds just what this needs! I will check out your YouTube and subscribe. I just love these puzzle boxes!

just updated. now with horizontal bias and more user friendly opt format.

Cool! Let me check this out!

If you like puzzles check out my die puzzle v2 and my cookie box puzzle. I'll work on fixing soon. Lots to do.

Thanks for uploading, this model is incredible! I've only printed the demo files but they work great. One question I had though: Is there an easy way to add a quick 90 degree turn at the "end" of each maze so that the tubes won't slide apart on their own if the ending of the maze has a bit of a straightaway?

i fixed that with a thread at the bottom. if that's what you mean. I also updated the samples a couple days ago.

Indeed you did. I was running a version that was a few days old. Thank you very much for the reply and for the amazing tool!

Thanks. Hope you enjoy foolering folks
Be sure to check stl's

The Inside box doesn't slice. I'm not really interested in making my own maze, just wanted something to print.

what slicer? it worked for me. and have you double checked the file integrity with a repair tool (like netfab etc.)? I did have a weird issue with the outer shell but it printed and I just cleaned out the inside.

Besides, the point is to customize and be just as different as humanity.

just made even more updates.

just made more updates.

part of it did not work fixing it.

It's possible that I'm just being dumb, but I think you forgot to upload config.scad and maze.scad to the list of files.

Those are made with the python code so it does not matter.