If you want to have a metal nut that fits inside 3d printed part perfectly here is a great tutorial. It also includes a part how to design it in a a CAD software.
From project description:
Tutorial can be found at:
http://www.instructables.com/id/Make-a-Seamless-Captive-Nut-in-a-3D-Printed-Part/
From project description:
A captive part is a piece of hardware that is embedded or attached to another such that it's "trapped" inside. This is particularly useful in applications where you want to mount something like a tensioning nut or a leadscrew nut for linear motion. This can also be used to integrate other components, such as electronics or magnets.
Tutorial can be found at:
http://www.instructables.com/id/Make-a-Seamless-Captive-Nut-in-a-3D-Printed-Part/