The idea was to have the nut (8-32 hex nut) be captive in the print so it would not move. I used to simply make the 3D printed hole a bit smaller than the screw and then "force thread the screw in the final print. Works well for small screws like 2mm, but for larger diameter screws the print tends to crack and break.
So here was the design... It's a insertable part in a Nanuk type of rugged case (this particular case is german made and I don't have the manufacturer for electronics.
As you can see there is a hex pattern for the nut.
After slicing the design with Slic3r. I looked at the Gcode output and found which was the last layer printed of that hex pattern. Just before it started to do the part with the top round hole.
Just there I simply inserted an @pause statement in the Gcode file.
An @pause statement simply tells the printer to pause and wait for a resume command.
When the printer paused, I inserted the 8-32 nut. Now be careful and fast ! Careful because your fingers are close to the hot-end (I used a pair of tweezers) and fast cause you don't want to leave the hot-end not moving for too long.
I use OctoPrint (running on a Raspberry Pi 1, slow WebUI, but it works great!), so once I was done, to resume I simply had to click on the "Resume" button.
And it worked ! The result was very good:
Works very well. I need to experiment on moving the head away and maybe retracting the filament so it does not ooze out when inserting the hardware.
I'll probably try the same method to perform a filament change (change color) at some point.