Allow plotting without a config file?
Hey, this is pretty neat. I've kind of always felt this kind of thing should be built into KiCad. I suggested it be added to Xess's list.
How would you feel about using some default plot options instead of requiring a config (the config could still be used if needed)? Aditionally, the gerber config for instance could also be read from the kicad_pcb file. Here is an example of the relevant section:
(pcbplotparams
(layerselection 0x014f0_ffffffff)
(usegerberextensions false)
(usegerberattributes false)
(usegerberadvancedattributes false)
(creategerberjobfile false)
(gerberprecision 5)
(excludeedgelayer true)
(linewidth 0.150000)
(plotframeref false)
(viasonmask false)
(mode 1)
(useauxorigin false)
(hpglpennumber 1)
(hpglpenspeed 20)
(hpglpendiameter 15.000000)
(psnegative false)
(psa4output false)
(plotreference false)
(plotvalue true)
(plotinvisibletext false)
(padsonsilk false)
(subtractmaskfromsilk true)
(outputformat 1)
(mirror false)
(drillshape 0)
(scaleselection 1)
(outputdirectory "gerbers/"))
)
I too hope that it can be built in. But I needed (wanted) something now!
Default plot options are tricky. You have to choose a sensible default in all cases and make sure the user realised what they are. If users come to rely on defaults, you can never change them without breaking deliverable files. So I'm not really keen on built-in defaults. For something that results in actual paid-for PCBs, I'd like to make sure the user has, as far as possible, fully specified what they want.
Reading from the PCB is a possibility. Will need to think about who wins: configs or PCB file, and if the general settings apply only to Gerbers or what. It might just be clearer if the user has to provide a complete separate config.
I'm also unsure if we want to "immortalise" settings the user makes in the dialog when they might just be experimenting with options. It's easy to overlook those changes when modifying a PCB file when using VCS and almost inevitable when not using a VCS.
I recently noticed the options part of the .kicad_pcb will be Postscript, HPGL etc as well, not just Gerber. How about this for the time being: if no config is given, read the config from the .kicad_pcb file?
I am also envisioning using this as part of kitspace.org, allowing people to submit KiCad files, rather than Gerber. The problem I have as part of that would be to detect how many copper layers are needed for the design. Maybe this is a separate issue.
Hi @kasbah ! In my fork I added an option to create a config example file. When using this option you can ask to extract the plot options from a PCB. So if you do:
kiplot -b PCB_FILE -p --example
You'll get an example file named example.kiplot.yaml
You can then ask to plot any of the examples, for the gerbers:
kiplot -c example.kiplot.yaml -b PCB_FILE -s all gerber_example
You'll get all the gerber files in the Example/gerber_dir directory.
The generated file contains all the possible outputs, much more that what the original kiplot supports.
Thanks @set-soft, I ended up adapting a simpler script from Greg Davill to do this on Kitspace. Will evaluate your fork when we want to advance it further.