No idea about how to do that in Openscad, and a bit dubious over the idea of using that for a drive, in my experience the balls have a little play in those things. On the other hand it would work on a steampunk themed printer.