The fuel tank cap for dad's whipper snipper (brush cutter?) disintegrated. It was an odd size thread and the local mower shop didn't have a spare in stock.
I took out my handy vernier calipers and measured up the dimensions and reproduced the cap using open scad. I guessed that the designers used a standard, but large metric thread as the measurements were close to a M33x3.5 course thread (google a table of standard thread sizes). I used a thread library (by [Dan Kirshner]) and a shapes library, to cut the thread part of the fuel Cap using open scad. I added extra outer wall thickness to prevent a repeat of the split failure like the original cap.
The first print version was too tight when screwing it on, so I opened up the inner dimensions of the cap and printed a second version. I also opted to not include the hexagon pattern on the top (but this is still in the code). The second print fitted really well, too well, as no air could get in to the tank and it soon formed a vacuum. a small air hole was drilled in the top, and the cap then worked perfectly. it is still working well three hard years later.
PLA makes a great fuel resistant material for a part like this. much better than the off spec plastic used in the original.
The scad source code is included below with comments. my code if free to reuse as you like but the thread library and shapes library have attributions/licences (see code for details) from someone else.
The STL is included if you have this same line of power tools or one with the same thread. The first version has a hexagon pattern but is a bit too tight on the inner dimensions.
Use brightly colored plastic so you can find it easier if you drop it in the long grass.
Conclusion- Cap works as well as the original, but is stronger so wont split in half. Hasn't failed after several years of use.
- The bright color makes it easy to find if dropped. This cap is more robust than the original.