I used to do it for plotting plate cams. You can create an AutoCAD script file or write the dxf file itself. An autocad script file (*.scr) is a text file with extention .scr that simulates the sequence of commands at command prompt. It would typically look thus....
The above script would draw a rectangle of 2 x 2. (note the TWO Paragraph returns)
If you do not have AutoCAD, you may have to create the data from a dxf template.