OpenCASCADE error on STEP model export

Hi,

I’m facing some issues while trying to export my board as an STEP file, but one of my components is giving me problems. It’s a 3D model I created in Fusion360 and I exported it to STEP myself. I imagine the goal of this post is to fill a bug report, but at this point I’m not sure where, and I hope you can help me with that.

I created a board with a component with my 3D model (link to my model Fusion, sorry but I’m on the free plan and can’t give access to download it). The model opens nicely in as many STEP viewers as I could find, and KiCad can also display it without issues. When I try to export the STEP file of the whole board, I get this message

Could not add 3D model for U1.
OpenCASCADE error: TDocStd_XLinkTool::Copy : not self-contained

I tried to look for this error but only found a reference to another thread ( OpenCASCADE error while exporting step file - #3 by TopHound ) where the advice is to import/export to/from FreeCad and use the new model. I tried that, and it blew the size of the model from 2MB to 14MB, but the exported model is completely garbled, so that’s not an option, at least for my model.

This model is composed of a couple of headers plus a board that I include as a link. As far as I am aware, the model is “self-contained” in the sense that all the STEP viewers I tried (including KiCad) show the part perfectly fine, with colours and all. In any case, I tried to remove the links so the Fusion360 file has no link information and includes all the info of its components on itself, exported an step from there, but I get the same error. It’s also worth mentioning that, when opening the STEP in FreeCAD, the “linked” part of my 3D model had no colour information, so there might be something there pointing to a broken link…

I don’t know where to ask for help. Doesn’t seem to be a KiCad bug, as KiCad can process the 3D model totally fine. Maybe someone with more experience with 3D models can say if it’s a problem with my Fusion exported model or if it’s an OpenCASCADE issue?

I tried to create a minimal project. It’s just a board with 4 “instances” of my part:

  • With the original STEP model (exported from a Fusion360 file that has a linked part), accessed as an external file
  • With the same STEP model, embedded on the footprint file (just in case)
  • With a STEP model obtained from importing to / exporting from FreeCAD. This one works, as it doesn’t trigger an error, but the model is completely broken.
  • With an STEP model obteined from a new Fusion360 file

Does anybody have any leads on how can I solve this?

Link to the demo project

Can you report a bug using Help → Report Bug in KiCad with your STEP file attached?

I can, and I will, but it was more a matter to ask first if the issue was on a malformed STEP file, a problem in the library handling the export, or a problem in KiCad.

Issue, for reference, is Error when exporting STEP model (#22417) · Issues · KiCad / KiCad Source Code / kicad · GitLab

And please give details of your KiCad version. There have been a few STEP export bug fixes in the last few months