Success!
That actually just worked
It came out pretty nice. The M4 screw went in relatively smooth (using a screwdriver) fits nice and snug.
I could screw it in by hand about half way into the bed after which I needed a wrench for some more grip, but I think if it would have taken the bed of so I could have accessed it more easily it would have gone like that with minimal force.
Some pictures:
They are a bit blurry, but I quickly took them with my phone and didn’t want to go through the hassle of taking out my camera. But on the second picture you can even get a glimpse of the inside threads.
Side by side comparison:
Just printed with Luban on the high quality settings (standing up) and only change to the parameters: wall thickness to 2mm.
This is the final file I used: (realigned the threads a bit so the thin/thick parts leave more material)
bed-insert 075.stl (2.3 MB)
Or the openscad code:
//https://github.com/adrianschlatter/threadlib
use <threadlib/threadlib.scad>
$fn=360;
//in toltal 9mm long
blen=6; //length of the bolt
nlen=3; //length of the nut
difference () {
difference() {
union() {
translate([0,0,0.6])
bolt("M6x0.75", turns=(blen-0.6)/0.75);
cylinder(h=6,d=5.05);
//head is 8 (7.97mm)
translate([0,0,-3]) cylinder(d=9, $fn = 6, h=3, center=false);
}
translate([0,0,-3.4]) tap("M4", turns=(blen+nlen)/0.7);
//add a little chamfer to the nut (insert)
translate([0,0,-4.7]) cylinder(h=3,r1=5,r2=0,center=false);
//add a little chamfer on the bolt end
difference() {
translate([-6,-6,4.8]) cube([12,12,3]);
translate([0,0,4.8]) cylinder(h=3,r1=5,r2=0,center=false);
}
translate([0,0,5]) cylinder(h=3,r1=0,r2=5,center=false);
}
//uncomment to see the inside
//cube([10,10,10]);
}