How do you make a perfect snapping-system?

Take a look at EgoMoose’s implementation of a furniture placement it might be of great help: