How to model threads for 3d printing

Is there a way, to model threads for 3d Printing?

So that a threaded hole, a bolt with thread, or a nut match together after printing?
Like: I want an M10X30 thread and a threaded hole that can be screwed together after printing?
The following video shows an example:
https://www.youtube.com/watch?v=jhrRM0McDgA

the dmthread command, seems not to model the threads in 3 do, so that they can be printed.