pcb-rnd knowledge pool
Values of the fmt parameter in SaveTo()
save_fmt by Tibor 'Igor2' Palinkas on 2018-02-25
Tags: insight, save, saveas, saveto, format, fmt
On Mon, 5 Feb 2018, Edward Comer wrote: > This begs the question - what are valid parameters for "fmt" in: > SaveTo(Layout|LayoutAs,filename,[fmt])
pcb-rnd is about being modular and dynamic: file formats are handled by plugins. Each IO plugin registers one or more format handlers. The format handler has a name, basically the thing you see in the format combo box of the 'save as' dialog.
When you want to sav a board, pcb-rnd first builds a list of candidate format handlers:
- a candidate must be able to save a board (some IO can not save, only load, others can only deal with footprints, etc.)
if no fmt given, run the heuristics to figure the format:
- check if we know the format from load
- if not, check if we know the file name from load and try to guess by the ending (default endings are also registered by the IO plugins)
- if none of these worked, use the final fallback format from the config
- by now we know the format, either because the user specified it or becuse of the above heuristics
- match the format against each candidate and keep only those with matching name; keep the candidates with matching name
- each IO plugin also registered a "save priority", which is an integer; if by now there are still more than one candidates that say they can save the file in the given format, they are sorted by the "save priority" and the highest prio gets the job
- once the best IO plugin is selected, the save operation is attempted using that plugin; it either succeeds or fails with an error message; no further IO plugins are asked to attempt the save
Plan: later on I want to relax the need for full fmt name match; there would be two rounds of search: if we don't find a full match in the first round, we'd try to find a partial match in the second.
So the short answer to your original question: check what your 'save as' offers, copy one of the names from there.
The long answer is: the available formats depend on the available plugins (how you ./configured pcb-rnd) and in turn it depends on what formats we code. There's no static list we can document, as this might be changing from installation to installation. In theory you can even disable io_lihata and have a pcb-rnd without support for our own native file format.