Pad height in STEP export

Hi all,
I export my STEP files for the purpose of simulating in Salome / ElmerFEM and small areas between adjacent surfaces cause meshing problems.
I have noticed the STEP export of component pads adds an additional 5um to the pad height and I see this as a hard coded offset in :
pcbnew/exporters/step/step_pcb_model.cpp in function bool STEP_PCB_MODEL::AddPadShape we have const double c_padExtraThickness = 0.005
Out of interest why is this here and can we have a toggle button to switch on/off this extra thickness.

Thanks,
Bob B.

Ah, I see:
// Pad surface as a separate face for FEM simulations.
I would still like to see an option button, though.

Perhaps a properties entry for the pad to support FEM, instead of having a global option ?

Cheers,
Bob.

1 Like

Looks like the relevant issue is here:

You can give it a “thumbs up” to show support or add a comment about your specific usecase. While popularity of an issue does not guarantee a volunteer developer selects the issue for implementation, it certainly doesn’t hurt.

Thankfully, because KiCad is open source, I was able to download the source code and with a little patience, finally was able to build the program with the necessary change I needed for this one task. :slight_smile:

Here is a history of the steps I took to achieve this, just incase anyone is interested in doing the same thing.

STEPS TO CREATE A CUSTOM BUILD OF KICAD9
CREATED ON UBUNTU 22.04, GCC, MODULES ENVIRONMENT, NO PPAs ADDED
R Beattie 11 June 2025

cd ~/local
mkdir kicad9
git clone https://gitlab.com/kicad/code/kicad.git
mv kicad kicad-src
cd kicad-src/
mkdir build
cd build/
sudo apt-get install libglm-dev 
sudo apt-get install libgit2-dev
sudo apt-get install libngspice-kicad-dev ngspice-kicad-dev
sudo apt-get install libocct-foundation-dev 
sudo apt-get install libocct-ocaf-7.5
sudo apt-get install libocct-data-exchange-dev
sudo apt-get install libprotobuf-dev 
sudo apt-get install protobuf-compiler
sudo apt-get install libwxbase3.2-1
sudo apt-get install libwxgtk-media3.2-dev libwxgtk-webview3.2-dev
sudo apt-get install libnng-dev 
sudo apt-get install libsecret-1-dev libsecret-common
cmake ./.. -DCMAKE_INSTALL_PREFIX=/home/bob/local/kicad9
make -j4
make install

cd ../../kicad9

My privatemodules directory contains module files for use with “Environment Modules”

cp ~/privatemodules/ompi506 ~/privatemodules/kicad999
nano ~/privatemodules/kicad999

My kicad999 entry (version 9.99)

#%Module
if [ module-info mode load ]   { puts stderr "Setting up KiCAD999 env."; }
if [ module-info mode unload ] { puts stderr "Removing KiCAD999 from env."; }

prepend-path PATH [exec /bin/bash    -c {echo $HOME/local/kicad9/bin}]
prepend-path LD_LIBRARY [exec /bin/bash    -c {echo $HOME/local/kicad9/lib}]

puts stderr "Done."

SAVE
EXIT

Backup any existing KiCad directories incase they are overwritten.

cd ~/.local/share/kicad
mv 8.0/ 8.0_bak
mv 9.0/ 9.0_bak
cd ~/local/kicad9/share/kicad/
cp -r * ~/.local/share/kicad/

Set symbolic links to where KiCad expects to find its libraries.

sudo ln -s /home/bob/local/kicad9/lib/libkigal.so /usr/lib/x86_64-linux-gnu/libkigal.so.9.99.0
sudo ln -s /home/bob/local/kicad9/lib/libkicommon.so /usr/lib/x86_64-linux-gnu/libkicommon.so.9.99.0
sudo ln -s /home/bob/local/kicad9/lib/libkiapi.so /usr/lib/x86_64-linux-gnu/libkiapi.so.9.99.0
module load kicad999
cd ~/local/kicad9/bin
./kicad

STRACE is a great tool to determine when a program fails, why it is failing.
strace ./kicad

module unload kicad999

OK, if KiCad operates just fine at this point, then lets alter the line of source to remove the pad height difference.

cd local/kicad-src/pcbnew/exporters/step/
nano ~/local/kicad9-src/pcbnew/exporters/step/step_pcb_model.cpp

Search / Scroll till you reach this function entry.

bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool aVia,
                                  SHAPE_POLY_SET* aClipPolygon )
{

FIND
const double c_padExtraThickness = 0.005;
CHANGE TO
const double c_padExtraThickness = 0;

SAVE
EXIT

Rebuild KiCad and try it out.

cd ~/local/kicad-src/build
make -j2
make install
cd ..
cd ./../kicad9/bin
module load kicad999
./kicad
1 Like

KiCad is always welcoming more developers who want to work on the source code :slight_smile:

Even if you don’t want to contribute “officially”. creating a patch from your changes, and uploading that to the issue mentioned above probably makes it easier for someone else to integrate it into KiCad.