Making it easier to generate compliant 3D models to footprints

The Footprint 3D model requirements section of the KiCad Library Conventions specifies that 3D models MUST be specified as VRML (.wrl file extension), and that it MUST NOT require scalingor rotation.

The vast majority of 3D models in the wild, supplied by manufacturers or library managers, however, are supplied in STEP format, and mostly require rotation to fit the footprint. While conversion can be automated somewhat by scripting FreeCad or using online converters, this often results in loss of information (e.g. color), and will not provide any scaling or rotation of the model.

I therefore propose that a feature is implemented (possibly as a KiCad extension) that allows a 3D model, properly scaled, rotated and positioned in Footprint Editor > Footprint Properties > 3D Models to be …

  1. Scaled (according to the current settings)
  2. Rotated (according to the current settings)
  3. Positioned (according to the current settings)
  4. Exported as a VRML (.wrl) file
  5. Added to the 3D Model(s) list with Show checked
  6. Unchecks the Showcheckbox of the existing STEP model

This will allow compliant 3D models to be easily associated with footprints, and thus 3D models of PCBs to be exported as STEP file for subsequent mechanical and visual work to be done.

An alternative to this semi-automatic VRML 3D model generation would be for KiCAD to dynamically generate the above VRML model, as required, based on an existing STEP model and scaling/rotation/position parameters, thus satisfying the requirements of the KLC, even though only a wrongly scaled/rotated/positioned STEP file exists in the footprint properties.

What do you guys/gals/* think?

PS: I realize that this type of “hack” (scripting the UI of a third party applicatioon like FreeCAD from within KiCad – or as a batch process – is not the “proper” way of implementing features, but given the resource constraints of the KiCad development team, the old proverb “Perfect is the enemy of good” could be applied to this instance.

This is not a comment on your suggested feature, but keep in mind that the KLC rules you cite are for models in the official libraries, and the vast majority of models floating around on the internet (from manufacturers or otherwise) are not licensed in a way that would allow them to be distributed with the KiCad libraries.

You’re free to follow or not follow KLC in your personal libraries as you see fit :slight_smile:

The guidelines that I link to (F9.3 Footprint 3D model requirements) are not part of the M1/M2 Contribution Guidelines, but are mostly specified for KiCad to be able to export STEP models of PCB assemblies (e.g. “1. Filetype must be .wrl (KiCad replaces it with .step automatically for the step export.)”). Or rather – I have not been able to consistently export 3D STEP models of PCBs containing footprints in STEP format, scaled, rotated and positioned to fit the footprint, even though the 3D viewer seems to cope fine.

Also, I do not suggest distributing any third-party 3D models as part of the official KiCad libraries, but simply propose an easy way to use ubiquitous 3D models as part of a KiCad PCB design.

With the new 3D model manipulation APIs in 7.99, it should be possible to fix the STEP transformations.

Note that If the scale is applied to the wrl model, it won’t apply to the step model.

We were planning on getting rid of wrl models in official libraries later.

Uh… that sounds excellent and might invalidate my proposal entirely.

I will certainly have to take a serious look at 7.99

The KLC rules still are still only required for parts in the KiCad libraries, although many of them are quite reasonable for anyone to follow. In this case, I see your point - most people should follow that rule so that their step assemblies are exported correctly.

Nevertheless I think dsa-t’s comment is probably correctly diagnosing your issue - the transformations are only applied to the 3D model listed in the footprint (typically a WRL for anything from the KiCad libraries), and not to a step model which may be substituted for the listed footprint during the export step.

Personally I always align my footprints in Freecad with stepup, which as you say is pretty time consuming, but if I want a mechanical model of the board then I want the models to be accurately located, and for that I want to use mechanical cad tools.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.