Doub has announced the release of the Aperture scripting, a set of Lua libraries to manipulate PCB data files. He writes:
At the core of my Gerber Viewer (that you’ve made quite popular, thank you all), there’s always been a set of Lua libraries to load the Gerber and Excellon files, and I’ve privately used them to also manipulate these files and generate panels among other things. I’ve finally took some time to clean it up, polish the feature set, fix many bugs, and document the whole thing, and it’s now available for all to use.
Via the forum.