kicad-developers team mailing list archive
Mailing list archive
Re: Proposal for batch plotting
On Tue, Jul 31, 2012 at 11:21:39AM +0200, Miguel Angel Ajo Pelayo wrote:
> Hmm, may be it's been too long since I readed that part, or I didn't read
> with experience enough.
> What would be the proccess (C++ objects) to take a BOARD and spit out set
> of gerber files?
You need to fill out a plot option struct (PCB_PLOT_PARAMS, the master copy is in BOARD m_plotOptions) and then call the ExportToGerberFile/ExportToPostScriptFile/ExportToDxfFile/ExportToHpglFile on the frame (sadly the options are not fully decoupled, they pass thru GetPlotSettings but it's easy to pass them as parameter since it's the *first* thing these routines do). Repeat for each layer you want to plot.
That's all, really!
The main routine is in pcbplot.cpp (no idea why isn't in the dialogs directory, since it's a dialog), the driver specifics are in plot*.cpp and common stuff in plot_rtn.cpp
The big idea is: rip out DIALOG_PLOT::Plot, remove the inner for loop (the layer loop) and put all of this *inside* the batch processor loop; the outer loop would set stuff like DIALOG_PLOT::applyPlotSettings, taking them from somewhere else instead of dialog control. Seems easy to me, *after* you have a way to enumerate the batch job records (i.e. the outer loop); it all depends on the source if, for example, layers are identified by number or name (I vote by number).
Oh and BTW it seems that the control enable logic for the plot dialog is quite buggy (probably not refreshed often enough when changing stuff).