When I export a PCB as a STEP file, I’ve noticed that all of the components are positioned 0.05mm off the surface of the PCB. Since I’m using these STEP files for testing mechanical assembly with connectors, checking alignment and clearance, I’d really like to not have it do this.
I did some digging into the STEP exporter code, and this behavior appears to be intentional and hard-coded. The relevant code can be found here:
(The actual lines have been moved around across many refactorings, so their exact location may be different on newer or older branches of the code.)
When trying to look back through the history of this code, the offset behavior dates all the way back to when the kicad2step code was originally merged into the source tree. No explanation was provided that I can find.
I really want to disable this behavior, so my components in exported STEP files are flush with the surface of the PCB as they are in KiCad’s built-in 3D board viewer. I’m just trying to figure out the path forward here before I open any sort of actual issue/ticket.
The options I see as possible are:
- Remove the board offset from the STEP exporter code
- Make the board offset a configurable option for the STEP export process (presented via the export dialog and/or command line parameters)
- Make the board offset dependent on the PCB stackup settings, where I can pick ones that make it effectively zero
Any thoughts?
In the short term, my workaround is to simply have my own source build of KiCad v7 where I’ve commented out the above-mentioned lines. This works, but is not a convenient or ideal solution.