Spoiler Alert! If you do not wish to know how this "magic trick" works, do not proceed (but I hope you do)!
I designed Pencil Puzzler a few years back as a 3D printable version of an old magic trick. I've seen this style of magic trick using rope, pencils and even nails, but they all operate in the same general matter. This version includes all parts, even the "pencil", so nothing else is required other than a 3D printer and filament.
I probably forgot a file or two or something, so if you have any questions, please feel free to ask.
Designed using Autodesk Fusion 360, sliced using Cura 2.3.1, and printed in PLA on an Ultimaker 2+ Extended and an Ultimaker 3 Extended.
I printed my parts on both an Ultimaker 2+ Extended and an Ultimaker 3 Extended using .1mm vertical resolution and 20% infill.
Prior to assembly, test fit and trim, file, sand, etc. all parts as necessary for smooth movement of moving surfaces, and tight fit for non moving surfaces. Depending on the colors you chose and your printer settings, more or less trimming, filing and/or sanding may be required. Carefully file all edges that contacted the build plate to make absolutely sure that all build plate "ooze" is removed and that all edges are smooth. I used a flat jewelers file and plenty of patience to perform this step.
Study "Assembly Exploded.stl" carefully noting the locations and positions of the various components as assembly proceeds.
You may also notice I applied black coloring to simulate pencil lead to the ends of all the pencil pieces using a black indelible ink pen.