How to fix "kicad-cli pcb export step" not exporting component 3D models

Problem:

You are trying to export a 3D STEP model of your PCB using a command such as

kicad_export_step.sh
kicad-cli pcb export step MyPCB.kicad_pcb

but the resulting STEP file is missing all (or almost all) component models (i.e. only the PCB is exported).

Furthermore, in the output of the command, you can read

kicad_vrml_error.txt
Cannot add a VRML model to a STEP file.

for every single component, for example

kicad_vrml_error_examples.txt
Add component R6.
Cannot add a VRML model to a STEP file.
Add component R21.
Cannot add a VRML model to a STEP file.
Add component C7.
Cannot add a VRML model to a STEP file.
Add component C16.
Cannot add a VRML model to a STEP file.

Solution

Add the --subst-models flag to kicad-cli in order to automatically substitute VRML models with STEP models:

kicad_export_step_with_subst.sh
kicad-cli pcb export step MyPCB.kicad_pcb --subst-models

After that, all available component models will be exported just like in the viewer.


Check out similar posts by category: Electronics, KiCAD