For 2D, sometimes I find it nearly easier to write the gcode by hand (or make a python program that writes the gcode for you). It really isn't as complicated as it sounds, especially if you can tolerate doing 3D in openSCAD.
I'm very into code-based CAD, I actually gave a small talk on it a year or two ago. A longer term goal of mine is to make some sort of hybrid CAD modeling tool which is mostly code-based, but has a GUI for certain things like defining sketches/constraints, and selecting particular geometric features that are hard to describe in code.
Here's a link to the talk if anyone can bear to listen to me for an hour: