Kicad-cli automation

Hello i am working on my first plugin that normalize and automatize the fabrication outputs.

I generate gerbers,drill, bob, schematic. etc etc.
Another thing that i need generate is all PCB layers on PDF format (normally the certification bureau require this in pdf format)
i try this command with the same structure than another outputs:
“[PATH]\kicad-cli.exe” pcb export pdf “[PATH_PJT]\[PJT_NAME].kicad_pcb” --mode-multipage --black-and-white --drill-shape-opt 2 --output “[PATH_PJT]\[PJT_NAME]\Outs\Eng\[PJT_NAME].pcb.pdf”

The question is that generate the folder “pcb.pdf” and put the project.pdf inside instead of create the project.pcb.pdf as do all another outputs generated by kicad-cli

I think that this is a small bug, or if is a behaviour must be a way to solve this. Thanks for any clue or workaround.

In another hand, if is possible i want include drill inside the generated pcb.pdf

It’s not a bug, the cli implements and share the gui code paths for generation. In the GUI, the output path is always a folder even in multiple/single document mode

1 Like

Dear marekr.

Sadly i must inform that in all following outputs i specify the file name and works creaing a file with the pointed name and not a folder with this name.

            ["kicad-cli", "pcb", "export", "pos", pcb_path, "--side", "front", "--output", os.path.normpath(os.path.join(mount_dir, f"{project_name}.pnp_top.csv") )],
            ["kicad-cli", "pcb", "export", "pos", pcb_path, "--side", "back" , "--output", os.path.normpath(os.path.join(mount_dir, f"{project_name}.pnp_bot.csv") )],
            ["kicad-cli", "pcb", "export", "pdf", pcb_path, "--layers", "F.SilkS", "--black-and-white", "--output", os.path.normpath(os.path.join(mount_dir, f"{project_name}.gbr_top.pdf") )],
            ["kicad-cli", "pcb", "export", "pdf", pcb_path, "--layers", "B.SilkS", "--black-and-white", "--output", os.path.normpath(os.path.join(mount_dir, f"{project_name}.gbr_bot.pdf") )],
            ["kicad-cli", "sch", "export", "bom", sch_path, "--output",  os.path.normpath(os.path.join(mount_dir, f"{project_name}.bom.csv") ), "--fields", "${QUANTITY},Reference,Value,MPN,Description,Footprint,DETNOV_SAGE","--group-by", "Value,MPN,Footprint","--ref-delimiter", ", "],
            ["kicad-cli", "sch", "export", "pdf", sch_path,  "--output", os.path.normpath(os.path.join(eng_dir, f"{project_name}.sch.pdf") ) ],
            ["kicad-cli", "pcb", "export", "step", pcb_path, "--output", os.path.normpath(os.path.join(eng_dir, f"{project_name}.step") ) ],


There are of course options that accept single file paths.