How to convert battery operated drill bit into riveting gun?

I like to know what are the possible ways to convert drill bit into rivet gun. Even some attachment already available in market. But still it's costly. I like to know how that circular motion changed into pulling force acts on rivets. So I can try to simplify design for economic version.

Please give your guideline..thank you in advance.