Automatic generation of images of the 3D model

I would like to automate the generation of images of the 3D model of a PCB. Currently I do that manually in this way:

  1. Open a KiCad PCB.
  2. Click “View→3D Viewer”.
  3. Click and drag with the mouse to rotate the PCB into the desired angle.
  4. Click on “File→Export Current View as PNG”.

Is it possible to do this using kicad-cli? Is there any other tool that can do this? Like exporting the 3D model using kicad-cli export and then using something else like FreeCAD?

It’s possible in the nightly builds: see Post-V8 New Features and Development News - #12 by dsa-t

2 Likes

It works, but

  1. the --rotate option always fails in this way:
$ kicad-cli-nightly --version
8.99.0

$ kicad-cli-nightly pcb render --floor -o render2.png my_pcb.kicad_pcb --rotate '-45,0,45'
Unknown argument: -45,0,45
  1. Another issue I see is that the “user comments” and some other non-physical layers are visible in the render, when using --side bottom.

  2. Text variables in the silkscreen work partially. My own variables, e.g. ${MY_VARIABLE} is displayed fine, however ${PROJECTNAME} is not shown, it prints an empty string there "".

Let me know if there is a better way of reporting this, like somewhere in GitHub or GitLab or wherever.

Depending on your shell you may need to use --rotate "'-45,0,45'" or --rotate \'-45,0,45\'

1 Like

Layers in 3D depend on which layers you have selected in Plot options by default, but you should be able to create your own presets as well.

This is worth reporting on GitLab (Help → Report Bug)

Where are the plot options defined? In the KiCad GUI or somewhere else? I only see them when going to the “plot” dialog, but don’t see how to save them.

Yes, in the UI. They should be saving when you run Plot.

Ok, will try. Would be nice to have the possibility to decide that when generating the render from CLI.