How to generate gcode for Arduino Mega 2560 and Ramps 1.4 CNC Router
For generating g-code from an SVG, you could try to parse the SVG into a set of relative commands, and using the relative commands to generate G-code. Since you were originally using the frame as a 3d printer and now you want to use this as a CNC machine, you could try to invert the data. But, for generating the code I would go read up on how to parse the various file formats, and read the specs on each of the formats. However, most of the file formats you listed are proprietary, and you won't be able to find an open spec for them.

Of the formats that you listed, it would probably be the easiest to parse the SVG, as it's an open spec, and is a lot like XML.

This is going to be really difficult to actually do, because you're essentially reimplementing a full CNC controller.

I would start with getting 2 dimensional stuff down like drawing shapes and setting routing depth.

Some Resources

Here are some resources that might help you with parsing the various file formats. I only listed the ones that have an open standard.


http://www.w3schools.com/svg/default.asp
This link describes the SVG format, and it does a fairly decent job at it.
http://en.wikipedia.org/wiki/G-code
http://en.wikipedia.org/wiki/STL_%28file_format%29