Note: You Need OpenSCAD to Really Use This Thing
This may be useful to some of you. It's for changing a flashlight from 3xAAA power to an 18650.
I bought a cheap plastic LED zoom/focus flashlight at the dollar store for a buck. I thought, "Great, I'll just use an 18650 in it instead of those 3 little alkaline cells."
Surprise!, The tail end of my 18650 protruded out the rear end of the thing so far that I could no longer get the tail-cap on.
That's what this thing is for. It's a screw-on adapter/extender to fit my flashlight and make it just the right length. I still had to get it to pass power since I printed it is non-conductive PLA, but wrapping part of my 18650 cell adapter with heavy duty aluminiuminuminah (Yes I am a British Muppet) did the trick.
Yay! A 18650-powered superbright zoomable LED flashlight for about a buck.(Plus $0.10 of PLA and a little foil. I don't recommend using foil like this around lithium cells. It's too easy to create an unintended short that creates a lot of heat and possibly fire, fast.)
So this probably will NOT fit your flashlight unless it's the same as mine.
But you can easily make it to fit anything.
It is written for the newest version of OpenSCAD 2019.05 which has an included "Customizer" feature so you don't have to change the code at all if you don't want to.
It should run on older versions as well, but I haven't tested that.
For making the threads, it relies on revarbat's BOSL library.
If you use OpenSCAD get this library! I put in a request for Thingiverse/Makerbot to include BOSL for use with "Customizer" and I hope they do, but for now you will need to install OpenSCAD to use it.
It will produce a coupler/extender with male threads on one end, and female threads on the other. Length and diameter and thread pitch and depth of the part is up to you through the customizer interface.
But, if you really want to change the thread type and such, you will need to look at the BOSL threading library documentation.
My script is very simple, but probably not super well documented.
I plan to keep it handy for whenever a cylindrical pipe needs an extender.
Put sparse supports under the over hang if needed.
Use enough resolution to get good threads.
My threads were only 0.5mm and they came out great.
Feels like it was made for this flashlight.